From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10420 invoked by alias); 15 Feb 2018 14:58:26 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 10401 invoked by uid 89); 15 Feb 2018 14:58:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 15 Feb 2018 14:58:23 +0000 Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 58C8531AF5B8; Thu, 15 Feb 2018 15:58:20 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 1447D42D3F1B; Thu, 15 Feb 2018 15:58:20 +0100 (CET) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [COMMITTED] Include sys/ptrace.h as early as possible. Date: Thu, 15 Feb 2018 14:58:00 -0000 Message-Id: <1518705880-28552-1-git-send-email-mark@klomp.org> X-Mailer: git-send-email 1.8.3.1 X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2018-q1/txt/msg00035.txt.bz2 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 --- backends/ChangeLog | 4 ++++ backends/ppc_initreg.c | 5 +++-- libdwfl/ChangeLog | 4 ++++ libdwfl/linux-pid-attach.c | 2 +- tests/ChangeLog | 6 ++++++ tests/backtrace-child.c | 2 +- tests/backtrace-dwarf.c | 4 ++-- 7 files changed, 21 insertions(+), 6 deletions(-) diff --git a/backends/ChangeLog b/backends/ChangeLog index 098bed7..b525801 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,7 @@ +2018-02-15 Mark Wielaard + + * ppc_initreg.c: Include ptrace.h before system.h and sys/user.h. + 2018-02-09 Joshua Watt * aarch64_retval.c (aarch64_return_value_location): Use FALLTHROUGH diff --git a/backends/ppc_initreg.c b/backends/ppc_initreg.c index 69d623b..3e4432f 100644 --- a/backends/ppc_initreg.c +++ b/backends/ppc_initreg.c @@ -30,13 +30,14 @@ # include #endif -#include "system.h" #include #if defined(__powerpc__) && defined(__linux__) -# include # include +# include #endif +#include "system.h" + #define BACKEND ppc_ #include "libebl_CPU.h" diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 453f1d3..43fc151 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2018-02-15 Mark Wielaard + + * linux-pid-attach.c: Include sys/wait.h after sys/ptrace.h. + 2018-02-09 Joshua Watt * dwfl_report_elf.c (__libdwfl_elf_address_range): Use FALLTHROUGH diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c index e6a5c41..2ab4109 100644 --- a/libdwfl/linux-pid-attach.c +++ b/libdwfl/linux-pid-attach.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -43,6 +42,7 @@ #include #include +#include static bool linux_proc_pid_is_stopped (pid_t pid) diff --git a/tests/ChangeLog b/tests/ChangeLog index eb4576c..cfdd7f9 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2018-02-15 Mark Wielaard + + * 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 * Makefile.am (check_PROGRAMS): Add dwarf-die-addr-die. diff --git a/tests/backtrace-child.c b/tests/backtrace-child.c index 2c27414..9c6ba94 100644 --- a/tests/backtrace-child.c +++ b/tests/backtrace-child.c @@ -81,7 +81,6 @@ #include #include #include -#include #include #include #include @@ -100,6 +99,7 @@ main (int argc __attribute__ ((unused)), char **argv) #else /* __linux__ */ #include +#include #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 2dc8a9a..7ff826c 100644 --- a/tests/backtrace-dwarf.c +++ b/tests/backtrace-dwarf.c @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -25,7 +24,6 @@ #include #include #include -#include #include ELFUTILS_HEADER(dwfl) #ifndef __linux__ @@ -40,6 +38,8 @@ main (int argc __attribute__ ((unused)), char **argv) #else /* __linux__ */ #include +#include +#include #define main cleanup_13_main #include "cleanup-13.c" -- 1.8.3.1