diff options
author | Mark Wielaard <mjw@redhat.com> | 2015-03-23 15:08:27 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2015-03-27 22:52:37 +0100 |
commit | d4852fab1c8ed9ce1780815616abc596b19ac7d8 (patch) | |
tree | 5727eefcd06b4d235d0036343d5b697bdfc9f218 /backends | |
parent | 06457daeff7972d08c6b296be92007f0eabb32e4 (diff) |
backends: aarch64 can have _GLOBAL_OFFSET_TABLE_ point anywhere in .got.
When building with relro aarch64 splits .got in a writable and read-only
part. _GLOBAL_OFFSET_TABLE_ points to the first writable symbol, not the
start of .got.
https://bugzilla.redhat.com/show_bug.cgi?id=1201778
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'backends')
-rw-r--r-- | backends/ChangeLog | 5 | ||||
-rw-r--r-- | backends/aarch64_symbol.c | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog index 818e8d5d..0a47b75e 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,8 @@ +2015-03-23 Mark Wielaard <mjw@redhat.com> + + * aarch64_symbol.c (aarch64_check_special_symbol): Accept + _GLOBAL_OFFSET_TABLE_ pointing anywhere in .got. + 2015-03-09 Mark Wielaard <mjw@redhat.com> * aarch64_reloc.def (COPY): Add DYN. diff --git a/backends/aarch64_symbol.c b/backends/aarch64_symbol.c index 3fdc9cf8..76999e4b 100644 --- a/backends/aarch64_symbol.c +++ b/backends/aarch64_symbol.c @@ -1,5 +1,5 @@ /* AArch64 specific symbolic name handling. - Copyright (C) 2013 Red Hat, Inc. + Copyright (C) 2013, 2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -56,8 +56,11 @@ aarch64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) } } -/* If this is the _GLOBAL_OFFSET_TABLE_ symbol, then it should point to - .got[0] even if there is a .got.plt section. */ +/* If this is the _GLOBAL_OFFSET_TABLE_ symbol, then it should point in + the .got even if there is a .got.plt section. + https://sourceware.org/ml/libc-ports/2013-06/msg00057.html + https://bugzilla.redhat.com/show_bug.cgi?id=1201778 + */ bool aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, const char *name, const GElf_Shdr *destshdr) @@ -66,7 +69,8 @@ aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, && strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0) { const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name); - if (sname != NULL && strcmp (sname, ".got.plt") == 0) + if (sname != NULL + && (strcmp (sname, ".got") == 0 || strcmp (sname, ".got.plt") == 0)) { Elf_Scn *scn = NULL; while ((scn = elf_nextscn (elf, scn)) != NULL) @@ -77,7 +81,8 @@ aarch64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr, const GElf_Sym *sym, { sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name); if (sname != NULL && strcmp (sname, ".got") == 0) - return sym->st_value == shdr->sh_addr; + return (sym->st_value >= shdr->sh_addr + && sym->st_value < shdr->sh_addr + shdr->sh_size); } } } |