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: 29 retq 30 31_bar: 32 retq 33 34_baz: 35 callq _foo 36 retq 37 38.no_dead_strip _quux 39_quux: 40 callq _foo 41 retq 42 43.globl _main 44_main: 45 callq _foo 46 callq _baz 47 callq _undef 48 callq ___isnan 49 retq 50 51.globl _abs 52_abs = 0x1000 53 54.section __TEXT,support,regular,live_support 55_support: 56 callq _foo 57 callq _abs 58 retq 59 60_support_refs_dylib_fun: 61 callq ___isnan 62 retq 63 64.subsections_via_symbols 65