Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / version-script-symver.s
blobee87c3405ab63ef8819f33a2de195392a65156f0
1 # REQUIRES: x86
2 ## Test how .symver interacts with --version-script.
3 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
4 # RUN: echo 'call foo3; call foo4' > %tref.s
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 %tref.s -o %tref.o
7 # RUN: echo 'v1 { local: foo1; }; v2 { local: foo2; };' > %t1.script
8 # RUN: ld.lld --version-script %t1.script -shared %t.o -o %t1.so
9 # RUN: llvm-readelf --dyn-syms %t1.so | FileCheck --check-prefix=EXACT %s
10 # EXACT: UND
11 # EXACT-NEXT: [[#]] foo4@@v2
12 # EXACT-NEXT: [[#]] _start{{$}}
13 # EXACT-NEXT: [[#]] foo3@v1
14 # EXACT-NOT: {{.}}
16 # RUN: echo 'v1 { local: foo*; }; v2 {};' > %t2.script
17 # RUN: ld.lld --version-script %t2.script -shared %t.o -o %t2.so
18 # RUN: llvm-readelf --dyn-syms %t2.so | FileCheck --check-prefix=WC %s
19 # WC: UND
20 # WC-NEXT: [[#]] foo4@@v2
21 # WC-NEXT: [[#]] _start{{$}}
22 # WC-NOT: {{.}}
24 # RUN: echo 'v1 { global: *; local: foo*; }; v2 {};' > %t3.script
25 # RUN: ld.lld --version-script %t3.script -shared %t.o -o %t3.so
26 # RUN: llvm-readelf --dyn-syms %t3.so | FileCheck --check-prefix=MIX1 %s
27 # MIX1: UND
28 # MIX1-NEXT: [[#]] foo4@@v2
29 # MIX1-NEXT: [[#]] _start@@v1
30 # MIX1-NOT: {{.}}
32 # RUN: echo 'v1 { global: foo*; local: *; }; v2 { global: foo4; local: *; };' > %t4.script
33 # RUN: ld.lld --version-script %t4.script -shared %t.o -o %t4.so
34 # RUN: llvm-readelf --dyn-syms %t4.so | FileCheck --check-prefix=MIX2 %s
35 # MIX2: UND
36 # MIX2-NEXT: [[#]] foo1@@v1
37 # MIX2-NEXT: [[#]] foo2@@v1
38 # MIX2-NEXT: [[#]] foo4@@v2
39 # MIX2-NEXT: [[#]] foo3@v1
40 # MIX2-NOT: {{.}}
42 # RUN: ld.lld --version-script %t4.script -shared %t.o %tref.o -o %t5.so
43 # RUN: llvm-readelf -r %t5.so | FileCheck --check-prefix=RELOC %s
45 # RELOC: R_X86_64_JUMP_SLOT {{.*}} foo4@@v2 + 0
46 # RELOC: R_X86_64_JUMP_SLOT {{.*}} foo3@v1 + 0
48 .globl foo1; foo1: ret
49 .globl foo2; foo2: ret
50 .globl foo3; .symver foo3,foo3@v1; foo3: ret
51 .globl foo4; .symver foo4,foo4@@v2; foo4: ret
53 .globl _start; _start: ret