]> granicus.if.org Git - strace/commitdiff
m68k: fix build
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 21 Feb 2018 23:03:27 +0000 (23:03 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 21 Feb 2018 23:03:27 +0000 (23:03 +0000)
When <sys/reg.h> is included after <linux/ptrace.h>, the build fails
on m68k with the following diagnostics:

  In file included from /usr/include/linux/ptrace.h:101:0,
                   from ptrace.h:51,
                   from sigreturn.c:2:
  /usr/include/m68k-linux-gnu/sys/reg.h:26:3: error: expected identifier
  before numeric constant
     PT_D1 = 0,
     ^

Apparently, the only architecture where strace needs definitions
provided by <sys/reg.h> is x86_64, other three (m68k, tile, and x86)
are fine with definitions already provided by <linux/ptrace.h>.

Fix the issue by getting rid of <sys/reg.h> and defining necessary
macros in linux/x86_64/arch_regs.h file.

* configure.ac (AC_CHECK_HEADERS): Remove sys/reg.h.
* regs.h: Do not include <sys/reg.h>.
* linux/x86_64/arch_regs.h (R15, R14, R13, R12, RBP, RBX, R11, R10,
R9, R8, RAX, RCX, RDX, RSI, RDI, ORIG_RAX, RIP, CS, EFLAGS, RSP, SS,
FS_BASE, GS_BASE, DS, ES, FS, GS): New macros.
* NEWS: Mention this fix.

Fixes: v4.21~21 ("Include <sys/ptrace.h> early")
NEWS
configure.ac
linux/x86_64/arch_regs.h
regs.h

diff --git a/NEWS b/NEWS
index 0e74e0443a0dd24ed6e5e6b7539418639f04f13c..6c5c9e783d14c86851bf8020205f9a4eeb9477e6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,9 @@
 Noteworthy changes in release ?.?? (????-??-??)
 ===============================================
 
+* Bug fixes
+  * Fixed build on m68k.
+
 Noteworthy changes in release 4.21 (2018-02-13)
 ===============================================
 
index 86b8a8eb8bfba0259eaa30073f462fcfe99b131d..b007a257e5028c329c3dee880f50b5c09fa343a5 100644 (file)
@@ -436,7 +436,6 @@ AC_CHECK_HEADERS(m4_normalize([
        sys/ipc.h
        sys/msg.h
        sys/quota.h
-       sys/reg.h
        sys/sem.h
        sys/shm.h
        sys/signalfd.h
index c2ccee671d4f1f8908b68ba210ea3745c389fb2b..d502ca4bf20271b43aa525748eeb726650fe4d18 100644 (file)
@@ -1,2 +1,31 @@
 extern uint32_t *const i386_esp_ptr;
 extern uint64_t *const x86_64_rsp_ptr;
+
+/* <asm/ptrace.h> does not provide these definitions.  */
+#define R15            0
+#define R14            1
+#define R13            2
+#define R12            3
+#define RBP            4
+#define RBX            5
+#define R11            6
+#define R10            7
+#define R9             8
+#define R8             9
+#define RAX            10
+#define RCX            11
+#define RDX            12
+#define RSI            13
+#define RDI            14
+#define ORIG_RAX       15
+#define RIP            16
+#define CS             17
+#define EFLAGS         18
+#define RSP            19
+#define SS             20
+#define FS_BASE                21
+#define GS_BASE                22
+#define DS             23
+#define ES             24
+#define FS             25
+#define GS             26
diff --git a/regs.h b/regs.h
index d89581d7dd3f6fbc4157e990ac96dbc1e0b030b2..7a044cef8fbf9a4e0c9607bea00d958225700244 100644 (file)
--- a/regs.h
+++ b/regs.h
@@ -2,11 +2,6 @@
 #define STRACE_REGS_H
 
 #include <sys/user.h>
-
-#ifdef HAVE_SYS_REG_H
-# include <sys/reg.h>
-#endif
-
 #include "arch_regs.h"
 
 #endif /* !STRACE_REGS_H */