diff options
author | Alan Modra <amodra@gmail.com> | 2017-02-22 08:10:58 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-02-22 08:44:41 +1030 |
commit | 6528b6eba85f044667876a2ad77d4612a9e5fc65 (patch) | |
tree | 2f8b669ea8177a1d29ba53b18b8ed5c62af5dd61 /bfd/elf32-ppc.c | |
parent | 1b90b1390679473dd84416e462afa1587769ceec (diff) | |
download | gdb-6528b6eba85f044667876a2ad77d4612a9e5fc65.zip gdb-6528b6eba85f044667876a2ad77d4612a9e5fc65.tar.gz gdb-6528b6eba85f044667876a2ad77d4612a9e5fc65.tar.bz2 |
PowerPC ld segfault on script discarding dynamic sections
bfd/
* elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
on .got or .plt output section being discarded by script.
* elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise. Move
vxworks splt temp.
gold/
* powerpc.cc (Target_powerpc::make_iplt_section): Check that
output_section exists before attempting add_output_section_data.
(Target_powerpc::make_brlt_section): Likewise.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r-- | bfd/elf32-ppc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 30998b1..d821935 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -10418,7 +10418,6 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) { asection *sdyn; - asection *splt; struct ppc_elf_link_hash_table *htab; bfd_vma got; bfd *dynobj; @@ -10431,10 +10430,6 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, htab = ppc_elf_hash_table (info); dynobj = htab->elf.dynobj; sdyn = bfd_get_linker_section (dynobj, ".dynamic"); - if (htab->is_vxworks) - splt = htab->elf.splt; - else - splt = NULL; got = 0; if (htab->elf.hgot != NULL) @@ -10489,7 +10484,8 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, } } - if (htab->elf.sgot != NULL) + if (htab->elf.sgot != NULL + && htab->elf.sgot->output_section != bfd_abs_section_ptr) { if (htab->elf.hgot->root.u.def.section == htab->elf.sgot || htab->elf.hgot->root.u.def.section == htab->elf.sgotplt) @@ -10531,8 +10527,12 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, } /* Fill in the first entry in the VxWorks procedure linkage table. */ - if (splt && splt->size > 0) + if (htab->is_vxworks + && htab->elf.splt != NULL + && htab->elf.splt->size != 0 + && htab->elf.splt->output_section != bfd_abs_section_ptr) { + asection *splt = htab->elf.splt; /* Use the right PLT. */ const bfd_vma *plt_entry = (bfd_link_pic (info) ? ppc_elf_vxworks_pic_plt0_entry |