Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / wrap-defined.s
blob026b526617265cd46b193192bb79f2b1132ee831
1 # REQUIRES: x86
3 # RUN: rm -rf %t && split-file %s %t
4 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/main.s -o %t/main.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/wrap.s -o %t/wrap.o
6 # RUN: ld.lld -shared --soname=fixed %t/wrap.o -o %t/wrap.so
8 ## GNU ld does not wrap a defined symbol in an object file
9 ## https://sourceware.org/bugzilla/show_bug.cgi?id=26358
10 ## We choose to wrap defined symbols so that LTO, non-LTO and relocatable links
11 ## behave the same. The 'call bar' in main.o will reference __wrap_bar. We cannot
12 ## easily distinguish the case from cases where bar is not referenced, so we
13 ## export __wrap_bar whenever bar is defined, regardless of whether it is indeed
14 ## referenced.
16 # RUN: ld.lld -shared %t/main.o --wrap bar -o %t1.so
17 # RUN: llvm-objdump -d %t1.so | FileCheck %s
18 # RUN: ld.lld %t/main.o %t/wrap.so --wrap bar -o %t1
19 # RUN: llvm-objdump -d %t1 | FileCheck %s
21 # CHECK: <_start>:
22 # CHECK-NEXT: callq {{.*}} <__wrap_bar@plt>
24 #--- main.s
25 .globl _start, bar
26 _start:
27 call bar
28 bar:
30 #--- wrap.s
31 .globl __wrap_bar
32 __wrap_bar:
33 retq