diff options
author | Alan Modra <amodra@gmail.com> | 2014-06-24 13:23:04 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-06-24 13:39:04 +0930 |
commit | 15bfcc77681f423fd872815eb140c450d69b8a60 (patch) | |
tree | ca0001f421df891e6589dfb88a34fc10930f3936 /bfd/elf32-ppc.c | |
parent | 3343ef86879b9348bb038bc7adecb665236ca4d8 (diff) | |
download | gdb-15bfcc77681f423fd872815eb140c450d69b8a60.zip gdb-15bfcc77681f423fd872815eb140c450d69b8a60.tar.gz gdb-15bfcc77681f423fd872815eb140c450d69b8a60.tar.bz2 |
Don't strip section defining _SDA_BASE_
Prior to 93d1b056 _SDA_BASE_ used to be defined in a linker script
output section. Now _SDA_BASE_ is defined in an input section that is
subject to being stripped. If the section is stripped we don't output
the symbol, which results in --emit-relocs trying to emit relocs with
dangling references to _SDA_BASE_.
* elf32-ppc.c (ppc_elf_size_dynamic_sections): Arrange to keep
.sdata/.sdata2 when _SDA_BASE_/_SDA2_BASE_ should be output
for --emit-relocs.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r-- | bfd/elf32-ppc.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index bc793d7..c4a9543 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -6304,6 +6304,16 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd, sda->root.u.def.section = htab->elf.hgot->root.u.def.section; sda->root.u.def.value = htab->elf.hgot->root.u.def.value; } + if (info->emitrelocations) + { + struct elf_link_hash_entry *sda = htab->sdata[0].sym; + + if (sda != NULL && sda->ref_regular) + sda->root.u.def.section->flags |= SEC_KEEP; + sda = htab->sdata[1].sym; + if (sda != NULL && sda->ref_regular) + sda->root.u.def.section->flags |= SEC_KEEP; + } if (htab->glink != NULL && htab->glink->size != 0 @@ -6396,12 +6406,15 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd, || s == htab->sgotplt || s == htab->sbss || s == htab->dynbss - || s == htab->dynsbss - || s == htab->sdata[0].section - || s == htab->sdata[1].section) + || s == htab->dynsbss) { /* Strip these too. */ } + else if (s == htab->sdata[0].section + || s == htab->sdata[1].section) + { + strip_section = (s->flags & SEC_KEEP) == 0; + } else if (CONST_STRNEQ (bfd_get_section_name (htab->elf.dynobj, s), ".rela")) { |