3 # This test verifies that garbage-collection is correctly garbage collecting
4 # unused sections when the symbol of the unused section is only referred by
5 # an unused PROVIDE symbol.
7 # RUN: rm -rf %t && split-file %s %t && cd %t
8 # RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
9 # RUN: ld.lld -o a_nogc a.o -T script.t
10 # RUN: llvm-nm a_nogc | FileCheck -check-prefix=NOGC %s
11 # RUN: ld.lld -o a_gc a.o --gc-sections --print-gc-sections -T script.t | FileCheck --check-prefix=GC_LINK %s
12 # RUN: llvm-nm a_gc | FileCheck -check-prefix=GC %s
14 NOGC-
NOT: another_unused
23 GC_LINK
: removing unused section
a.o
:(.text.bar)
25 GC-
NOT: another_unused
40 .section .text.foo,"ax",@progbits
44 .section .text.bar,"ax",@progbits
49 .section .text.baz,"ax",@progbits
56 PROVIDE
(unused
= bar
+ "used");
57 PROVIDE
("used" = another_used
);
58 PROVIDE
(baz_ref
= baz
);
59 PROVIDE
(another_used
= baz_ref
);
60 PROVIDE
(another_unused
= unused
+ bar
+ 0x1);