This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] mips: don't force the .sdata, .srdata and .lit* sections to be PROGBITS


Here's a patch for the first testsuite failure.

Previously when writing elf files, the .sdata section was forced to be
PROGBITS. However in some cases (eg objcopy --only-keep-debug) the
section will have no data stored in the final file and should be set to
NOBITS. The default section type is already setup in
_bfd_mips_elf_special_sections so removing the assignment in
bfd_mips_elf_section_processing should still keep the section as the
right type.

The change fixes testsuite failure:
 FAIL: simple objcopy of debug data
and fixes this warning when running objcopy on a file generated with
objcopy --only-keep-debug:
 BFD: st8WcWpJ: warning: allocated section `.sdata' not in segment

bfd/
* elfxx-mips.c (_bfd_mips_elf_section_processing): don't force the .sdata,
  .srdata and .lit* sections to be PROGBITS
* elfxx-mips.c (_bfd_mips_elf_special_sections): add .srdata section
---
 bfd/elfxx-mips.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index a88d173..4099e8d 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -6988,12 +6988,10 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
 	  || strcmp (name, ".lit4") == 0)
 	{
 	  hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
-	  hdr->sh_type = SHT_PROGBITS;
 	}
       else if (strcmp (name, ".srdata") == 0)
 	{
 	  hdr->sh_flags |= SHF_ALLOC | SHF_MIPS_GPREL;
-	  hdr->sh_type = SHT_PROGBITS;
 	}
       else if (strcmp (name, ".compact_rel") == 0)
 	{
@@ -15773,6 +15771,7 @@ const struct bfd_elf_special_section _bfd_mips_elf_special_sections[] =
   { STRING_COMMA_LEN (".mdebug"), 0, SHT_MIPS_DEBUG, 0 },
   { STRING_COMMA_LEN (".sbss"),  -2, SHT_NOBITS,     SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
   { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS,   SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+  { STRING_COMMA_LEN (".srdata"),-2, SHT_PROGBITS,   SHF_ALLOC + SHF_MIPS_GPREL },
   { STRING_COMMA_LEN (".ucode"),  0, SHT_MIPS_UCODE, 0 },
   { NULL,                     0,  0, 0,              0 }
 };
-- 
2.1.3

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]