------- Comment #13 from ebotcazou at gcc dot gnu dot org 2008-11-19 18:51 ------- > I'm a bit unsure how to test this right now: what I find is that C objects > have read-only .eh_frame sections and use .cfi* directives, while C++, Java > and Ada objects have read-write .eh_frame sections and still use .eh_frame > sections directly emitted by the compiler.
The decision is made in dwarf2out_do_cfi_asm: /* Decide whether to emit frame unwind via assembler directives. */ int dwarf2out_do_cfi_asm (void) { int enc; #ifdef MIPS_DEBUGGING_INFO return false; #endif if (!flag_dwarf2_cfi_asm || !dwarf2out_do_frame ()) return false; if (!eh_personality_libfunc) return true; if (!HAVE_GAS_CFI_PERSONALITY_DIRECTIVE) return false; /* Make sure the personality encoding is one the assembler can support. In particular, aligned addresses can't be handled. */ enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2,/*global=*/1); if ((enc & 0x70) != 0 && (enc & 0x70) != DW_EH_PE_pcrel) return false; enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0,/*global=*/0); if ((enc & 0x70) != 0 && (enc & 0x70) != DW_EH_PE_pcrel) return false; return true; } On Solaris with Sun ld, ASM_PREFERRED_EH_DATA_FORMAT is defined so that at least one of the 2 tests will always return false. Therefore the only way to have dwarf2out_do_cfi_asm return true is if (!eh_personality_libfunc) return true; The C++, Java and Ada compilers unconditionally register their personality routine, whereas the C compiler doesn't, even with -fexceptions: if there is no EH action in the code, it doesn't register it. Hence the discrepancy. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37463