Mercurial > hg > CbC > CbC_llvm
diff lld/test/ELF/gc-sections-lsda.s @ 207:2e18cbf3894f
LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Jun 2021 06:07:14 +0900 |
parents | 1d019706d866 |
children |
line wrap: on
line diff
--- a/lld/test/ELF/gc-sections-lsda.s Mon May 25 11:55:54 2020 +0900 +++ b/lld/test/ELF/gc-sections-lsda.s Tue Jun 08 06:07:14 2021 +0900 @@ -1,21 +1,62 @@ -// REQUIRES: x86 +# REQUIRES: x86 +# RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux + +## Discard an unused .gcc_except_table in a COMDAT group or having SHF_LINK_ORDER +## if the associated text section is discarded. + +# RUN: ld.lld --gc-sections --print-gc-sections -u _Z3foov %t.o -o /dev/null | \ +# RUN: FileCheck %s --implicit-check-not=.gcc_except_table -// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux -// RUN: ld.lld -shared --gc-sections %t.o -o %t +# CHECK: removing unused section {{.*}}.o:(.text._Z6comdatv) +# CHECK-NEXT: removing unused section {{.*}}.o:(.text._Z9linkorderv) +# CHECK-NEXT: removing unused section {{.*}}.o:(.gcc_except_table._Z6comdatv) +# CHECK-NEXT: removing unused section {{.*}}.o:(.gcc_except_table._Z9linkorderv) + +## An unused non-group non-SHF_LINK_ORDER .gcc_except_table is not discarded. -// Test that we handle .eh_frame keeping sections alive. We could be more -// precise and gc the entire contents of this file, but test that at least -// we are consistent: if we keep .abc, we have to keep .foo +# RUN: ld.lld --gc-sections --print-gc-sections -u _Z6comdatv -u _Z9linkorderv %t.o -o /dev/null | \ +# RUN: FileCheck /dev/null --implicit-check-not=.gcc_except_table + +## If the text sections are live, the .gcc_except_table sections are retained as +## well because they are referenced by .eh_frame pieces. + +# RUN: ld.lld --gc-sections --print-gc-sections -u _Z3foov -u _Z6comdatv -u _Z9linkorderv %t.o -o /dev/null | \ +# RUN: FileCheck %s --check-prefix=KEEP + +# KEEP-NOT: .gcc_except_table -// RUN: llvm-readobj -S %t | FileCheck %s -// CHECK: Name: .abc -// CHECK: Name: .foo +.section .text._Z3foov,"ax",@progbits +.globl _Z3foov +_Z3foov: + .cfi_startproc + ret + .cfi_lsda 0x1b,.Lexception0 + .cfi_endproc + +.section .text._Z6comdatv,"axG",@progbits,_Z6comdatv,comdat +.globl _Z6comdatv +_Z6comdatv: + .cfi_startproc + ret + .cfi_lsda 0x1b,.Lexception1 + .cfi_endproc - .cfi_startproc - .cfi_lsda 0x1b,zed - .cfi_endproc - .section .abc,"a" -zed: - .long bar-. - .section .foo,"ax" -bar: +.section .text._Z9linkorderv,"ax",@progbits +.globl _Z9linkorderv +_Z9linkorderv: + .cfi_startproc + ret + .cfi_lsda 0x1b,.Lexception2 + .cfi_endproc + +.section .gcc_except_table._Z3foov,"a",@progbits +.Lexception0: + .byte 255 + +.section .gcc_except_table._Z6comdatv,"aG",@progbits,_Z6comdatv,comdat +.Lexception1: + .byte 255 + +.section .gcc_except_table._Z9linkorderv,"ao",@progbits,_Z9linkorderv +.Lexception2: + .byte 255