]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Clean up linux-specific system includes
authorUlf Hermann <ulf.hermann@qt.io>
Thu, 20 Apr 2017 13:37:04 +0000 (15:37 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 25 Apr 2017 22:10:52 +0000 (00:10 +0200)
We only include them where we actually need them and only on linux.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
13 files changed:
backends/ChangeLog
backends/aarch64_initreg.c
backends/arm_initreg.c
backends/ppc_initreg.c
backends/s390_initreg.c
backends/x86_64_initreg.c
libdwfl/ChangeLog
libdwfl/dwfl_frame.c
libdwfl/frame_unwind.c
libdwfl/linux-pid-attach.c
tests/ChangeLog
tests/backtrace-child.c
tests/backtrace-dwarf.c

index 39390cb834c0bf769688fd01f39b9119cfe7499d..c6e0e08bf598ca3d03af59b93d6fd46463d236df 100644 (file)
@@ -1,3 +1,11 @@
+2017-04-20  Ulf Hermann <ulf.hermann@qt.io>
+
+       * aarch64_initreg.c: Compile register initialization only on linux.
+       * arm_initreg.c: Likewise.
+       * ppc_initreg.c: Likewise.
+       * s390_initreg.c: Likewise.
+       * x86_64_initreg.c: Likewise.
+
 2017-02-15  Mark Wielaard  <mark@klomp.org>
 
        * ppc64_init.c (ppc64_init): Add check_object_attribute HOOK.
index 9706205e809e96bc98608b8e9fb9c9cced2f666a..daf6f3751454834fe83e47910c2d58c89514f20c 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "system.h"
 #include <assert.h>
-#ifdef __aarch64__
+#if defined(__aarch64__) && defined(__linux__)
 # include <linux/uio.h>
 # include <sys/user.h>
 # include <sys/ptrace.h>
@@ -51,7 +51,7 @@ aarch64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
                          ebl_tid_registers_t *setfunc __attribute__ ((unused)),
                                void *arg __attribute__ ((unused)))
 {
-#ifndef __aarch64__
+#if !defined(__aarch64__) || !defined(__linux__)
   return false;
 #else /* __aarch64__ */
 
index a0a9be942f4e7716d60b7b5e29388217120e0c7b..efcabaf6a912e59412e107a241ef286dc4bbbe1c 100644 (file)
@@ -30,6 +30,7 @@
 # include <config.h>
 #endif
 
+#ifdef __linux__
 #if defined __arm__
 # include <sys/types.h>
 # include <sys/user.h>
@@ -45,6 +46,7 @@
 #  define user_regs_struct user_pt_regs
 # endif
 #endif
+#endif
 
 #define BACKEND arm_
 #include "libebl_CPU.h"
@@ -54,7 +56,7 @@ arm_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
                          ebl_tid_registers_t *setfunc __attribute__ ((unused)),
                               void *arg __attribute__ ((unused)))
 {
-#if !defined __arm__ && !defined __aarch64__
+#if !defined(__linux__) || (!defined __arm__ && !defined __aarch64__)
   return false;
 #else  /* __arm__ || __aarch64__ */
 #if defined __arm__
index 64f537932ac3b8b61cce20015099451530463a60..69d623b9e730e5d727fa411b1f1aa893cd60540a 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "system.h"
 #include <stdlib.h>
-#ifdef __powerpc__
+#if defined(__powerpc__) && defined(__linux__)
 # include <sys/user.h>
 # include <sys/ptrace.h>
 #endif
@@ -70,7 +70,7 @@ ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
                          ebl_tid_registers_t *setfunc __attribute__ ((unused)),
                               void *arg __attribute__ ((unused)))
 {
-#ifndef __powerpc__
+#if !defined(__powerpc__) || !defined(__linux__)
   return false;
 #else /* __powerpc__ */
   union
index b4c4b67c97dcb58302e7f390a8bc585b0334c7e5..011305ceabaa1fb15f270360006f51d240a8c159 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "system.h"
 #include <assert.h>
-#ifdef __s390__
+#if defined(__s390__) && defined(__linux__)
 # include <sys/user.h>
 # include <asm/ptrace.h>
 # include <sys/ptrace.h>
@@ -46,7 +46,7 @@ s390_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
                          ebl_tid_registers_t *setfunc __attribute__ ((unused)),
                                void *arg __attribute__ ((unused)))
 {
-#ifndef __s390__
+#if !defined(__s390__) || !defined(__linux__)
   return false;
 #else /* __s390__ */
   struct user user_regs;
index db9216ed6044bcecdfaaabe6cd66d5331709b8eb..50e900208f01b0086fee893421c94928cae2c825 100644 (file)
@@ -31,7 +31,7 @@
 #endif
 
 #include <stdlib.h>
-#ifdef __x86_64__
+#if defined(__x86_64__) && defined(__linux__)
 # include <sys/user.h>
 # include <sys/ptrace.h>
 #endif
index cc95e06717fa4e09f430b89385fcb2ffb37306bb..5c814181a65568137a1ea8142d36c7828086b8dc 100644 (file)
@@ -1,5 +1,12 @@
 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
 
+       * dwfl_frame.c: Drop unused sys/ptrace.h include.
+       * frame_unwind.c: Likewise.
+       * linux-pid-attach.c: Include sys/ptrace.h and sys/syscall.h only on
+       linux.
+
+2017-04-20  Ulf Hermann <ulf.hermann@qt.io>
+
        * linux-kernel-modules.c: Include sys/types.h before fts.h
 
 2017-03-24  Mark Wielaard  <mark@klomp.org>
index d63993983078c9caa9558217a1221232041efee5..1dc0c8dd3e92a052a74ec77fdb23ac03c5de0d7a 100644 (file)
@@ -27,7 +27,6 @@
    not, see <http://www.gnu.org/licenses/>.  */
 
 #include "libdwflP.h"
-#include <sys/ptrace.h>
 #include <unistd.h>
 
 /* Set STATE->pc_set from STATE->regs according to the backend.  Return true on
index fb42c1a789da8a44adc3f92c51716b48252702d9..4dc9c43252fd0a232168ede0cbc6712da94cfaef 100644 (file)
@@ -34,7 +34,6 @@
 #include <stdlib.h>
 #include "libdwflP.h"
 #include "../libdw/dwarf.h"
-#include <sys/ptrace.h>
 #include <system.h>
 
 /* Maximum number of DWARF expression stack slots before returning an error.  */
index adfc7f818027b7e71aa1ea860675a4035a7d1489..398df96d0712f0f562c574e143309bf72df6dca9 100644 (file)
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <sys/ptrace.h>
 #include <sys/wait.h>
 #include <dirent.h>
-#include <sys/syscall.h>
 #include <unistd.h>
 
 #ifdef __linux__
 
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+
 static bool
 linux_proc_pid_is_stopped (pid_t pid)
 {
index 5f7bcddbdef7b6f75d0ab16c356399bf36acf704..ebcd7bcce8671937f8058991446ce39e23b734e1 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-20  Ulf Hermann <ulf.hermann@qt.io>
+
+       * backtrace-child.c: Include sys/ptrace.h only on linux.
+       * backtrace-dwarf.c: Likewise.
+
 2017-04-05  Mark Wielaard  <mark@klomp.org>
 
        * test-subr.sh (testrun_on_self_compressed): New function.
index cf4547cabfec764ad3b60271a4c86f17c9a1a983..2c27414f25130f707955e4c1094d0bf0c9b1d9fd 100644 (file)
@@ -83,7 +83,6 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <errno.h>
-#include <sys/ptrace.h>
 #include <string.h>
 #include <pthread.h>
 #include <stdio.h>
@@ -100,6 +99,7 @@ main (int argc __attribute__ ((unused)), char **argv)
 }
 
 #else /* __linux__ */
+#include <sys/ptrace.h>
 
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 #define NOINLINE_NOCLONE __attribute__ ((noinline, noclone))
index a644c8abda43f9c02a73eb43fbdeac4f9dbdb607..2dc8a9a29bd9fe065e6eb62e73dccba4125436e9 100644 (file)
@@ -24,7 +24,6 @@
 #include <errno.h>
 #include <error.h>
 #include <unistd.h>
-#include <sys/ptrace.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include ELFUTILS_HEADER(dwfl)
@@ -40,6 +39,7 @@ main (int argc __attribute__ ((unused)), char **argv)
 }
 
 #else /* __linux__ */
+#include <sys/ptrace.h>
 
 #define main cleanup_13_main
 #include "cleanup-13.c"