summaryrefslogtreecommitdiff
path: root/backends/ppc64_symbol.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2018-08-04 20:36:09 +0200
committerMark Wielaard <mark@klomp.org>2018-09-13 14:30:30 +0200
commitba2a7f4fa5f453c2b0a729bf519240a8f66a1867 (patch)
tree6fd2f8cd25f5750e815d7cab22adbd4f5d345e68 /backends/ppc64_symbol.c
parentfb0457f4671e7e0f8331453348005ed6beab275e (diff)
downloadelfutils-ba2a7f4fa5f453c2b0a729bf519240a8f66a1867.tar.gz
backends: Always use elf_getshdrstrndx in check_special_symbol.
The check_special_symbol backend functions used the Ehdr e_shstrndx field to get at the name of sections. This is not correct if there are more than SHN_LORESERVE sections. Always use elf_getshdrstrndx to get the shstrtab section. And drop the Ehdr argument that isn't necessary anymore. Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'backends/ppc64_symbol.c')
-rw-r--r--backends/ppc64_symbol.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/backends/ppc64_symbol.c b/backends/ppc64_symbol.c
index 0feddcee..40ba4f74 100644
--- a/backends/ppc64_symbol.c
+++ b/backends/ppc64_symbol.c
@@ -94,12 +94,15 @@ ppc64_dynamic_tag_check (int64_t tag)
/* Check whether given symbol's st_value and st_size are OK despite failing
normal checks. */
bool
-ppc64_check_special_symbol (Elf *elf, GElf_Ehdr *ehdr,
+ppc64_check_special_symbol (Elf *elf,
const GElf_Sym *sym __attribute__ ((unused)),
const char *name __attribute__ ((unused)),
const GElf_Shdr *destshdr)
{
- const char *sname = elf_strptr (elf, ehdr->e_shstrndx, destshdr->sh_name);
+ size_t shstrndx;
+ if (elf_getshdrstrndx (elf, &shstrndx) != 0)
+ return false;
+ const char *sname = elf_strptr (elf, shstrndx, destshdr->sh_name);
if (sname == NULL)
return false;
return strcmp (sname, ".opd") == 0;