summaryrefslogtreecommitdiffstats
path: root/package/strace/0002-Fix-build-for-mips-targets.patch
blob: 430d4071bb55dc3db60a3ce8e6c644107c82c168 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 8150854b5dd030a47f601931daf827ca33bc9bd9 Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Tue, 8 Jan 2019 19:52:21 +0200
Subject: [PATCH] Fix build for mips targets

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]),
	   ^~~~~~~~~~~

[ baruch: drop the Makefile.in hunk to avoid autoreconf ]
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
Upstream status:
https://lists.strace.io/pipermail/strace-devel/2019-January/008598.html

 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/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

OpenPOWER on IntegriCloud