Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / allow-shlib-undefined-weak.s
blob1037cbed0d859fd2ba697d33488c2e40d34175cd
1 # REQUIRES: x86
3 # RUN: rm -rf %t.dir
4 # RUN: split-file %s %t.dir
5 # RUN: cd %t.dir
7 ## Verify that in the following case:
8 ##
9 ## <exec>
10 ## +- ref.so (weak reference to foo)
11 ## +- wrap.so (non-weak reference to foo)
12 ## +- def.so (defines foo)
14 ## we don't report that foo is undefined in ref.so when linking <exec>.
16 # RUN: llvm-mc -filetype=obj -triple=x86_64 ref.s -o ref.o
17 # RUN: llvm-mc -filetype=obj -triple=x86_64 wrap.s -o wrap.o
18 # RUN: llvm-mc -filetype=obj -triple=x86_64 def.s -o def.o
19 # RUN: ld.lld -shared ref.o -o ref.so
20 # RUN: ld.lld -shared def.o -soname def.so -o def.so
21 # RUN: ld.lld -shared wrap.o def.so -o wrap.so
23 # RUN: llvm-mc -filetype=obj -triple=x86_64 start.s -o start.o
24 # RUN: ld.lld --no-allow-shlib-undefined start.o wrap.so ref.so -o /dev/null 2>&1 | count 0
26 #--- start.s
27 .globl _start
28 _start:
29 callq wrap_get_foo@PLT
31 #--- ref.s
32 .weak foo
33 .globl ref_get_foo
34 ref_get_foo:
35 movq foo@GOTPCREL(%rip), %rax
36 retq
38 #--- wrap.s
39 .globl wrap_get_foo
40 wrap_get_foo:
41 movq foo@GOTPCREL(%rip), %rax
42 retq
44 #--- def.s
45 .data
46 .globl foo
47 foo:
48 .long 0