Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / wrap-dynamic-undef.s
blobca1698173ef59f9e717cf002a5032b15f04daff7
1 # REQUIRES: x86
2 # RUN: split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o
4 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/def.s -o %t/def.o
5 # RUN: ld.lld %t/def.o -o %t/def.so -shared --soname=def
6 # RUN: ld.lld %t/a.o %t/def.so -o %t1 --wrap foo
7 # RUN: llvm-readelf --dyn-syms %t1 | FileCheck %s
9 # Test that the dynamic relocation uses foo. We used to produce a
10 # relocation with __real_foo.
12 # CHECK: Symbol table '.dynsym' contains 2 entries:
13 # CHECK: NOTYPE LOCAL DEFAULT UND
14 # CHECK-NEXT: NOTYPE GLOBAL DEFAULT UND foo
16 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/b.s -o %t/b.o
17 # RUN: ld.lld -shared --wrap foo %t/b.o -o %t2.so
18 # RUN: llvm-readelf --dyn-syms %t2.so | FileCheck %s --check-prefix=SYM2
20 # SYM2: Symbol table '.dynsym' contains 4 entries:
21 # SYM2: NOTYPE LOCAL DEFAULT UND
22 # SYM2-NEXT: NOTYPE WEAK DEFAULT UND foo
23 # SYM2-NEXT: NOTYPE WEAK DEFAULT UND __wrap_foo
24 # SYM2-NEXT: NOTYPE GLOBAL DEFAULT [[#]] _start
26 #--- a.s
27 .global _start
28 _start:
29 callq __real_foo@plt
31 #--- def.s
32 .globl foo
33 foo:
35 #--- b.s
36 .weak foo
37 .weak __real_foo
38 .global _start
39 _start:
40 call __real_foo@plt
41 call foo@plt