3 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
4 # RUN: ld.lld %t -o %t2
5 # RUN: llvm-readobj --sections --symbols %t2 | FileCheck -check-prefix=NOGC %s
6 # RUN: ld.lld --gc-sections --print-gc-sections %t -o %t2 | FileCheck --check-prefix=GC1-DISCARD %s
7 # RUN: llvm-readobj --sections --symbols %t2 | FileCheck -check-prefix=GC1 %s
8 # RUN: ld.lld --export-dynamic --gc-sections %t -o %t2
9 # RUN: llvm-readobj --sections --symbols %t2 | FileCheck -check-prefix=GC2 %s
11 # NOGC: Name: .eh_frame
20 # NOGC: Name: .fini_array
21 # NOGC: Name: .init_array
22 # NOGC: Name: .preinit_array
25 # NOGC: Name: .debug_pubtypes
26 # NOGC: Name: .comment
38 # GC1-DISCARD: removing unused section {{.*}}:(.text.d)
39 # GC1-DISCARD-NEXT: removing unused section {{.*}}:(.text.x)
40 # GC1-DISCARD-NEXT: removing unused section {{.*}}:(.text.y)
41 # GC1-DISCARD-NEXT: removing unused section {{.*}}:(.tbss.f)
42 # GC1-DISCARD-NEXT: removing unused section {{.*}}:(.tdata.h)
43 # GC1-DISCARD-NEXT: removing unused section {{.*}}:(.init_x)
44 # GC1-DISCARD-NEXT: removing unused section {{.*}}:(.jcr_x)
47 # GC1: Name: .eh_frame
55 # GC1: Name: .fini_array
56 # GC1: Name: .init_array
57 # GC1: Name: .preinit_array
59 # GC1: Name: .debug_pubtypes
72 # GC2: Name: .eh_frame
80 # GC2: Name: .fini_array
81 # GC2: Name: .init_array
82 # GC2: Name: .preinit_array
84 # GC2: Name: .debug_pubtypes
98 .protected a, b, c, e, f, g, h, x, y
102 .section .text.a,"ax",@progbits
107 .section .text.b,"ax",@progbits
109 leaq e@tpoff
(%rax
),%rdx
112 .section .text.c,"ax",@progbits
114 leaq g@tpoff
(%rax
),%rdx
116 .section .text.d,"ax",@progbits
120 .section .text.x,"ax",@progbits
124 .section .text.y,"ax",@progbits
128 .section .tbss.e,"awT",@nobits
132 .section .tbss.f,"awT",@nobits
136 .section .tdata.g,"awT",@progbits
140 .section .tdata.h,"awT",@progbits
144 .section .ctors,"aw",@progbits
147 .section .dtors,"aw",@progbits
153 .section .init_x,"ax"
159 .section .fini_array,"aw",@fini_array
162 # https://golang.org/cl/373734
163 .section .init_array,"aw",@progbits
166 # Work around https://github.com/rust-lang/rust/issues/92181
167 .section .init_array.00001,"aw",@progbits
170 .section .preinit_array,"aw",@preinit_array
179 .section .eh_frame,"a",@unwind
182 .section .debug_pubtypes,"",@progbits
185 .section .comment,"MS",@progbits,8