• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2# RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
3
4## Discard an unused .gcc_except_table in a COMDAT group if the associated text
5## section is discarded.
6
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
9
10# CHECK:      removing unused section {{.*}}.o:(.text._Z6comdatv)
11# CHECK-NEXT: removing unused section {{.*}}.o:(.gcc_except_table._Z6comdatv)
12
13## An unused non-group .gcc_except_table is not discarded.
14
15# RUN: ld.lld --gc-sections --print-gc-sections -u _Z6comdatv %t.o -o /dev/null | \
16# RUN:   FileCheck /dev/null --implicit-check-not=.gcc_except_table
17
18## If the text sections are live, the .gcc_except_table sections are retained as
19## well because they are referenced by .eh_frame pieces.
20
21# RUN: ld.lld --gc-sections --print-gc-sections -u _Z3foov -u _Z6comdatv %t.o -o /dev/null | \
22# RUN:   FileCheck %s --check-prefix=KEEP
23
24# KEEP-NOT: .gcc_except_table
25
26.section .text._Z3foov,"ax",@progbits
27.globl _Z3foov
28_Z3foov:
29  .cfi_startproc
30  ret
31  .cfi_lsda 0x1b,.Lexception0
32  .cfi_endproc
33
34.section .text._Z6comdatv,"axG",@progbits,_Z6comdatv,comdat
35.globl _Z6comdatv
36_Z6comdatv:
37  .cfi_startproc
38  ret
39  .cfi_lsda 0x1b,.Lexception1
40  .cfi_endproc
41
42.section .gcc_except_table._Z3foov,"a",@progbits
43.Lexception0:
44  .byte 255
45
46.section .gcc_except_table._Z6comdatv,"aG",@progbits,_Z6comdatv,comdat
47.Lexception1:
48  .byte 255
49