llvm-project
64 строки · 1.6 Кб
1# REQUIRES: x86
2
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
7
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:
26
27.text
28_foo:
29retq
30
31_bar:
32retq
33
34_baz:
35callq _foo
36retq
37
38.no_dead_strip _quux
39_quux:
40callq _foo
41retq
42
43.globl _main
44_main:
45callq _foo
46callq _baz
47callq _undef
48callq ___isnan
49retq
50
51.globl _abs
52_abs = 0x1000
53
54.section __TEXT,support,regular,live_support
55_support:
56callq _foo
57callq _abs
58retq
59
60_support_refs_dylib_fun:
61callq ___isnan
62retq
63
64.subsections_via_symbols
65