diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-04-20 15:37:04 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2017-04-26 00:10:52 +0200 |
commit | 9c1509abe9f3934746b04eff8d91f6f9d181f41d (patch) | |
tree | 668ed5b830860d4c077f332514f22326993af15d | |
parent | 5dd27ffbb374b90741fb854de3e02708ffda643f (diff) | |
download | elfutils-9c1509abe9f3934746b04eff8d91f6f9d181f41d.tar.gz |
Clean up linux-specific system includes
We only include them where we actually need them and only on linux.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r-- | backends/ChangeLog | 8 | ||||
-rw-r--r-- | backends/aarch64_initreg.c | 4 | ||||
-rw-r--r-- | backends/arm_initreg.c | 4 | ||||
-rw-r--r-- | backends/ppc_initreg.c | 4 | ||||
-rw-r--r-- | backends/s390_initreg.c | 4 | ||||
-rw-r--r-- | backends/x86_64_initreg.c | 2 | ||||
-rw-r--r-- | libdwfl/ChangeLog | 7 | ||||
-rw-r--r-- | libdwfl/dwfl_frame.c | 1 | ||||
-rw-r--r-- | libdwfl/frame_unwind.c | 1 | ||||
-rw-r--r-- | libdwfl/linux-pid-attach.c | 5 | ||||
-rw-r--r-- | tests/ChangeLog | 5 | ||||
-rw-r--r-- | tests/backtrace-child.c | 2 | ||||
-rw-r--r-- | tests/backtrace-dwarf.c | 2 |
13 files changed, 35 insertions, 14 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog index 39390cb8..c6e0e08b 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -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. diff --git a/backends/aarch64_initreg.c b/backends/aarch64_initreg.c index 9706205e..daf6f375 100644 --- a/backends/aarch64_initreg.c +++ b/backends/aarch64_initreg.c @@ -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__ */ diff --git a/backends/arm_initreg.c b/backends/arm_initreg.c index a0a9be94..efcabaf6 100644 --- a/backends/arm_initreg.c +++ b/backends/arm_initreg.c @@ -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__ diff --git a/backends/ppc_initreg.c b/backends/ppc_initreg.c index 64f53793..69d623b9 100644 --- a/backends/ppc_initreg.c +++ b/backends/ppc_initreg.c @@ -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 diff --git a/backends/s390_initreg.c b/backends/s390_initreg.c index b4c4b67c..011305ce 100644 --- a/backends/s390_initreg.c +++ b/backends/s390_initreg.c @@ -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; diff --git a/backends/x86_64_initreg.c b/backends/x86_64_initreg.c index db9216ed..50e90020 100644 --- a/backends/x86_64_initreg.c +++ b/backends/x86_64_initreg.c @@ -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 diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index cc95e067..5c814181 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -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> diff --git a/libdwfl/dwfl_frame.c b/libdwfl/dwfl_frame.c index d6399398..1dc0c8dd 100644 --- a/libdwfl/dwfl_frame.c +++ b/libdwfl/dwfl_frame.c @@ -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 diff --git a/libdwfl/frame_unwind.c b/libdwfl/frame_unwind.c index fb42c1a7..4dc9c432 100644 --- a/libdwfl/frame_unwind.c +++ b/libdwfl/frame_unwind.c @@ -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. */ diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c index adfc7f81..398df96d 100644 --- a/libdwfl/linux-pid-attach.c +++ b/libdwfl/linux-pid-attach.c @@ -31,14 +31,15 @@ #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) { diff --git a/tests/ChangeLog b/tests/ChangeLog index 5f7bcddb..ebcd7bcc 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -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. diff --git a/tests/backtrace-child.c b/tests/backtrace-child.c index cf4547ca..2c27414f 100644 --- a/tests/backtrace-child.c +++ b/tests/backtrace-child.c @@ -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)) diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c index a644c8ab..2dc8a9a2 100644 --- a/tests/backtrace-dwarf.c +++ b/tests/backtrace-dwarf.c @@ -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" |