summaryrefslogtreecommitdiff
path: root/usr/src/lib/libproc/common
diff options
context:
space:
mode:
authorAli Bahrami <Ali.Bahrami@Sun.COM>2009-06-18 13:16:39 -0600
committerAli Bahrami <Ali.Bahrami@Sun.COM>2009-06-18 13:16:39 -0600
commit62b628a68db596a2d75a316dc7ffef658079231f (patch)
tree6d2f7ab582d82b5c1ab5f0214cc4e92b9cc2e2b7 /usr/src/lib/libproc/common
parent60c682e1f62d3c131ea9130c21e0ccd86044e039 (diff)
downloadillumos-gate-62b628a68db596a2d75a316dc7ffef658079231f.tar.gz
6851224 elf_getshnum() and elf_getshstrndx() incompatible with 2002 ELF gABI agreement
PSARC/2009/363 replace elf_getphnum, elf_getshnum, and elf_getshstrndx
Diffstat (limited to 'usr/src/lib/libproc/common')
-rw-r--r--usr/src/lib/libproc/common/Pcore.c6
-rw-r--r--usr/src/lib/libproc/common/Pidle.c4
-rw-r--r--usr/src/lib/libproc/common/Psymtab.c20
3 files changed, 15 insertions, 15 deletions
diff --git a/usr/src/lib/libproc/common/Pcore.c b/usr/src/lib/libproc/common/Pcore.c
index 203408c5b9..2357be4364 100644
--- a/usr/src/lib/libproc/common/Pcore.c
+++ b/usr/src/lib/libproc/common/Pcore.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1288,7 +1288,7 @@ core_find_text(struct ps_prochandle *P, Elf *elf, rd_loadobj_t *rlp)
uint_t i;
size_t nphdrs;
- if (elf_getphnum(elf, &nphdrs) == 0)
+ if (elf_getphdrnum(elf, &nphdrs) == -1)
return (NULL);
for (i = 0; i < nphdrs; i++) {
@@ -1323,7 +1323,7 @@ core_find_data(struct ps_prochandle *P, Elf *elf, rd_loadobj_t *rlp)
* as the virtual address at which is was loaded.
*/
if (gelf_getehdr(elf, &ehdr) == NULL ||
- elf_getphnum(elf, &nphdrs) == 0)
+ elf_getphdrnum(elf, &nphdrs) == -1)
return (NULL);
for (i = 0; i < nphdrs; i++) {
diff --git a/usr/src/lib/libproc/common/Pidle.c b/usr/src/lib/libproc/common/Pidle.c
index 5562385ef5..938510abeb 100644
--- a/usr/src/lib/libproc/common/Pidle.c
+++ b/usr/src/lib/libproc/common/Pidle.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -201,7 +201,7 @@ Pgrab_file(const char *fname, int *perr)
goto err;
}
- if (elf_getphnum(elf, &phnum) == 0) {
+ if (elf_getphdrnum(elf, &phnum) == -1) {
*perr = G_STRANGE;
goto err;
}
diff --git a/usr/src/lib/libproc/common/Psymtab.c b/usr/src/lib/libproc/common/Psymtab.c
index 7c05653eeb..725a765798 100644
--- a/usr/src/lib/libproc/common/Psymtab.c
+++ b/usr/src/lib/libproc/common/Psymtab.c
@@ -1664,8 +1664,8 @@ Pbuild_file_symtab(struct ps_prochandle *P, file_info_t *fptr)
if ((elf = fake_elf(P, fptr)) == NULL ||
elf_kind(elf) != ELF_K_ELF ||
gelf_getehdr(elf, &ehdr) == NULL ||
- elf_getshnum(elf, &nshdrs) == 0 ||
- elf_getshstrndx(elf, &shstrndx) == 0 ||
+ elf_getshdrnum(elf, &nshdrs) == -1 ||
+ elf_getshdrstrndx(elf, &shstrndx) == -1 ||
(scn = elf_getscn(elf, shstrndx)) == NULL ||
(shdata = elf_getdata(scn, NULL)) == NULL) {
dprintf("failed to fake up ELF file\n");
@@ -1675,8 +1675,8 @@ Pbuild_file_symtab(struct ps_prochandle *P, file_info_t *fptr)
} else if ((elf = elf_begin(fptr->file_fd, ELF_C_READ, NULL)) == NULL ||
elf_kind(elf) != ELF_K_ELF ||
gelf_getehdr(elf, &ehdr) == NULL ||
- elf_getshnum(elf, &nshdrs) == 0 ||
- elf_getshstrndx(elf, &shstrndx) == 0 ||
+ elf_getshdrnum(elf, &nshdrs) == -1 ||
+ elf_getshdrstrndx(elf, &shstrndx) == -1 ||
(scn = elf_getscn(elf, shstrndx)) == NULL ||
(shdata = elf_getdata(scn, NULL)) == NULL) {
int err = elf_errno();
@@ -1687,8 +1687,8 @@ Pbuild_file_symtab(struct ps_prochandle *P, file_info_t *fptr)
if ((elf = fake_elf(P, fptr)) == NULL ||
elf_kind(elf) != ELF_K_ELF ||
gelf_getehdr(elf, &ehdr) == NULL ||
- elf_getshnum(elf, &nshdrs) == 0 ||
- elf_getshstrndx(elf, &shstrndx) == 0 ||
+ elf_getshdrnum(elf, &nshdrs) == -1 ||
+ elf_getshdrstrndx(elf, &shstrndx) == -1 ||
(scn = elf_getscn(elf, shstrndx)) == NULL ||
(shdata = elf_getdata(scn, NULL)) == NULL) {
dprintf("failed to fake up ELF file\n");
@@ -1712,8 +1712,8 @@ Pbuild_file_symtab(struct ps_prochandle *P, file_info_t *fptr)
if ((newelf = fake_elf(P, fptr)) == NULL ||
elf_kind(newelf) != ELF_K_ELF ||
gelf_getehdr(newelf, &ehdr) == NULL ||
- elf_getshnum(newelf, &nshdrs) == 0 ||
- elf_getshstrndx(newelf, &shstrndx) == 0 ||
+ elf_getshdrnum(newelf, &nshdrs) == -1 ||
+ elf_getshdrstrndx(newelf, &shstrndx) == -1 ||
(scn = elf_getscn(newelf, shstrndx)) == NULL ||
(shdata = elf_getdata(scn, NULL)) == NULL) {
dprintf("failed to fake up ELF file\n");
@@ -2757,7 +2757,7 @@ static int
Psymbol_iter_com(struct ps_prochandle *P, Lmid_t lmid, const char *object_name,
int which, int mask, pr_order_t order, proc_xsym_f *func, void *cd)
{
-#if STT_NUM != (STT_IFUNC + 1)
+#if STT_NUM != (STT_TLS + 1)
#error "STT_NUM has grown. update Psymbol_iter_com()"
#endif
@@ -2845,7 +2845,7 @@ Psymbol_iter_com(struct ps_prochandle *P, Lmid_t lmid, const char *object_name,
* maintain binary compatibility, so I think this is
* reasonably fair game.
*/
- if (s_bind < STB_NUM && s_type < STT_IFUNC) {
+ if (s_bind < STB_NUM && s_type < STT_NUM) {
type = (1 << (s_type + 8)) | (1 << s_bind);
if ((type & ~mask) != 0)
continue;