[PATCH] Fix build for mips targets

Baruch Siach baruch at tkos.co.il
Tue Jan 8 17:59:36 UTC 2019


Commit 917c2ccf3a67 ("Refactor stack pointers") removed
linux/mips/arch_regs.h that defines mips_REG_* macros and struct
mips_regs. These symbols are referenced in mips code. Restore
arch_regs.h to fix the build failure:

syscall.c: In function 'decode_syscall_subcall':
syscall.c:370:7: error: 'mips_REG_SP' undeclared (first use in this function)
       mips_REG_SP + MAX_ARGS * sizeof(tcp->u_arg[0]),
	   ^~~~~~~~~~~
---
 Makefile.am            |  1 +
 linux/mips/arch_regs.c |  4 +---
 linux/mips/arch_regs.h | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 3 deletions(-)
 create mode 100644 linux/mips/arch_regs.h

diff --git a/Makefile.am b/Makefile.am
index 20cbd28588b4..1fd7a7fcb948 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -606,6 +606,7 @@ EXTRA_DIST =				\
 	linux/mips/arch_defs_.h		\
 	linux/mips/arch_getrval2.c	\
 	linux/mips/arch_regs.c		\
+	linux/mips/arch_regs.h		\
 	linux/mips/arch_sigreturn.c	\
 	linux/mips/errnoent.h		\
 	linux/mips/genstub.sh		\
diff --git a/linux/mips/arch_regs.c b/linux/mips/arch_regs.c
index 0874e31efea4..3ed841ee7c1a 100644
--- a/linux/mips/arch_regs.c
+++ b/linux/mips/arch_regs.c
@@ -5,9 +5,7 @@
  * SPDX-License-Identifier: LGPL-2.1-or-later
  */
 
-static struct {
-	uint64_t uregs[38];
-} mips_regs;
+struct mips_regs mips_regs; /* not static */
 
 #define REG_V0 2
 #define REG_A0 4
diff --git a/linux/mips/arch_regs.h b/linux/mips/arch_regs.h
new file mode 100644
index 000000000000..6372badce646
--- /dev/null
+++ b/linux/mips/arch_regs.h
@@ -0,0 +1,18 @@
+struct mips_regs {
+	uint64_t uregs[38];
+};
+
+extern struct mips_regs mips_regs;
+
+#define REG_V0 2
+#define REG_A0 4
+
+#define mips_REG_V0 mips_regs.uregs[REG_V0]
+#define mips_REG_A0 mips_regs.uregs[REG_A0 + 0]
+#define mips_REG_A1 mips_regs.uregs[REG_A0 + 1]
+#define mips_REG_A2 mips_regs.uregs[REG_A0 + 2]
+#define mips_REG_A3 mips_regs.uregs[REG_A0 + 3]
+#define mips_REG_A4 mips_regs.uregs[REG_A0 + 4]
+#define mips_REG_A5 mips_regs.uregs[REG_A0 + 5]
+#define mips_REG_SP mips_regs.uregs[29]
+#define mips_REG_EPC mips_regs.uregs[34]
-- 
2.20.1



More information about the Strace-devel mailing list