]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Include sys/ptrace.h as early as possible.
authorMark Wielaard <mark@klomp.org>
Thu, 15 Feb 2018 13:44:18 +0000 (14:44 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 15 Feb 2018 13:55:39 +0000 (14:55 +0100)
On some systems, at least on Fedora 27 ppc64le with glibc 2.26-24 and
kernel 4.14.18-300, including sys/ptrace.h late (after signal.h or
sys/wait.h for example) will cause issues and produce errors like:

In file included from /usr/include/asm/sigcontext.h:12:0,
                 from /usr/include/bits/sigcontext.h:30,
                 from /usr/include/signal.h:287,
                 from /usr/include/sys/wait.h:36,
                 from linux-pid-attach.c:38:
/usr/include/sys/ptrace.h:73:3: error: expected identifier before numeric constant
   PTRACE_GETREGS = 12,
   ^

Swapping the include order fixes these issues.

Signed-off-by: Mark Wielaard <mark@klomp.org>
backends/ChangeLog
backends/ppc_initreg.c
libdwfl/ChangeLog
libdwfl/linux-pid-attach.c
tests/ChangeLog
tests/backtrace-child.c
tests/backtrace-dwarf.c

index 098bed76fe8ed174e7e3ddbe81b3a657c49c70b5..b52580132cce76ad5871996537cad92f2fb3b4dc 100644 (file)
@@ -1,3 +1,7 @@
+2018-02-15  Mark Wielaard  <mark@klomp.org>
+
+       * ppc_initreg.c: Include ptrace.h before system.h and sys/user.h.
+
 2018-02-09  Joshua Watt  <JPEWhacker@gmail.com>
 
        * aarch64_retval.c (aarch64_return_value_location): Use FALLTHROUGH
index 69d623b9e730e5d727fa411b1f1aa893cd60540a..3e4432f655588293a92c88f583612ed1daf1321a 100644 (file)
 # include <config.h>
 #endif
 
-#include "system.h"
 #include <stdlib.h>
 #if defined(__powerpc__) && defined(__linux__)
-# include <sys/user.h>
 # include <sys/ptrace.h>
+# include <sys/user.h>
 #endif
 
+#include "system.h"
+
 #define BACKEND ppc_
 #include "libebl_CPU.h"
 
index 453f1d3e6ffdf3cc4d0002b25140a3728cf6ef16..43fc15174057f542d09f73006989f1dacfc3a68c 100644 (file)
@@ -1,3 +1,7 @@
+2018-02-15  Mark Wielaard  <mark@klomp.org>
+
+       * linux-pid-attach.c: Include sys/wait.h after sys/ptrace.h.
+
 2018-02-09  Joshua Watt  <JPEWhacker@gmail.com>
 
        * dwfl_report_elf.c (__libdwfl_elf_address_range): Use FALLTHROUGH
index e6a5c419cc2aae7d6136eb43b1b0a57bbf8f1dcf..2ab4109c46aa0856be7c5f5b11ce3a941967203a 100644 (file)
@@ -35,7 +35,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <sys/wait.h>
 #include <dirent.h>
 #include <unistd.h>
 
@@ -43,6 +42,7 @@
 
 #include <sys/ptrace.h>
 #include <sys/syscall.h>
+#include <sys/wait.h>
 
 static bool
 linux_proc_pid_is_stopped (pid_t pid)
index eb4576cafeb21153e77c2c400dba79f5e7768935..cfdd7f90978dcf3ee1be79ed3ee1e6be64787c49 100644 (file)
@@ -1,3 +1,9 @@
+2018-02-15  Mark Wielaard  <mark@klomp.org>
+
+       * backtrace-child.c: Include signal.h after sys/ptrace.h.
+       * backtrace-dwarf.c: Include sys/wait.h and signal.h after
+       sys/ptrace.h.
+
 2018-01-25  Mark Wielaard  <mark@klomp.org>
 
        * Makefile.am (check_PROGRAMS): Add dwarf-die-addr-die.
index 2c27414f25130f707955e4c1094d0bf0c9b1d9fd..9c6ba94f1139ba5864d2cf7f752b716858f761a9 100644 (file)
@@ -81,7 +81,6 @@
 #include <config.h>
 #include <assert.h>
 #include <stdlib.h>
-#include <signal.h>
 #include <errno.h>
 #include <string.h>
 #include <pthread.h>
@@ -100,6 +99,7 @@ main (int argc __attribute__ ((unused)), char **argv)
 
 #else /* __linux__ */
 #include <sys/ptrace.h>
+#include <signal.h>
 
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 #define NOINLINE_NOCLONE __attribute__ ((noinline, noclone))
index 2dc8a9a29bd9fe065e6eb62e73dccba4125436e9..7ff826cd8e4e710f42f755f6f1f8215b7e360717 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <config.h>
 #include <assert.h>
-#include <signal.h>
 #include <inttypes.h>
 #include <stdio_ext.h>
 #include <locale.h>
@@ -25,7 +24,6 @@
 #include <error.h>
 #include <unistd.h>
 #include <sys/types.h>
-#include <sys/wait.h>
 #include ELFUTILS_HEADER(dwfl)
 
 #ifndef __linux__
@@ -40,6 +38,8 @@ main (int argc __attribute__ ((unused)), char **argv)
 
 #else /* __linux__ */
 #include <sys/ptrace.h>
+#include <sys/wait.h>
+#include <signal.h>
 
 #define main cleanup_13_main
 #include "cleanup-13.c"