diff options
author | Alan Modra <amodra@gmail.com> | 2007-05-15 08:39:58 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2007-05-15 08:39:58 +0000 |
commit | 0414f35b827c242a1541214a9f59ddb41ecd59f8 (patch) | |
tree | 6c46d9125bd55e1a342b67113bf7f8c05b890a86 /bfd/elf.c | |
parent | b8b6abe0f8baa8504e3a401bef70bbf2676ca696 (diff) | |
download | gdb-0414f35b827c242a1541214a9f59ddb41ecd59f8.zip gdb-0414f35b827c242a1541214a9f59ddb41ecd59f8.tar.gz gdb-0414f35b827c242a1541214a9f59ddb41ecd59f8.tar.bz2 |
PR 4479
* elf.c (elf_fake_sections): Don't allow backend to change
SHT_NOBITS if called for strip/objcopy --only-keep-debug.
* elfxx-mips.c (_bfd_mips_elf_fake_sections): Remove similar
fix from here.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -2744,6 +2744,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) const struct elf_backend_data *bed = get_elf_backend_data (abfd); bfd_boolean *failedptr = failedptrarg; Elf_Internal_Shdr *this_hdr; + unsigned int sh_type; if (*failedptr) { @@ -2901,10 +2902,19 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) } /* Check for processor-specific section types. */ + sh_type = this_hdr->sh_type; if (bed->elf_backend_fake_sections && !(*bed->elf_backend_fake_sections) (abfd, this_hdr, asect)) *failedptr = TRUE; + if (sh_type == SHT_NOBITS + && elf_elfheader (abfd)->e_phnum == 0) + { + /* Don't change the header type from NOBITS if we are being + called for strip/objcopy --only-keep-debug. */ + this_hdr->sh_type = sh_type; + } + /* If the section has relocs, set up a section header for the SHT_REL[A] section. If two relocation sections are required for this section, it is up to the processor-specific back-end to |