[PATCH] restore NOSTRIP for .debug_frame on mips-irix

Olivier Hainque hainque@adacore.com
Wed Oct 10 14:25:00 GMT 2007


Hello Richard,

Richard Sandiford wrote:
> 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.

 The patch was simply modeled after what the compiler used to do.
 I agree that dealing with this in GAS looks cleaner.

> GAS already knows that certain sections are special in certain ways,

 Indeed.

> and if proper behaviour requires a GAS change too, I
> suppose users will have to upgrade to newer binutils either way.

 Actually, we had observed the behavior with 2.16, this led to a
 discussion with a patch suggestion at

    http://www.cygwin.com/ml/binutils/2005-02/msg00688.html

 The patch was approved but apparently didn't go in and I was
 assuming it was still needed.

 However, I just tried my patched compiler with untouched 2.17 and
 2.18 assemblers and both seem to propagate the extra NOSTRIP bit, so
 something else happened.

 Anyway, _bfd_mips_elf_fake_sections in bfd/elfxx-mips.c still really
 looks like the proper place to have this change as there is a lot of
 similar processing there already.

 The attached patch fixes the tiny case I posted, and I'd be happy to
 submit it to the binutils list after the required testing if you think
 is appropriate.

 Thanks for your feedback,

 Olivier


 
-------------- next part --------------
*** bfd/elfxx-mips.c.ori	2007-10-10 09:28:42.715483416 -0400
--- bfd/elfxx-mips.c	2007-10-10 09:56:46.514369373 -0400
*************** _bfd_mips_elf_fake_sections (bfd *abfd, 
*** 5670,5676 ****
        hdr->sh_flags |= SHF_MIPS_NOSTRIP;
      }
    else if (CONST_STRNEQ (name, ".debug_"))
!     hdr->sh_type = SHT_MIPS_DWARF;
    else if (strcmp (name, ".MIPS.symlib") == 0)
      {
        hdr->sh_type = SHT_MIPS_SYMBOL_LIB;
--- 5670,5684 ----
        hdr->sh_flags |= SHF_MIPS_NOSTRIP;
      }
    else if (CONST_STRNEQ (name, ".debug_"))
!     {
!       hdr->sh_type = SHT_MIPS_DWARF;
! 
!       /* Irix facilities such as libexc expect a single .debug_frame
! 	 per executable, the system ones have NOSTRIP set and the linker
! 	 doesn't merge sections with different flags so ...  */
!       if (SGI_COMPAT (abfd) && CONST_STRNEQ (name, ".debug_frame"))
! 	hdr->sh_flags |= SHF_MIPS_NOSTRIP;
!     }
    else if (strcmp (name, ".MIPS.symlib") == 0)
      {
        hdr->sh_type = SHT_MIPS_SYMBOL_LIB;


More information about the Gcc-patches mailing list