found 682101 0.159-4
tags 682101 patch

Hi,

elfutils currently FTBFS onGNU/Hurd due to two reasons:
1) <sys/user.h> is unconditionally included in three source files, that
file does not exist for Hurd.
2) Two tests fails: run-native-test.sh and dwfl-bug-fd-leak

These problems are solved but the two attached patches config.patch and
sys_user_h.patch.

The config.patch consists of two modifications: Adding a test for
<sys/user.h> in configure.ac and a definition of OS_IS_GNU used in
config.h.in to add XFAIL_TESTS for the failing tests in
tests/Makefile.am. These tests are both Linux-specific. The same tests
also fails on kfreebsd-any (for other reasons) and the XFAIL_TESTS entry
might be extended to that OS.

The patch sys_user_h.patch adds checks in files backends/i386_initreg.c,
tests/backtrace.c and tests/backtrace-data.c to conditionally include
the file <sys/user.h> if present on the system.

Thanks!

Index: elfutils-0.159/configure.ac
===================================================================
--- elfutils-0.159.orig/configure.ac
+++ elfutils-0.159/configure.ac
@@ -38,6 +38,7 @@ AH_TEMPLATE([MODVERSION], [Identifier fo
 AC_CONFIG_SRCDIR([libelf/libelf.h])
 AC_CONFIG_FILES([Makefile])
 AC_CONFIG_HEADERS([config.h])
+AC_CHECK_HEADERS([sys/user.h])
 
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_FILES([m4/Makefile])
@@ -314,6 +315,15 @@ AC_CONFIG_FILES([tests/Makefile])
 AC_SUBST(USE_NLS, yes)
 AM_PO_SUBDIRS
 
+AC_MSG_CHECKING([for supported operating system])
+case "$host_os" in
+     gnu*)
+     os=gnu
+     AC_DEFINE([OS_IS_GNU], 1, [Define for the GNU/Hurd operating system.])
+     ;;
+esac
+AM_CONDITIONAL(OS_IS_GNU, [test x"$os" = xgnu])
+
 dnl Appended to the config.h file.
 dnl We hide all kinds of configuration magic in lib/eu-config.h.
 AH_BOTTOM([#include <eu-config.h>])
Index: elfutils-0.159/config.h.in
===================================================================
--- elfutils-0.159.orig/config.h.in
+++ elfutils-0.159/config.h.in
@@ -27,6 +27,9 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <sys/user.h> header file. */
+#undef HAVE_SYS_USER_H
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
@@ -39,6 +42,9 @@
 /* Define to 32 or 64 if a specific implementation is wanted. */
 #undef NATIVE_ELF
 
+/* Define for the GNU/Hurd operating system. */
+#undef OS_IS_GNU
+
 /* Name of package */
 #undef PACKAGE
 
Index: elfutils-0.159/tests/Makefile.am
===================================================================
--- elfutils-0.159.orig/tests/Makefile.am
+++ elfutils-0.159/tests/Makefile.am
@@ -414,3 +414,9 @@ check: check-am coverage
 coverage:
 	-$(srcdir)/coverage.sh
 endif
+
+if OS_IS_GNU
+XFAIL_TESTS= \
+	run-native-test.sh \
+	dwfl-bug-fd-leak
+endif
Index: elfutils-0.159/backends/i386_initreg.c
===================================================================
--- elfutils-0.159.orig/backends/i386_initreg.c
+++ elfutils-0.159/backends/i386_initreg.c
@@ -32,7 +32,9 @@
 
 #if defined __i386__ || defined __x86_64__
 # include <sys/types.h>
+#ifdef HAVE_SYS_USER_H
 # include <sys/user.h>
+#endif
 # include <sys/ptrace.h>
 #endif
 
Index: elfutils-0.159/tests/backtrace.c
===================================================================
--- elfutils-0.159.orig/tests/backtrace.c
+++ elfutils-0.159/tests/backtrace.c
@@ -32,7 +32,9 @@
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#ifdef HAVE_SYS_USER_H
 #include <sys/user.h>
+#endif
 #include <fcntl.h>
 #include <string.h>
 #include <argp.h>
Index: elfutils-0.159/tests/backtrace-data.c
===================================================================
--- elfutils-0.159.orig/tests/backtrace-data.c
+++ elfutils-0.159/tests/backtrace-data.c
@@ -35,7 +35,9 @@
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#ifdef HAVE_SYS_USER_H
 #include <sys/user.h>
+#endif
 #include <fcntl.h>
 #include <string.h>
 #include ELFUTILS_HEADER(dwfl)

Reply via email to