https://sourceware.org/bugzilla/show_bug.cgi?id=21066
--- Comment #4 from Joshua Oreman <oremanj at gmail dot com> --- As I pointed out in PR 23482, hot/cold function splitting (the new gcc -freorder-blocks-and-partition optimization) can make this an issue even without any LSDA at all. Seems a full fix will need to consider the CIE/FDE contents that are relevant to the function as well. Example uses asm for clarity, but I can obtain analogous issues using gcc-produced code, as demonstrated on the above PR. $ g++ -o t.nofold t.cc -fuse-ld=gold $ g++ -o t.fold t.cc -fuse-ld=gold -Wl,--icf=safe $ ./t.nofold caught 1: 42 caught 2: 42 $ ./t.fold caught 1: 42 terminate called after throwing an instance of 'int' Aborted (core dumped) $ cat t.cc extern "C" int printf(const char *fmt, ...); void throw_it() { throw 42; } extern void call_1(void(*)()); extern void call_2(void(*)()); asm(R"( .section .text._Z6call_1PFvvE,"ax",@progbits .globl _Z6call_1PFvvE .type _Z6call_1PFvvE, @function _Z6call_1PFvvE: .cfi_startproc pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 jmp _Z6call_1PFvvE.cold .cfi_endproc .section .text.unlikely._Z6call_1PFvvE,"ax",@progbits .type _Z6call_1PFvvE.cold, @function _Z6call_1PFvvE.cold: .cfi_startproc .cfi_def_cfa_offset 16 .cfi_offset 3, -16 call *%rdi .cfi_endproc .section .text._Z6call_2PFvvE,"ax",@progbits .globl _Z6call_2PFvvE .type _Z6call_2PFvvE, @function _Z6call_2PFvvE: .cfi_startproc subq $24, %rsp .cfi_def_cfa_offset 32 jmp _Z6call_2PFvvE.cold .cfi_endproc .section .text.unlikely._Z6call_2PFvvE,"ax",@progbits .type _Z6call_2PFvvE.cold, @function _Z6call_2PFvvE.cold: .cfi_startproc .cfi_def_cfa_offset 32 call *%rdi .cfi_endproc )"); int main() { try { call_1(throw_it); } catch (int val) { printf("caught 1: %d\n", val); } try { call_2(throw_it); } catch (int val) { printf("caught 2: %d\n", val); } } -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils