diff options
Diffstat (limited to 'backends/ppc64_init.c')
-rw-r--r-- | backends/ppc64_init.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c index e5670338..3db5e766 100644 --- a/backends/ppc64_init.c +++ b/backends/ppc64_init.c @@ -80,7 +80,9 @@ ppc64_init (Elf *elf __attribute__ ((unused)), if (elf != NULL) { GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem); - if (ehdr != NULL && ehdr->e_type != ET_REL) + size_t shstrndx; + if (ehdr != NULL && ehdr->e_type != ET_REL + && elf_getshdrstrndx (elf, &shstrndx) == 0) { /* We could also try through DT_PPC64_OPD and DT_PPC64_OPDSZ. */ GElf_Shdr opd_shdr_mem, *opd_shdr; @@ -93,7 +95,7 @@ ppc64_init (Elf *elf __attribute__ ((unused)), && opd_shdr->sh_type == SHT_PROGBITS && opd_shdr->sh_size > 0) { - const char *name = elf_strptr (elf, ehdr->e_shstrndx, + const char *name = elf_strptr (elf, shstrndx, opd_shdr->sh_name); if (name != NULL && strcmp (name, ".opd") == 0) { |