https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119507
Bug ID: 119507 Summary: The function order affects the names of the gcc_except_table sections in the assembly code. Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chenglulu at loongson dot cn Target Milestone: --- The function order affects the names of the gcc_except_table sections in the assembly code. test.cc ``` int another_func_with_exception() { try { throw 1; } catch (int) { return 1; } return 0; } inline int comdat() { try { throw 1; } catch (int) { return 1; } return 0; } int foo() { return comdat(); } ``` $ g++ test.cc -o test.s -S This will generate two gcc_except_table sections. ``` .globl _Z27another_func_with_exceptionv .type _Z27another_func_with_exceptionv, @function _Z27another_func_with_exceptionv: ... .LFE0: .globl __gxx_personality_v0 .section .gcc_except_table,"a",@progbits .align 4 ``` and ``` .weak _Z6comdatv .type _Z6comdatv, @function _Z6comdatv: ... .LFE1: .section .gcc_except_table .align 4 ``` However, when I swap the writing order of another_func_with_exception and comdat, the following is generated: ``` .type _Z6comdatv, @function _Z6comdatv: .LFB0: ... .LFE0: .globl __gxx_personality_v0 .section .gcc_except_table._Z6comdatv,"aG",@progbits,_Z6comdatv,comdat .align 4 ``` and ``` .type _Z27another_func_with_exceptionv, @function _Z27another_func_with_exceptionv: ... .LFE1: .section .gcc_except_table,"a",@progbits .align 4 ``` The name of the gcc_except_table generated by the function comdat has changed.