components/dwarf/patches/000-solaris-relocs.patch
author Norm Jacobs <Norm.Jacobs@Oracle.COM>
Fri, 31 Mar 2017 10:33:39 -0700
changeset 7822 7d852afd19da
permissions -rw-r--r--
25430897 Solaris needs a newer DWARF

#
# Submitted upstream on 2017-01-23, it will be incorporated in the
# the next release.
#
diff --git a/libdwarf/config.h.in b/libdwarf/config.h.in
index c593643..980e3d4 100644
--- a/libdwarf/config.h.in
+++ b/libdwarf/config.h.in
@@ -79,6 +79,15 @@
 /* Define 1 if libelf.h defines struct _Elf */
 #undef HAVE_STRUCT_UNDERSCORE_ELF
 
+/* Define to 1 if you have the <sys/elf_386.h> header file. */
+#undef HAVE_SYS_ELF_386_H
+
+/* Define to 1 if you have the <sys/elf_amd64.h> header file. */
+#undef HAVE_SYS_ELF_AMD64_H
+
+/* Define to 1 if you have the <sys/elf_SPARC.h> header file. */
+#undef HAVE_SYS_ELF_SPARC_H
+
 /* Define to 1 if you have the <sys/ia64/elf.h> header file. */
 #undef HAVE_SYS_IA64_ELF_H
 
diff --git a/libdwarf/configure.in b/libdwarf/configure.in
index 46ab313..7671896 100644
--- a/libdwarf/configure.in
+++ b/libdwarf/configure.in
@@ -12,7 +12,7 @@ AC_CHECK_TOOL(AR, ar)
 
 dnl AC_ARFLAGS
 
-AC_CHECK_HEADERS(alloca.h elf.h unistd.h elfaccess.h libelf.h libelf/libelf.h  sys/types.h sys/ia64/elf.h)
+AC_CHECK_HEADERS(alloca.h elf.h unistd.h elfaccess.h libelf.h libelf/libelf.h sys/types.h sys/elf_386.h sys/elf_amd64.h sys/elf_SPARC.h sys/ia64/elf.h)
 
 dnl The default libdwarf is the one with struct Elf
 echo Assuming struct Elf for the default libdwarf.h
diff --git a/libdwarf/dwarf_elf_access.c b/libdwarf/dwarf_elf_access.c
index 5ebece9..a132a50 100644
--- a/libdwarf/dwarf_elf_access.c
+++ b/libdwarf/dwarf_elf_access.c
@@ -43,6 +43,16 @@
 
 #ifdef HAVE_ELF_H
 #include <elf.h>
+/* Relocations are in sys/elf_{mach}.h on Solaris.  */
+#ifdef HAVE_SYS_ELF_AMD64_H
+#include <sys/elf_amd64.h>
+#endif
+#ifdef HAVE_SYS_ELF_386_H
+#include <sys/elf_386.h>
+#endif
+#ifdef HAVE_SYS_ELF_SPARC_H
+#include <sys/elf_SPARC.h>
+#endif
 #endif
 #ifdef HAVE_LIBELF_H
 #include <libelf.h>