Hi,
I've built this library for QNX and had issues since dl_iterate_phdr detection failed (header "link.h" is under "sys/link.h").
I could fix it by adding include paths, but I think having it autodetect is better...
Something like the following fixes it:
$ git diff elf.c configure.ac
diff --git a/configure.ac b/configure.ac
index 9ee1392dd4a0..20fb91be627c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -325,12 +325,19 @@ AC_SUBST(BACKTRACE_USES_MALLOC)
# Check for dl_iterate_phdr.
AC_CHECK_HEADERS(link.h)
+link_h="link.h"
if test "$ac_cv_header_link_h" = "no"; then
- have_dl_iterate_phdr=no
-else
+ AC_CHECK_HEADERS(sys/link.h)
+ if test "$ac_cv_header_sys_link_h" = "no"; then
+ have_dl_iterate_phdr=no
+ else
+ link_h="sys/link.h"
+ fi
+fi
+if test "$have_dl_iterate_phdr" != "no"; then
if test -n "${with_target_subdir}"; then
# When built as a GCC target library, we can't do a link test.
- AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes],
+ AC_EGREP_HEADER([dl_iterate_phdr], [$link_h], [have_dl_iterate_phdr=yes],
[have_dl_iterate_phdr=no])
case "${host}" in
*-*-solaris2.10*)
diff --git a/elf.c b/elf.c
index 79d56146fc67..d1dcb771ef61 100644
--- a/elf.c
+++ b/elf.c
@@ -40,7 +40,11 @@ POSSIBILITY OF SUCH DAMAGE. */
#include <unistd.h>
#ifdef HAVE_DL_ITERATE_PHDR
+#ifdef HAVE_LINK_H
#include <link.h>
+#else
+#include <sys/link.h>
+#endif
#endif
#include "backtrace.h"
Hi, I've built this library for QNX and had issues since dl_iterate_phdr detection failed (header "link.h" is under "sys/link.h"). I could fix it by adding include paths, but I think having it autodetect is better... Something like the following fixes it: