1; REQUIRES: x86 2 3;; For non-relocatable output, test we parse symbol versions after LTO, 4;; otherwise we may get a symbol named "foo@@VER1", but not "foo" with the 5;; version VER1. 6 7; RUN: split-file %s %t 8; RUN: llvm-as %t/ir -o %t.o 9; RUN: llvm-mc -filetype=obj -triple=x86_64 %t/asm -o %tbar.o 10; RUN: ld.lld %tbar.o -shared --soname=tbar --version-script %t/ver -o %tbar.so 11 12;; Emit an error if bar@VER1 is not defined. 13; RUN: not ld.lld %t.o -o /dev/null -shared --version-script %t/ver 2>&1 | FileCheck %s --check-prefix=UNDEF 14 15; UNDEF: error: undefined symbol: bar@VER1 16 17; RUN: ld.lld %t.o %tbar.so -o %t.so -shared --version-script %t/ver 18; RUN: llvm-readelf --dyn-syms %t.so | FileCheck %s 19 20; CHECK: UND bar@VER1 21; CHECK-NEXT: {{[1-9]}} foo@@VER1 22 23;; For relocatable output, @ should be retained in the symbol name. 24;; Don't parse and drop `@VER1`. Also check that --version-script is ignored. 25; RUN: ld.lld %t.o -o %t.ro -r --version-script %t/ver 26; RUN: llvm-readelf -s %t.ro | FileCheck %s --check-prefix=RELOCATABLE 27 28; RELOCATABLE: {{[1-9]}} foo@@VER1 29; RELOCATABLE-NEXT: UND bar@VER1 30 31;--- ver 32VER1 {}; 33;--- ir 34target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 35target triple = "x86_64-unknown-linux-gnu" 36 37module asm ".global foo" 38module asm "foo: call bar" 39module asm ".symver foo,foo@@@VER1" 40module asm ".symver bar,bar@@@VER1" 41 42;--- asm 43.globl bar 44.symver bar,bar@@@VER1 45bar: 46 ret 47