1; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -binutils-version=2.35 | FileCheck %s --check-prefixes=CHECK,NORMAL 2; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -binutils-version=2.36 | FileCheck %s --check-prefixes=CHECK,NORMAL 3; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -function-sections -binutils-version=2.35 | FileCheck %s --check-prefixes=CHECK,SEP_BFD 4; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -function-sections -binutils-version=2.36 | FileCheck %s --check-prefixes=CHECK,SEP 5 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_NOUNIQUE 7; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -mtriple=x86_64 -unique-section-names=false | FileCheck %s --check-prefixes=CHECK,NOUNIQUE 8 9@_ZTIi = external constant ptr 10 11;; If the function is in a comdat group, the generated .gcc_except_table should 12;; be placed in the same group, so that .gcc_except_table can be discarded if 13;; the comdat is not prevailing. If -funique-section-names, append the function name. 14$group = comdat any 15define i32 @group() uwtable comdat personality ptr @__gxx_personality_v0 { 16; CHECK-LABEL: group: 17; CHECK: .cfi_endproc 18; 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 %lpad 25lpad: 26 %0 = landingpad { ptr, i32 } catch ptr @_ZTIi 27 br label %eh.resume 28try.cont: 29 ret i32 0 30eh.resume: 31 resume { ptr, i32 } %0 32} 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) or 36;; a suffix (GNU as<2.35). 37define i32 @foo() uwtable personality ptr @__gxx_personality_v0 { 38; CHECK-LABEL: foo: 39; CHECK: .cfi_endproc 40; 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 %lpad 47lpad: 48 %0 = landingpad { ptr, i32 } catch ptr @_ZTIi 49 br label %eh.resume 50try.cont: 51 ret i32 0 52eh.resume: 53 resume { ptr, i32 } %0 54} 55 56;; If the function is in a comdat group with nodeduplicate kind, the generated 57;; .gcc_except_table should is lowered to a zero-flag ELF section group. 58$zero = comdat nodeduplicate 59define i32 @zero() uwtable comdat personality ptr @__gxx_personality_v0 { 60; CHECK-LABEL: zero: 61; CHECK: .cfi_endproc 62; 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 %lpad 69lpad: 70 %0 = landingpad { ptr, i32 } catch ptr @_ZTIi 71 br label %eh.resume 72try.cont: 73 ret i32 0 74eh.resume: 75 resume { ptr, i32 } %0 76} 77 78declare void @ext() 79 80declare i32 @__gxx_personality_v0(...) 81