summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog19
-rw-r--r--src/ld.h4
-rw-r--r--src/ldgeneric.c12
-rw-r--r--src/nm.c6
-rw-r--r--src/objdump.c2
-rw-r--r--src/readelf.c181
-rw-r--r--src/size.c4
-rw-r--r--src/strip.c4
-rw-r--r--src/unstrip.c10
9 files changed, 173 insertions, 69 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f6fd86f3..f74b31d5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,22 @@
+2009-06-13 Ulrich Drepper <drepper@redhat.com>
+
+ * ldgeneric.c: Don't use deprecated libelf functions.
+ * nm.c: Likewise.
+ * objdump.c: Likewise.
+ * readelf.c: Likewise.
+ * size.c: Likewise.
+ * strip.c: Likewise.
+ * unstrip.c: Likewise.
+ * ld.h: Fix up comment.
+
+2009-06-01 Ulrich Drepper <drepper@redhat.com>
+
+ * readelf.c (print_relocs): Expect ELF header argument and pass on
+ to handle_relocs_rel* functions. Adjust caller.
+ (handle_relocs_rel): Add ELF header argument. Add special case for
+ the IRELATIVE relocations in statically linked executables.
+ (handle_relocs_rela): Likewise.
+
2009-04-29 Ulrich Drepper <drepper@redhat.com>
* elflint.c (check_symtab): Add tests of st_other field.
diff --git a/src/ld.h b/src/ld.h
index 535f7cd2..72d5b27b 100644
--- a/src/ld.h
+++ b/src/ld.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2005, 2006, 2008 Red Hat, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2005, 2006, 2008, 2009 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -146,7 +146,7 @@ struct usedfiles
separate field and not the e_shstrndx field in the ELF header
since in case of a file with more than 64000 sections the index
might be stored in the section header of section zero. The
- elf_getshstrndx() function can find the value but it is too
+ elf_getshdrstrndx() function can find the value but it is too
costly to repeat this call over and over. */
size_t shstrndx;
diff --git a/src/ldgeneric.c b/src/ldgeneric.c
index 8df2a57e..b2ea2f90 100644
--- a/src/ldgeneric.c
+++ b/src/ldgeneric.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 Red Hat, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -656,7 +656,7 @@ check_definition (const XElf_Sym *sym, size_t shndx, size_t symidx,
Elf32_Word xndx;
size_t shnum;
- if (elf_getshnum (fileinfo->elf, &shnum) < 0)
+ if (elf_getshdrnum (fileinfo->elf, &shnum) < 0)
error (EXIT_FAILURE, 0,
gettext ("cannot determine number of sections: %s"),
elf_errmsg (-1));
@@ -1117,7 +1117,7 @@ add_relocatable_file (struct usedfiles *fileinfo, GElf_Word secttype)
assert (fileinfo->elf != NULL);
/* Allocate memory for the sections. */
- if (unlikely (elf_getshnum (fileinfo->elf, &scncnt) < 0))
+ if (unlikely (elf_getshdrnum (fileinfo->elf, &scncnt) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot determine number of sections: %s"),
elf_errmsg (-1));
@@ -1619,7 +1619,7 @@ add_relocatable_file (struct usedfiles *fileinfo, GElf_Word secttype)
#ifndef NDEBUG
size_t shnum;
- assert (elf_getshnum (fileinfo->elf, &shnum) == 0);
+ assert (elf_getshdrnum (fileinfo->elf, &shnum) == 0);
assert (shndx < shnum);
#endif
@@ -2038,7 +2038,7 @@ file_process2 (struct usedfiles *fileinfo)
}
/* Determine the section header string table section index. */
- if (unlikely (elf_getshstrndx (fileinfo->elf, &fileinfo->shstrndx)
+ if (unlikely (elf_getshdrstrndx (fileinfo->elf, &fileinfo->shstrndx)
< 0))
{
fprintf (stderr, gettext ("\
@@ -4148,7 +4148,7 @@ compute_hash_sum (void (*hashfct) (const void *, size_t, void *), void *ctx)
{
/* The call cannot fail. */
size_t shstrndx;
- (void) elf_getshstrndx (ld_state.outelf, &shstrndx);
+ (void) elf_getshdrstrndx (ld_state.outelf, &shstrndx);
const char *ident = elf_getident (ld_state.outelf, NULL);
bool same_byte_order = ((ident[EI_DATA] == ELFDATA2LSB
diff --git a/src/nm.c b/src/nm.c
index 8833948a..01519a5a 100644
--- a/src/nm.c
+++ b/src/nm.c
@@ -724,7 +724,7 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx,
int longest_where)
{
size_t shnum;
- if (elf_getshnum (ebl->elf, &shnum) < 0)
+ if (elf_getshdrnum (ebl->elf, &shnum) < 0)
INTERNAL_ERROR (fullname);
bool scnnames_malloced = shnum * sizeof (const char *) > 128 * 1024;
@@ -735,7 +735,7 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx,
scnnames = (const char **) alloca (sizeof (const char *) * shnum);
/* Get the section header string table index. */
size_t shstrndx;
- if (elf_getshstrndx (ebl->elf, &shstrndx) < 0)
+ if (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0)
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -997,7 +997,7 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn,
{
/* Get the section header string table index. */
size_t shstrndx;
- if (elf_getshstrndx (ebl->elf, &shstrndx) < 0)
+ if (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0)
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
diff --git a/src/objdump.c b/src/objdump.c
index af8abf78..1234c794 100644
--- a/src/objdump.c
+++ b/src/objdump.c
@@ -739,7 +739,7 @@ handle_elf (Elf *elf, const char *prefix, const char *fname,
/* Get the section header string table index. */
size_t shstrndx;
- if (elf_getshstrndx (ebl->elf, &shstrndx) < 0)
+ if (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0)
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
diff --git a/src/readelf.c b/src/readelf.c
index 1c790650..ca9772e4 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -211,9 +211,11 @@ static void print_shdr (Ebl *ebl, GElf_Ehdr *ehdr);
static void print_phdr (Ebl *ebl, GElf_Ehdr *ehdr);
static void print_scngrp (Ebl *ebl);
static void print_dynamic (Ebl *ebl, GElf_Ehdr *ehdr);
-static void print_relocs (Ebl *ebl);
-static void handle_relocs_rel (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr);
-static void handle_relocs_rela (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr);
+static void print_relocs (Ebl *ebl, GElf_Ehdr *ehdr);
+static void handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn,
+ GElf_Shdr *shdr);
+static void handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn,
+ GElf_Shdr *shdr);
static void print_symtab (Ebl *ebl, int type);
static void handle_symtab (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr);
static void print_verinfo (Ebl *ebl);
@@ -606,7 +608,7 @@ process_elf_file (Dwfl_Module *dwflmod, int fd)
}
/* Determine the number of sections. */
- if (unlikely (elf_getshnum (ebl->elf, &shnum) < 0))
+ if (unlikely (elf_getshdrnum (ebl->elf, &shnum) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot determine number of sections: %s"),
elf_errmsg (-1));
@@ -652,7 +654,7 @@ process_elf_file (Dwfl_Module *dwflmod, int fd)
if (print_dynamic_table)
print_dynamic (ebl, ehdr);
if (print_relocations)
- print_relocs (pure_ebl);
+ print_relocs (pure_ebl, ehdr);
if (print_histogram)
handle_hash (ebl);
if (print_symbol_table)
@@ -845,7 +847,7 @@ There are %d section headers, starting at offset %#" PRIx64 ":\n\
ehdr->e_shnum, ehdr->e_shoff);
/* Get the section header string table index. */
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -988,7 +990,7 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -1129,7 +1131,7 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -1311,7 +1313,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
return;
/* Get the section header string table index. */
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -1449,7 +1451,7 @@ print_dynamic (Ebl *ebl, GElf_Ehdr *ehdr)
/* Print relocations. */
static void
-print_relocs (Ebl *ebl)
+print_relocs (Ebl *ebl, GElf_Ehdr *ehdr)
{
/* Find all relocation sections and handle them. */
Elf_Scn *scn = NULL;
@@ -1463,9 +1465,9 @@ print_relocs (Ebl *ebl)
if (likely (shdr != NULL))
{
if (shdr->sh_type == SHT_REL)
- handle_relocs_rel (ebl, scn, shdr);
+ handle_relocs_rel (ebl, ehdr, scn, shdr);
else if (shdr->sh_type == SHT_RELA)
- handle_relocs_rela (ebl, scn, shdr);
+ handle_relocs_rela (ebl, ehdr, scn, shdr);
}
}
}
@@ -1473,7 +1475,7 @@ print_relocs (Ebl *ebl)
/* Handle a relocation section. */
static void
-handle_relocs_rel (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
+handle_relocs_rel (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
int nentries = shdr->sh_size / shdr->sh_entsize;
@@ -1509,7 +1511,7 @@ handle_relocs_rel (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -1545,6 +1547,7 @@ handle_relocs_rel (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
Offset Type Value Name\n"),
stdout);
+ int is_statically_linked = 0;
for (int cnt = 0; cnt < nentries; ++cnt)
{
GElf_Rel relmem;
@@ -1558,16 +1561,56 @@ handle_relocs_rel (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
GELF_R_SYM (rel->r_info),
&symmem, &xndx);
if (unlikely (sym == NULL))
- printf (" %#0*" PRIx64 " %-20s <%s %ld>\n",
- class == ELFCLASS32 ? 10 : 18, rel->r_offset,
- ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info))
- /* Avoid the leading R_ which isn't carrying any
- information. */
- ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info),
- buf, sizeof (buf)) + 2
- : gettext ("<INVALID RELOC>"),
- gettext ("INVALID SYMBOL"),
- (long int) GELF_R_SYM (rel->r_info));
+ {
+ /* As a special case we have to handle relocations in static
+ executables. This only happens for IRELATIVE relocations
+ (so far). There is no symbol table. */
+ if (is_statically_linked == 0)
+ {
+ /* Find the program header and look for a PT_INTERP entry. */
+ is_statically_linked = -1;
+ if (ehdr->e_type == ET_EXEC)
+ {
+ is_statically_linked = 1;
+
+ for (size_t inner = 0; inner < ehdr->e_phnum; ++inner)
+ {
+ GElf_Phdr phdr_mem;
+ GElf_Phdr *phdr = gelf_getphdr (ebl->elf, inner,
+ &phdr_mem);
+ if (phdr != NULL && phdr->p_type == PT_INTERP)
+ {
+ is_statically_linked = -1;
+ break;
+ }
+ }
+ }
+ }
+
+ if (is_statically_linked > 0 && shdr->sh_link == 0)
+ printf ("\
+ %#0*" PRIx64 " %-20s %*s %s\n",
+ class == ELFCLASS32 ? 10 : 18, rel->r_offset,
+ ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info))
+ /* Avoid the leading R_ which isn't carrying any
+ information. */
+ ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info),
+ buf, sizeof (buf)) + 2
+ : gettext ("<INVALID RELOC>"),
+ class == ELFCLASS32 ? 10 : 18, "",
+ elf_strptr (ebl->elf, shstrndx, destshdr->sh_name));
+ else
+ printf (" %#0*" PRIx64 " %-20s <%s %ld>\n",
+ class == ELFCLASS32 ? 10 : 18, rel->r_offset,
+ ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info))
+ /* Avoid the leading R_ which isn't carrying any
+ information. */
+ ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info),
+ buf, sizeof (buf)) + 2
+ : gettext ("<INVALID RELOC>"),
+ gettext ("INVALID SYMBOL"),
+ (long int) GELF_R_SYM (rel->r_info));
+ }
else if (GELF_ST_TYPE (sym->st_info) != STT_SECTION)
printf (" %#0*" PRIx64 " %-20s %#0*" PRIx64 " %s\n",
class == ELFCLASS32 ? 10 : 18, rel->r_offset,
@@ -1618,7 +1661,7 @@ handle_relocs_rel (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
/* Handle a relocation section. */
static void
-handle_relocs_rela (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
+handle_relocs_rela (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, GElf_Shdr *shdr)
{
int class = gelf_getclass (ebl->elf);
int nentries = shdr->sh_size / shdr->sh_entsize;
@@ -1654,7 +1697,7 @@ handle_relocs_rela (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -1676,6 +1719,7 @@ handle_relocs_rela (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
Offset Type Value Addend Name\n"),
stdout);
+ int is_statically_linked = 0;
for (int cnt = 0; cnt < nentries; ++cnt)
{
GElf_Rela relmem;
@@ -1690,16 +1734,57 @@ handle_relocs_rela (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
&symmem, &xndx);
if (unlikely (sym == NULL))
- printf (" %#0*" PRIx64 " %-15s <%s %ld>\n",
- class == ELFCLASS32 ? 10 : 18, rel->r_offset,
- ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info))
- /* Avoid the leading R_ which isn't carrying any
- information. */
- ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info),
- buf, sizeof (buf)) + 2
- : gettext ("<INVALID RELOC>"),
- gettext ("INVALID SYMBOL"),
- (long int) GELF_R_SYM (rel->r_info));
+ {
+ /* As a special case we have to handle relocations in static
+ executables. This only happens for IRELATIVE relocations
+ (so far). There is no symbol table. */
+ if (is_statically_linked == 0)
+ {
+ /* Find the program header and look for a PT_INTERP entry. */
+ is_statically_linked = -1;
+ if (ehdr->e_type == ET_EXEC)
+ {
+ is_statically_linked = 1;
+
+ for (size_t inner = 0; inner < ehdr->e_phnum; ++inner)
+ {
+ GElf_Phdr phdr_mem;
+ GElf_Phdr *phdr = gelf_getphdr (ebl->elf, inner,
+ &phdr_mem);
+ if (phdr != NULL && phdr->p_type == PT_INTERP)
+ {
+ is_statically_linked = -1;
+ break;
+ }
+ }
+ }
+ }
+
+ if (is_statically_linked > 0 && shdr->sh_link == 0)
+ printf ("\
+ %#0*" PRIx64 " %-15s %*s %#6" PRIx64 " %s\n",
+ class == ELFCLASS32 ? 10 : 18, rel->r_offset,
+ ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info))
+ /* Avoid the leading R_ which isn't carrying any
+ information. */
+ ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info),
+ buf, sizeof (buf)) + 2
+ : gettext ("<INVALID RELOC>"),
+ class == ELFCLASS32 ? 10 : 18, "",
+ rel->r_addend,
+ elf_strptr (ebl->elf, shstrndx, destshdr->sh_name));
+ else
+ printf (" %#0*" PRIx64 " %-15s <%s %ld>\n",
+ class == ELFCLASS32 ? 10 : 18, rel->r_offset,
+ ebl_reloc_type_check (ebl, GELF_R_TYPE (rel->r_info))
+ /* Avoid the leading R_ which isn't carrying any
+ information. */
+ ? ebl_reloc_type_name (ebl, GELF_R_TYPE (rel->r_info),
+ buf, sizeof (buf)) + 2
+ : gettext ("<INVALID RELOC>"),
+ gettext ("INVALID SYMBOL"),
+ (long int) GELF_R_SYM (rel->r_info));
+ }
else if (GELF_ST_TYPE (sym->st_info) != STT_SECTION)
printf ("\
%#0*" PRIx64 " %-15s %#0*" PRIx64 " %+6" PRId64 " %s\n",
@@ -1822,7 +1907,7 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -2076,7 +2161,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -2142,7 +2227,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -2220,7 +2305,7 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -2717,7 +2802,7 @@ handle_hash (Ebl *ebl)
{
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -2753,7 +2838,7 @@ print_liblist (Ebl *ebl)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -2815,7 +2900,7 @@ print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -4602,7 +4687,7 @@ print_debug_frame_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
{
size_t shstrndx;
/* We know this call will succeed since it did in the caller. */
- (void) elf_getshstrndx (ebl->elf, &shstrndx);
+ (void) elf_getshdrstrndx (ebl->elf, &shstrndx);
const char *scnname = elf_strptr (ebl->elf, shstrndx, shdr->sh_name);
Elf_Data *data = elf_rawdata (scn, NULL);
@@ -6307,7 +6392,7 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -7173,7 +7258,7 @@ handle_notes (Ebl *ebl, GElf_Ehdr *ehdr)
{
/* Get the section header string table index. */
size_t shstrndx;
- if (elf_getshstrndx (ebl->elf, &shstrndx) < 0)
+ if (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0)
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -7318,7 +7403,7 @@ for_each_section_argument (Elf *elf, const struct section_argument *list,
{
/* Get the section header string table index. */
size_t shstrndx;
- if (elf_getshstrndx (elf, &shstrndx) < 0)
+ if (elf_getshdrstrndx (elf, &shstrndx) < 0)
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -7387,7 +7472,7 @@ print_strings (Ebl *ebl)
{
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (ebl->elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
diff --git a/src/size.c b/src/size.c
index 4698c350..d3dc1fe5 100644
--- a/src/size.c
+++ b/src/size.c
@@ -420,7 +420,7 @@ show_sysv (Elf *elf, const char *prefix, const char *fname,
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -494,7 +494,7 @@ show_sysv_one_line (Elf *elf)
{
/* Get the section header string table index. */
size_t shstrndx;
- if (unlikely (elf_getshstrndx (elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
diff --git a/src/strip.c b/src/strip.c
index d788ebf2..32cf0d70 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -477,7 +477,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
INTERNAL_ERROR (fname);
/* Get the section header string table index. */
- if (unlikely (elf_getshstrndx (elf, &shstrndx) < 0))
+ if (unlikely (elf_getshdrstrndx (elf, &shstrndx) < 0))
error (EXIT_FAILURE, 0,
gettext ("cannot get section header string table index"));
@@ -537,7 +537,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
/* Number of sections. */
size_t shnum;
- if (unlikely (elf_getshnum (elf, &shnum) < 0))
+ if (unlikely (elf_getshdrnum (elf, &shnum) < 0))
{
error (0, 0, gettext ("cannot determine number of sections: %s"),
elf_errmsg (-1));
diff --git a/src/unstrip.c b/src/unstrip.c
index 97b73c6f..284607b3 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -1218,19 +1218,19 @@ copy_elided_sections (Elf *unstripped, Elf *stripped,
const GElf_Ehdr *stripped_ehdr, GElf_Addr bias)
{
size_t unstripped_shstrndx;
- ELF_CHECK (elf_getshstrndx (unstripped, &unstripped_shstrndx) == 0,
+ ELF_CHECK (elf_getshdrstrndx (unstripped, &unstripped_shstrndx) == 0,
_("cannot get section header string table section index: %s"));
size_t stripped_shstrndx;
- ELF_CHECK (elf_getshstrndx (stripped, &stripped_shstrndx) == 0,
+ ELF_CHECK (elf_getshdrstrndx (stripped, &stripped_shstrndx) == 0,
_("cannot get section header string table section index: %s"));
size_t unstripped_shnum;
- ELF_CHECK (elf_getshnum (unstripped, &unstripped_shnum) == 0,
+ ELF_CHECK (elf_getshdrnum (unstripped, &unstripped_shnum) == 0,
_("cannot get section count: %s"));
size_t stripped_shnum;
- ELF_CHECK (elf_getshnum (stripped, &stripped_shnum) == 0,
+ ELF_CHECK (elf_getshdrnum (stripped, &stripped_shnum) == 0,
_("cannot get section count: %s"));
/* Cache the stripped file's section details. */
@@ -1461,7 +1461,7 @@ copy_elided_sections (Elf *unstripped, Elf *stripped,
strtab);
/* Get the updated section count. */
- ELF_CHECK (elf_getshnum (unstripped, &unstripped_shnum) == 0,
+ ELF_CHECK (elf_getshdrnum (unstripped, &unstripped_shnum) == 0,
_("cannot get section count: %s"));
bool placed[unstripped_shnum - 1];