diff options
author | Alan Modra <amodra@gmail.com> | 2008-09-19 09:51:32 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2008-09-19 09:51:32 +0000 |
commit | e79f59555a009cc9b5ef8233debb948c795a9cca (patch) | |
tree | 56c1af2564fe1c5d47ce7ed9f838884a0c635267 /bfd | |
parent | 9a97a5d735f8ccba73271e5098e6194551c877d7 (diff) | |
download | gdb-e79f59555a009cc9b5ef8233debb948c795a9cca.zip gdb-e79f59555a009cc9b5ef8233debb948c795a9cca.tar.gz gdb-e79f59555a009cc9b5ef8233debb948c795a9cca.tar.bz2 |
* elf32-ppc.c (ppc_elf_finish_dynamic_sections): Handle vxworks
_GLOBAL_OFFSET_TABLE_ in .got.plt section. Add BFD_ASSERTs.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elf32-ppc.c | 29 |
2 files changed, 24 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4a1769d..25214d8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2008-09-19 Alan Modra <amodra@bigpond.net.au> + + * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Handle vxworks + _GLOBAL_OFFSET_TABLE_ in .got.plt section. Add BFD_ASSERTs. + 2008-09-17 Bob Wilson <bob.wilson@acm.org> * elf32-xtensa.c (elf_xtensa_check_relocs): Check for negative refcount. diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 1082820..1d9cabd 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -7727,29 +7727,38 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd, } } - /* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 so that a function can - easily find the address of the _GLOBAL_OFFSET_TABLE_. */ if (htab->got != NULL) { - if (htab->elf.hgot->root.u.def.section == htab->got) + if (htab->elf.hgot->root.u.def.section == htab->got + || htab->elf.hgot->root.u.def.section == htab->sgotplt) { - unsigned char *p = htab->got->contents; - bfd_vma val; + unsigned char *p = htab->elf.hgot->root.u.def.section->contents; p += htab->elf.hgot->root.u.def.value; if (htab->plt_type == PLT_OLD) - bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, p - 4); + { + /* Add a blrl instruction at _GLOBAL_OFFSET_TABLE_-4 + so that a function can easily find the address of + _GLOBAL_OFFSET_TABLE_. */ + BFD_ASSERT (htab->elf.hgot->root.u.def.value - 4 + < htab->elf.hgot->root.u.def.section->size); + bfd_put_32 (output_bfd, 0x4e800021, p - 4); + } - val = 0; if (sdyn != NULL) - val = sdyn->output_section->vma + sdyn->output_offset; - bfd_put_32 (output_bfd, val, p); + { + bfd_vma val = sdyn->output_section->vma + sdyn->output_offset; + BFD_ASSERT (htab->elf.hgot->root.u.def.value + < htab->elf.hgot->root.u.def.section->size); + bfd_put_32 (output_bfd, val, p); + } } else { (*_bfd_error_handler) (_("%s not defined in linker created %s"), htab->elf.hgot->root.root.string, - htab->got->name); + (htab->sgotplt != NULL + ? htab->sgotplt->name : htab->got->name)); bfd_set_error (bfd_error_bad_value); ret = FALSE; } |