This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH v2] mips: don't force small data sections to be PROGBITS
- From: James Cowgill <James dot Cowgill at imgtec dot com>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Fri, 7 Nov 2014 12:51:40 +0000
- Subject: [PATCH v2] mips: don't force small data sections to be PROGBITS
- Authentication-results: sourceware.org; auth=none
- References: <104ADEDC18AE5E45870C06CF0304E344A4F683 at LEMAIL01 dot le dot imgtec dot org> <87fvdwjby9 dot fsf at googlemail dot com>
Here's the updated patch:
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. This
is already set elsewhere so removing the assignment in
bfd_mips_elf_section_processing should 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 small data
sections to be PROGBITS
---
bfd/elfxx-mips.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index a88d173..8664c18 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -6986,20 +6986,11 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
if (strcmp (name, ".sdata") == 0
|| strcmp (name, ".lit8") == 0
|| strcmp (name, ".lit4") == 0)
- {
- hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
- hdr->sh_type = SHT_PROGBITS;
- }
+ hdr->sh_flags |= SHF_ALLOC | SHF_WRITE | SHF_MIPS_GPREL;
else if (strcmp (name, ".srdata") == 0)
- {
- hdr->sh_flags |= SHF_ALLOC | SHF_MIPS_GPREL;
- hdr->sh_type = SHT_PROGBITS;
- }
+ hdr->sh_flags |= SHF_ALLOC | SHF_MIPS_GPREL;
else if (strcmp (name, ".compact_rel") == 0)
- {
- hdr->sh_flags = 0;
- hdr->sh_type = SHT_PROGBITS;
- }
+ hdr->sh_flags = 0;
else if (strcmp (name, ".rtproc") == 0)
{
if (hdr->sh_addralign != 0 && hdr->sh_entsize == 0)
--
2.1.3