Add aliases for elf_getshnum and elf_getshstrndx.
Sun in their implementation messed up the semantics of these functions.
To get back to source code compatibility they asked for a solution.
We simply add aliases for the two affected functions, named
elf_getshdrnum and elf_getshdrstrndx. The semantics remains the
same. Users of the old interfaces receive a warning for now. In
future we might make it impossible to link programs which request
the old interfaces (binary compatibility will of course be maintained).
diff --git a/src/readelf.c b/src/readelf.c
index 9ce4604..ca9772e 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -608,7 +608,7 @@
}
/* 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));
@@ -847,7 +847,7 @@
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"));
@@ -990,7 +990,7 @@
/* 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"));
@@ -1131,7 +1131,7 @@
/* 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"));
@@ -1313,7 +1313,7 @@
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"));
@@ -1511,7 +1511,7 @@
/* 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"));
@@ -1697,7 +1697,7 @@
/* 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"));
@@ -1907,7 +1907,7 @@
/* 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"));
@@ -2161,7 +2161,7 @@
/* 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"));
@@ -2227,7 +2227,7 @@
/* 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"));
@@ -2305,7 +2305,7 @@
/* 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"));
@@ -2802,7 +2802,7 @@
{
/* 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"));
@@ -2838,7 +2838,7 @@
/* 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"));
@@ -2900,7 +2900,7 @@
/* 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"));
@@ -4687,7 +4687,7 @@
{
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);
@@ -6392,7 +6392,7 @@
/* 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"));
@@ -7258,7 +7258,7 @@
{
/* 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"));
@@ -7403,7 +7403,7 @@
{
/* 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"));
@@ -7472,7 +7472,7 @@
{
/* 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"));