Index: config/mips/iris.h =================================================================== *** config/mips/iris.h (revision 128810) --- config/mips/iris.h (working copy) *************** along with GCC; see the file COPYING3. *** 60,65 **** --- 60,71 ---- #undef ASM_FINISH_DECLARE_OBJECT #define ASM_FINISH_DECLARE_OBJECT mips_finish_declare_object + /* System libraries like libexc expect mips specific flags to be set + on specific sections, such as NOSTRIP on .debug_frame. The generic + elf circuitry doesn't know about them, so ... */ + #undef TARGET_ASM_NAMED_SECTION + #define TARGET_ASM_NAMED_SECTION irix_asm_named_section + /* The linker needs a space after "-o". */ #define SWITCHES_NEED_SPACES "o" Index: config/mips/mips.c =================================================================== *** config/mips/mips.c (revision 128810) --- config/mips/mips.c (working copy) *************** static void mips_output_mi_thunk (FILE * *** 344,349 **** --- 344,350 ---- static section *mips_select_rtx_section (enum machine_mode, rtx, unsigned HOST_WIDE_INT); static section *mips_function_rodata_section (tree); + static void irix_asm_named_section (const char *, unsigned int, tree); static bool mips_in_small_data_p (const_tree); static bool mips_use_anchors_for_symbol_p (const_rtx); static int mips_fpr_return_fields (const_tree, tree *); *************** mips_function_rodata_section (tree decl) *** 9035,9040 **** --- 9036,9074 ---- return data_section; } + /* Implement TARGET_ASM_NAMED_SECTION. Some sections need special bits + that the generic elf circuitry doesn't know about. Handle them specially + here and fallback on the default code for the others. */ + + #define SHF_MIPS_NOSTRIP 0x08000000 + #define SHT_MIPS_DWARF 0x7000001e + + static void + irix_asm_named_section (const char *name, unsigned int flags, tree decl) + { + unsigned int sh_type = 0, sh_flags = 0, sh_entsize = 0, sh_align = 0; + bool need_special_flags = false; + + /* System libraries like libexc expect a single .debug_frame per + executable. The section has NOSTRIP set in system objects and + the linker doesn't merge those having the bit set together with + those not having it, so make sure we set it as well. */ + + if (strcmp (name, ".debug_frame") == 0) + { + need_special_flags = true; + sh_type = SHT_MIPS_DWARF; + sh_flags = SHF_MIPS_NOSTRIP; + sh_align = 4; + } + + if (need_special_flags) + fprintf (asm_out_file, "\t.section %s,%#x,%#x,%u,%u\n", + name, sh_type, sh_flags, sh_entsize, sh_align); + else + default_elf_asm_named_section (name, flags, decl); + } +