Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / why-live.s
blob40d94e9da25c65cbcbda9ee41811262421476c14
1 # REQUIRES: x86
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t.o
4 # RUN: %lld -lSystem -dead_strip -why_live _foo -why_live _undef -U _undef \
5 # RUN: -why_live _support -why_live _support_refs_dylib_fun \
6 # RUN: -why_live _abs %t.o -o /dev/null 2>&1 | FileCheck %s
8 ## Due to an implementation detail, LLD is not able to report -why_live info for
9 ## absolute symbols. (ld64 has the same shortcoming.)
10 # CHECK-NOT: _abs
11 # CHECK: _foo from {{.*}}why-live.s.tmp.o
12 # CHECK-NEXT: _quux from {{.*}}why-live.s.tmp.o
13 # CHECK-NEXT: _undef from {{.*}}why-live.s.tmp.o
14 # CHECK-NEXT: _main from {{.*}}why-live.s.tmp.o
15 ## Our handling of live_support sections can be improved... we should print the
16 ## dylib symbol that keeps _support_refs_dylib_fun alive, instead of printing
17 ## the live_support symbol's name itself. (ld64 seems to have the same issue.)
18 # CHECK-NEXT: _support_refs_dylib_fun from {{.*}}why-live.s.tmp.o
19 # CHECK-NEXT: _support_refs_dylib_fun from {{.*}}why-live.s.tmp.o
20 ## Again, this can be improved: we shouldn't be printing _support twice. (ld64
21 ## seems to have the same issue.)
22 # CHECK-NEXT: _support from {{.*}}why-live.s.tmp.o
23 # CHECK-NEXT: _support from {{.*}}why-live.s.tmp.o
24 # CHECK-NEXT: _foo from {{.*}}why-live.s.tmp.o
25 # CHECK-EMPTY:
27 .text
28 _foo:
29 retq
31 _bar:
32 retq
34 _baz:
35 callq _foo
36 retq
38 .no_dead_strip _quux
39 _quux:
40 callq _foo
41 retq
43 .globl _main
44 _main:
45 callq _foo
46 callq _baz
47 callq _undef
48 callq ___isnan
49 retq
51 .globl _abs
52 _abs = 0x1000
54 .section __TEXT,support,regular,live_support
55 _support:
56 callq _foo
57 callq _abs
58 retq
60 _support_refs_dylib_fun:
61 callq ___isnan
62 retq
64 .subsections_via_symbols