81 lines · plain
1; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -binutils-version=2.35 | FileCheck %s --check-prefixes=CHECK,NORMAL2; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -binutils-version=2.36 | FileCheck %s --check-prefixes=CHECK,NORMAL3; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -function-sections -binutils-version=2.35 | FileCheck %s --check-prefixes=CHECK,SEP_BFD4; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -function-sections -binutils-version=2.36 | FileCheck %s --check-prefixes=CHECK,SEP5 6; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -function-sections -unique-section-names=false | FileCheck %s --check-prefixes=CHECK,SEP_NOUNIQUE7; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -unique-section-names=false | FileCheck %s --check-prefixes=CHECK,NOUNIQUE8 9@_ZTIi = external constant ptr10 11;; If the function is in a comdat group, the generated .gcc_except_table should12;; be placed in the same group, so that .gcc_except_table can be discarded if13;; the comdat is not prevailing. If -funique-section-names, append the function name.14$group = comdat any15define i32 @group() uwtable comdat personality ptr @__gxx_personality_v0 {16; CHECK-LABEL: group:17; CHECK: .cfi_endproc18; NORMAL-NEXT: .section .gcc_except_table.group,"aG",@progbits,group,comdat{{$}}19; SEP_BFD-NEXT: .section .gcc_except_table.group,"aG",@progbits,group,comdat{{$}}20; SEP-NEXT: .section .gcc_except_table.group,"aoG",@progbits,group,group,comdat{{$}}21; SEP_NOUNIQUE-NEXT: .section .gcc_except_table,"aG",@progbits,group,comdat{{$}}22; NOUNIQUE-NEXT: .section .gcc_except_table,"aG",@progbits,group,comdat{{$}}23entry:24 invoke void @ext() to label %try.cont unwind label %lpad25lpad:26 %0 = landingpad { ptr, i32 } catch ptr @_ZTIi27 br label %eh.resume28try.cont:29 ret i32 030eh.resume:31 resume { ptr, i32 } %032}33 34;; If the function is not in a comdat group, but function sections is enabled,35;; use a separate section by either using a unique ID (integrated assembler) or36;; a suffix (GNU as<2.35).37define i32 @foo() uwtable personality ptr @__gxx_personality_v0 {38; CHECK-LABEL: foo:39; CHECK: .cfi_endproc40; NORMAL-NEXT: .section .gcc_except_table,"a",@progbits{{$}}41; SEP_BFD-NEXT: .section .gcc_except_table.foo,"a",@progbits{{$}}42; SEP-NEXT: .section .gcc_except_table.foo,"ao",@progbits,foo{{$}}43; SEP_NOUNIQUE-NEXT: .section .gcc_except_table,"a",@progbits{{$}}44; NOUNIQUE-NEXT: .section .gcc_except_table,"a",@progbits{{$}}45entry:46 invoke void @ext() to label %try.cont unwind label %lpad47lpad:48 %0 = landingpad { ptr, i32 } catch ptr @_ZTIi49 br label %eh.resume50try.cont:51 ret i32 052eh.resume:53 resume { ptr, i32 } %054}55 56;; If the function is in a comdat group with nodeduplicate kind, the generated57;; .gcc_except_table should is lowered to a zero-flag ELF section group.58$zero = comdat nodeduplicate59define i32 @zero() uwtable comdat personality ptr @__gxx_personality_v0 {60; CHECK-LABEL: zero:61; CHECK: .cfi_endproc62; NORMAL-NEXT: .section .gcc_except_table.zero,"aG",@progbits,zero{{$}}63; SEP_BFD-NEXT: .section .gcc_except_table.zero,"aG",@progbits,zero{{$}}64; SEP-NEXT: .section .gcc_except_table.zero,"aoG",@progbits,zero,zero{{$}}65; SEP_NOUNIQUE-NEXT: .section .gcc_except_table,"aG",@progbits,zero{{$}}66; NOUNIQUE-NEXT: .section .gcc_except_table,"aG",@progbits,zero{{$}}67entry:68 invoke void @ext() to label %try.cont unwind label %lpad69lpad:70 %0 = landingpad { ptr, i32 } catch ptr @_ZTIi71 br label %eh.resume72try.cont:73 ret i32 074eh.resume:75 resume { ptr, i32 } %076}77 78declare void @ext()79 80declare i32 @__gxx_personality_v0(...)81