This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] restore NOSTRIP for .debug_frame on mips-irix
- From: Richard Sandiford <rsandifo at nildram dot co dot uk>
- To: Olivier Hainque <hainque at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 09 Oct 2007 21:15:48 +0100
- Subject: Re: [PATCH] restore NOSTRIP for .debug_frame on mips-irix
- References: <20071008093304.GA7624@cardhu.act-europe.fr>
Olivier Hainque <hainque@adacore.com> writes:
> Hello,
>
> GCC used to set NOSTRIP bit on .debug_frame and doesn't any more.
>
> This is causing troubles when using the libexc system library e.g.
> for frame unwinding purposes, because it expects a single .debug_frame
> per executable, the section has NOSTRIP set in system objects and the
> native linker doesn't merge those having the bit set together with
> those not having it.
>
> Typically, for
>
> << /* t.c */
> #include <libexc.h>
>
> int main (void)
> {
> trace_back_stack_and_print ();
> return 0;
> }
> >>
>
> We see
>
> $ gcc -o t t.c -lexc
>
> $ elfdump -hv t | grep -A 1 debug_frame
> [37] SHT_MIPS_DWARF 0 0x9bc0 0x4b0 .debug_frame
> 0 0 0x4 0 0x00000000
> --
> [39] SHT_MIPS_DWARF 0 0xa5a6 0xa4 .debug_frame
> 0 0 0x1 0 0x08000000 NOSTRIP
>
> $ ./t
> libexc(158601884): FATAL ERROR update_obj_info: dwarf_elf_init failed
> for ./t -- (107) DW_DLE_DEBUG_FRAME_DUPLICATE Only one .debug_frame
> section is allowed
>
> The attached patch addresses this by overriding the default elf
> asm_named_section implementation on irix for ".debug_frame" only, to
> special case it in a similar fashion as before.
>
> Proper behavior with GNU as requires a change there as well to
> propagate the flags down into the object, but this is a separate
> issue.
I'm not sure I agree. If we need this bit set for correctness, I think
GAS should add it automatically when the GAS (rather than IRIX) .section
syntax is used. GAS already knows that certain sections are special
in certain ways, and if proper behaviour requires a GAS change too,
I suppose users will have to upgrade to newer binutils either way.
Richard