2 # RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
4 ## Discard an unused .gcc_except_table in a COMDAT group or having SHF_LINK_ORDER
5 ## if the associated text section is discarded.
7 # RUN: ld.lld --gc-sections --print-gc-sections -u _Z3foov %t.o -o /dev/null | \
8 # RUN: FileCheck %s --implicit-check-not=.gcc_except_table
10 # CHECK: removing unused section {{.*}}.o:(.text._Z6comdatv)
11 # CHECK-NEXT: removing unused section {{.*}}.o:(.text._Z9linkorderv)
12 # CHECK-NEXT: removing unused section {{.*}}.o:(.gcc_except_table._Z6comdatv)
13 # CHECK-NEXT: removing unused section {{.*}}.o:(.gcc_except_table._Z9linkorderv)
15 ## An unused non-group non-SHF_LINK_ORDER .gcc_except_table is not discarded.
17 # RUN: ld.lld --gc-sections --print-gc-sections -u _Z6comdatv -u _Z9linkorderv %t.o -o /dev/null | \
18 # RUN: FileCheck /dev/null --implicit-check-not=.gcc_except_table
20 ## If the text sections are live, the .gcc_except_table sections are retained as
21 ## well because they are referenced by .eh_frame pieces.
23 # RUN: ld.lld --gc-sections --print-gc-sections -u _Z3foov -u _Z6comdatv -u _Z9linkorderv %t.o -o /dev/null | \
24 # RUN: FileCheck %s --check-prefix=KEEP
26 # KEEP-NOT: .gcc_except_table
28 .section .text._Z3foov,"ax",@progbits
33 .cfi_lsda 0x1b,.Lexception0
36 .section .text._Z6comdatv,"axG",@progbits,_Z6comdatv,comdat
41 .cfi_lsda 0x1b,.Lexception1
44 .section .text._Z9linkorderv,"ax",@progbits
49 .cfi_lsda 0x1b,.Lexception2
52 .section .gcc_except_table._Z3foov,"a",@progbits
56 .section .gcc_except_table._Z6comdatv,"aG",@progbits,_Z6comdatv,comdat
60 .section .gcc_except_table._Z9linkorderv,"ao",@progbits,_Z9linkorderv