diff options
author | Marcus Shawcroft <mshawcroft@sourceware.org> | 2013-06-27 15:47:55 +0000 |
---|---|---|
committer | Marcus Shawcroft <mshawcroft@sourceware.org> | 2013-06-27 15:47:55 +0000 |
commit | 8db339a6674ad8e8446bac821cb2dea396e43d6e (patch) | |
tree | d84ad473a9fb1bf6403e079e85c46e4bea647f67 /bfd | |
parent | a2d7bf59d6e7b42aa05c73d40fa7b6ebb12df4f7 (diff) | |
download | gdb-8db339a6674ad8e8446bac821cb2dea396e43d6e.zip gdb-8db339a6674ad8e8446bac821cb2dea396e43d6e.tar.gz gdb-8db339a6674ad8e8446bac821cb2dea396e43d6e.tar.bz2 |
[AArch64] Fix the placement of &_DYNAMIC in the GOT.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elfnn-aarch64.c | 22 |
2 files changed, 20 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 33e03fc..786d398 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2013-06-27 Marcus Shawcroft <marcus.shawcroft@arm.com> + + * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Reserve one slot + in sgot. + (elfNN_aarch64_finish_dynamic_sections): Place the &_DYNAMIC reference + in sgot[0] rather than sgotplt[0]. + 2013-06-26 Yufeng Zhang <yufeng.zhang@arm.com> * Makefile.am (elf32-aarch64.c): Add a #line cpp directive at the diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 3e96c1c..1eda859 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -4886,6 +4886,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, htab->root.dynobj = abfd; if (!_bfd_elf_create_got_section (htab->root.dynobj, info)) return FALSE; + htab->root.sgot->size += GOT_ENTRY_SIZE; } break; } @@ -6501,15 +6502,8 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd, /* Fill in the first three entries in the global offset table. */ if (htab->root.sgotplt->size > 0) { - /* Set the first entry in the global offset table to the address of - the dynamic section. */ - if (sdyn == NULL) - bfd_put_NN (output_bfd, (bfd_vma) 0, - htab->root.sgotplt->contents); - else - bfd_put_NN (output_bfd, - sdyn->output_section->vma + sdyn->output_offset, - htab->root.sgotplt->contents); + bfd_put_NN (output_bfd, (bfd_vma) 0, htab->root.sgotplt->contents); + /* Write GOT[1] and GOT[2], needed for the dynamic linker. */ bfd_put_NN (output_bfd, (bfd_vma) 0, @@ -6519,6 +6513,16 @@ elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd, htab->root.sgotplt->contents + GOT_ENTRY_SIZE * 2); } + if (htab->root.sgot) + { + if (htab->root.sgot->size > 0) + { + bfd_vma addr = + sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0; + bfd_put_NN (output_bfd, addr, htab->root.sgot->contents); + } + } + elf_section_data (htab->root.sgotplt->output_section)-> this_hdr.sh_entsize = GOT_ENTRY_SIZE; } |