Patch below makes gcc emit the resuired assembly directives for c6x unwinding tables, same as ARM and IA64. This fixes most of the unwinding related failures.
Tested on c6x-elf Ok? Paul 2011-10-03 Paul Brook <p...@codesourcery.com> * config/c6x/c6x.c (c6x_asm_emit_except_personality, c6x_asm_init_sections): New functions. (TARGET_ASM_EMIT_EXCEPT_PERSONALITY, TARGET_ASM_INIT_SECTIONS): Define. Index: gcc/config/c6x/c6x.c =================================================================== --- gcc/config/c6x/c6x.c (revision 179178) +++ gcc/config/c6x/c6x.c (working copy) @@ -5625,6 +5625,26 @@ c6x_debug_unwind_info (void) return default_debug_unwind_info (); } + +/* Implement TARGET_ASM_EMIT_EXCEPT_PERSONALITY. */ + +static void +c6x_asm_emit_except_personality (rtx personality) +{ + fputs ("\t.personality\t", asm_out_file); + output_addr_const (asm_out_file, personality); + fputc ('\n', asm_out_file); +} + +/* Use a special assembly directive rather than a regular setion for + unwind table data. */ + +static void +c6x_asm_init_sections (void) +{ + exception_section = get_unnamed_section (0, output_section_asm_op, + "\t.handlerdata"); +} /* Target Structure. */ @@ -5769,6 +5789,12 @@ c6x_debug_unwind_info (void) #undef TARGET_ARM_EABI_UNWINDER #define TARGET_ARM_EABI_UNWINDER true +#undef TARGET_ASM_EMIT_EXCEPT_PERSONALITY +#define TARGET_ASM_EMIT_EXCEPT_PERSONALITY c6x_asm_emit_except_personality + +#undef TARGET_ASM_INIT_SECTIONS +#define TARGET_ASM_INIT_SECTIONS c6x_asm_init_sections + #undef TARGET_DEBUG_UNWIND_INFO #define TARGET_DEBUG_UNWIND_INFO c6x_debug_unwind_info