summaryrefslogtreecommitdiff
path: root/bfd/elfnn-aarch64.c
diff options
context:
space:
mode:
authormshawcroft <mshawcroft>2013-06-27 15:47:55 +0000
committermshawcroft <mshawcroft>2013-06-27 15:47:55 +0000
commit9f662589c756585e93c14e332c2702b739bafdaf (patch)
tree0bb7f5bdfd5fcdcc5d9436d859e9151938a613d8 /bfd/elfnn-aarch64.c
parentf4bbdca046b8b1fb24b900858fa146dabae85dcb (diff)
downloadbinutils-redhat-9f662589c756585e93c14e332c2702b739bafdaf.tar.gz
[AArch64] Fix the placement of &_DYNAMIC in the GOT.
Diffstat (limited to 'bfd/elfnn-aarch64.c')
-rw-r--r--bfd/elfnn-aarch64.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 3e96c1cfed..1eda859e07 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;
}