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/elf64-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/elf64-ppc.c')
-rw-r--r-- | bfd/elf64-ppc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 56b94f9..4d90e0a 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -15603,7 +15603,8 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, } } - if (htab->elf.sgot != NULL && htab->elf.sgot->size != 0) + if (htab->elf.sgot != NULL && htab->elf.sgot->size != 0 + && htab->elf.sgot->output_section != bfd_abs_section_ptr) { /* Fill in the first entry in the global offset table. We use it to hold the link-time TOCbase. */ @@ -15615,7 +15616,8 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd, elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 8; } - if (htab->elf.splt != NULL && htab->elf.splt->size != 0) + if (htab->elf.splt != NULL && htab->elf.splt->size != 0 + && htab->elf.splt->output_section != bfd_abs_section_ptr) { /* Set .plt entry size. */ elf_section_data (htab->elf.splt->output_section)->this_hdr.sh_entsize |