summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWez Furlong <wez@messagesystems.com>2012-03-24 14:27:02 -0400
committerWez Furlong <wez@messagesystems.com>2012-03-24 14:27:02 -0400
commit2ba434759480381e6bb6cc91b5a1461b221fb945 (patch)
tree217b73ddca02dddcfc8b8f337b27ac6989789865
parent49ab3e0dd3256b9887890e7074dea7248e522bf5 (diff)
downloadctf-master.tar.gz
on Solaris, use the system libelf.HEADmaster
-rw-r--r--configure.ac11
-rw-r--r--libdwarf/dwarf_init.c7
2 files changed, 15 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 9f76c61..62a311a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,15 @@ AC_CHECK_LIB(z, uncompress)
AC_CHECK_LIB(elf, gelf_getshdr, [],[
build_gelf=true
])
- build_gelf=true
+case $host in
+ *solaris*)
+ build_gelf=false
+ AC_CHECK_HEADERS([gelf.h])
+ ;;
+ *)
+ build_gelf=true
+ ;;
+esac
AM_CONDITIONAL([BUILD_ELF], [test "$build_gelf" = true])
AC_CHECK_LIB(dwarf, dwarf_elf_init, [], [
@@ -36,7 +44,6 @@ AM_CONDITIONAL([BUILD_DWARF], [test "$build_dwarf" = true])
AC_CHECK_LIB(pthread, pthread_create)
-#gelf.h \
AC_CHECK_HEADERS([ \
ctype.h \
dwarf.h \
diff --git a/libdwarf/dwarf_init.c b/libdwarf/dwarf_init.c
index 7749345..63c03fd 100644
--- a/libdwarf/dwarf_init.c
+++ b/libdwarf/dwarf_init.c
@@ -610,7 +610,12 @@ dwarf_elf_read(Dwarf_Debug dbg, Dwarf_Error *error)
}
/* Get the section index to the string table. */
- if (elf_getshdrstrndx(dbg->dbg_elf, &dbg->dbg_stnum) == -1) {
+#ifdef sun
+ i = elf_getshstrndx(dbg->dbg_elf, &dbg->dbg_stnum) == 0;
+#else
+ i = elf_getshdrstrndx(dbg->dbg_elf, &dbg->dbg_stnum) == -1;
+#endif
+ if (i) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ELF;
}