[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / gc-sections-with-provide.s
blob268faa435468703ba97a31f2410a77e5dfea33f8
1 # REQUIRES: x86
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
15 NOGC: another_used
16 NOGC: bar
17 NOGC: baz
18 NOGC: baz_ref
19 NOGC: foo
20 NOGC-NOT: unused
21 NOGC: used
23 GC_LINK: removing unused section a.o:(.text.bar)
25 GC-NOT: another_unused
26 GC: another_used
27 GC-NOT: bar
28 GC: baz
29 GC: baz_ref
30 GC: foo
31 GC-NOT: unused
32 GC: used
34 #--- a.s
35 .global _start
36 _start:
37 call foo
38 call used
40 .section .text.foo,"ax",@progbits
41 foo:
42 nop
44 .section .text.bar,"ax",@progbits
45 .global bar
46 bar:
47 nop
49 .section .text.baz,"ax",@progbits
50 .global baz
51 baz:
52 nop
55 #--- script.t
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);