summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-support/libunwind/libunwind/0001-src-Gtrace-remove-unguarded-print-calls.patch52
-rw-r--r--meta/recipes-support/libunwind/libunwind/0001-tests-Garm64-test-sve-signal-check-that-SVE-is-prese.patch73
-rw-r--r--meta/recipes-support/libunwind/libunwind/0002-coredump-use-glibc-or-musl-register-names-as-appropr.patch (renamed from meta/recipes-support/libunwind/libunwind/mips-coredump-register.patch)23
-rw-r--r--meta/recipes-support/libunwind/libunwind/0003-Fixed-miscompilation-of-unw_getcontext-on-ARM.patch27
-rw-r--r--meta/recipes-support/libunwind/libunwind/0004-Rework-inline-aarch64-as-for-setcontext.patch163
-rw-r--r--meta/recipes-support/libunwind/libunwind/0005-Handle-musl-on-PPC32.patch88
-rw-r--r--meta/recipes-support/libunwind/libunwind/0005-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch247
-rw-r--r--meta/recipes-support/libunwind/libunwind/mips-byte-order.patch2
-rw-r--r--meta/recipes-support/libunwind/libunwind_1.6.2.bb50
-rw-r--r--meta/recipes-support/libunwind/libunwind_1.8.1.bb49
10 files changed, 414 insertions, 360 deletions
diff --git a/meta/recipes-support/libunwind/libunwind/0001-src-Gtrace-remove-unguarded-print-calls.patch b/meta/recipes-support/libunwind/libunwind/0001-src-Gtrace-remove-unguarded-print-calls.patch
deleted file mode 100644
index 5840c2b4f6..0000000000
--- a/meta/recipes-support/libunwind/libunwind/0001-src-Gtrace-remove-unguarded-print-calls.patch
+++ /dev/null
@@ -1,52 +0,0 @@
1From 9b27fa9bcd5cadd4c841c42710f41a090377e531 Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@arm.com>
3Date: Fri, 24 Mar 2023 16:18:44 +0000
4Subject: [PATCH] src/Gtrace: remove unguarded print() calls
5
6There is a use of printf() without #include stdio.h in src/arm/Gtrace.c,
7which results in a compiler error if clang 16 is used:
8
9src/arm/Gtrace.c:529:7: error: call to undeclared library function
10'printf' with type 'int (const char *, ...)'; ISO C99 and later do not
11support implicit function declarations [-Wimplicit-function-declaration]
12
13Replace the printf("XXX") with a Dprintf, so it doesn't pull stdio in
14unless in a debug build, and reword the message to be clearer.
15
16Also there is another printf("XXX") inside a FreeBSD-specific block in
17the UNW_ARM_FRAME_SIGRETURN case, replace this with a #error as the code
18needs to be implemented.
19
20Fixes #482.
21
22Upstream-Status: Backport [9b27fa9bcd5cadd4c841c42710f41a090377e531]
23Signed-off-by: Ross Burton <ross.burton@arm.com>
24---
25 src/arm/Gtrace.c | 4 ++--
26 1 file changed, 2 insertions(+), 2 deletions(-)
27
28diff --git a/src/arm/Gtrace.c b/src/arm/Gtrace.c
29index 51fc281d..9e0f25af 100644
30--- a/src/arm/Gtrace.c
31+++ b/src/arm/Gtrace.c
32@@ -514,7 +514,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
33 if (likely(ret >= 0))
34 ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_LR_OFF, lr);
35 #elif defined(__FreeBSD__)
36- printf("XXX\n");
37+ #error implement UNW_ARM_FRAME_SIGRETURN on FreeBSD
38 #endif
39
40 /* Resume stack at signal restoration point. The stack is not
41@@ -526,7 +526,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
42 break;
43
44 case UNW_ARM_FRAME_SYSCALL:
45- printf("XXX1\n");
46+ Dprintf ("%s: implement me\n", __FUNCTION__);
47 break;
48
49 default:
50--
512.34.1
52
diff --git a/meta/recipes-support/libunwind/libunwind/0001-tests-Garm64-test-sve-signal-check-that-SVE-is-prese.patch b/meta/recipes-support/libunwind/libunwind/0001-tests-Garm64-test-sve-signal-check-that-SVE-is-prese.patch
new file mode 100644
index 0000000000..f7af9a3fce
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind/0001-tests-Garm64-test-sve-signal-check-that-SVE-is-prese.patch
@@ -0,0 +1,73 @@
1From 2f03399911abdd549237fa2db64a4a8311fe67dc Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@arm.com>
3Date: Mon, 15 Jan 2024 16:59:14 +0000
4Subject: [PATCH 1/4] tests/Garm64-test-sve-signal: check that SVE is present
5 before running tests
6
7If the compiler supports -march=armv8-a+sve then those options are used
8to build this test, but all that needs is a sufficiently new compiler.
9
10This then results in the __ARM_FEATURE_SVE check always passing, because
11SVE is explicitly enabled.
12
13However it's perfectly possible for the compiler to support +sve but the
14machine running the code to not, which results with the test crashing
15with "Illegal instruction".
16
17Handle this case by checking HWCAP for SVE support, and skipping the
18test unless we know it is available. This check is Linux-specific at
19present, but the logic is easily extended.
20
21Upstream-Status: Backport
22Signed-off-by: Ross Burton <ross.burton@arm.com>
23---
24 tests/Garm64-test-sve-signal.c | 19 +++++++++++++++++++
25 1 file changed, 19 insertions(+)
26
27diff --git a/tests/Garm64-test-sve-signal.c b/tests/Garm64-test-sve-signal.c
28index 52cb9ac6..cf66b3f1 100644
29--- a/tests/Garm64-test-sve-signal.c
30+++ b/tests/Garm64-test-sve-signal.c
31@@ -9,11 +9,16 @@
32 #include <libunwind.h>
33 #include <signal.h>
34 #include <stdio.h>
35+#include <stdbool.h>
36 #include <stdlib.h>
37 #include <string.h>
38 #include <time.h>
39 #include <unistd.h>
40
41+#if defined(__linux__)
42+#include <sys/auxv.h>
43+#endif
44+
45 int64_t z[100];
46
47 void signal_handler(int signum)
48@@ -96,8 +101,22 @@ int64_t square(svint64_t z0)
49 return res;
50 }
51
52+bool has_sve(void) {
53+#if defined(__linux__)
54+ return (getauxval(AT_HWCAP) & HWCAP_SVE) ? true : false;
55+#else
56+ printf("Cannot determine if SVE is present, assuming it is not\n");
57+ return false;
58+#endif
59+}
60+
61 int main()
62 {
63+ if (!has_sve()) {
64+ printf("SVE not available, skipping\n");
65+ return 77;
66+ }
67+
68 signal(SIGUSR1, signal_handler);
69 for (unsigned int i = 0; i < sizeof(z) / sizeof(z[0]); ++i)
70 z[i] = rand();
71--
722.34.1
73
diff --git a/meta/recipes-support/libunwind/libunwind/mips-coredump-register.patch b/meta/recipes-support/libunwind/libunwind/0002-coredump-use-glibc-or-musl-register-names-as-appropr.patch
index 68adcd1d71..f458bc3c6f 100644
--- a/meta/recipes-support/libunwind/libunwind/mips-coredump-register.patch
+++ b/meta/recipes-support/libunwind/libunwind/0002-coredump-use-glibc-or-musl-register-names-as-appropr.patch
@@ -1,24 +1,27 @@
1From 7750e2a29b084ee033acc82abab410035e220d3f Mon Sep 17 00:00:00 2001 1From 2a5473a31c6b02e9c49d688691e848d6281ffd2e Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@arm.com> 2From: Ross Burton <ross.burton@arm.com>
3Date: Tue, 16 Jan 2024 18:21:26 +0000 3Date: Tue, 16 Jan 2024 18:21:26 +0000
4Subject: [PATCH 1/2] coredump-mips-register 4Subject: [PATCH 2/4] coredump: use glibc or musl register names as appropriate
5 on MIPS
5 6
6glibc and musl have different names for the registers, add a 7glibc has register macros of the form EF_REGx, but musl uses EF_Rx.
7macro that generates the names appropriately.
8 8
9Upstream-Status: Pending 9Handle this by using a macro to use the correct names.
10Signed-off-by: Ross Burton <ross.burton@arm.com> 10
11Closes #708.
11 12
13Upstream-Status: Backport
14Signed-off-by: Ross Burton <ross.burton@arm.com>
12--- 15---
13 src/coredump/_UCD_access_reg_linux.c | 69 ++++++++++++++++------------ 16 src/coredump/_UCD_access_reg_linux.c | 69 ++++++++++++++++------------
14 1 file changed, 39 insertions(+), 30 deletions(-) 17 1 file changed, 39 insertions(+), 30 deletions(-)
15 18
16diff --git a/src/coredump/_UCD_access_reg_linux.c b/src/coredump/_UCD_access_reg_linux.c 19diff --git a/src/coredump/_UCD_access_reg_linux.c b/src/coredump/_UCD_access_reg_linux.c
17index 27eef123..beefdb47 100644 20index 302f7bdf..05100ed6 100644
18--- a/src/coredump/_UCD_access_reg_linux.c 21--- a/src/coredump/_UCD_access_reg_linux.c
19+++ b/src/coredump/_UCD_access_reg_linux.c 22+++ b/src/coredump/_UCD_access_reg_linux.c
20@@ -67,38 +67,47 @@ _UCD_access_reg (unw_addr_space_t as, 23@@ -100,38 +100,47 @@ _UCD_access_reg (unw_addr_space_t as UNUSED,
21 goto badreg; 24 };
22 #else 25 #else
23 #if defined(UNW_TARGET_MIPS) 26 #if defined(UNW_TARGET_MIPS)
24+ 27+
@@ -94,7 +97,7 @@ index 27eef123..beefdb47 100644
94+ [UNW_MIPS_R31] = EF_REG(31), 97+ [UNW_MIPS_R31] = EF_REG(31),
95 [UNW_MIPS_PC] = EF_CP0_EPC, 98 [UNW_MIPS_PC] = EF_CP0_EPC,
96 }; 99 };
97 #elif defined(UNW_TARGET_X86) 100 #elif defined(UNW_TARGET_S390X)
98-- 101--
992.34.1 1022.34.1
100 103
diff --git a/meta/recipes-support/libunwind/libunwind/0003-Fixed-miscompilation-of-unw_getcontext-on-ARM.patch b/meta/recipes-support/libunwind/libunwind/0003-Fixed-miscompilation-of-unw_getcontext-on-ARM.patch
new file mode 100644
index 0000000000..19bdd858f7
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind/0003-Fixed-miscompilation-of-unw_getcontext-on-ARM.patch
@@ -0,0 +1,27 @@
1From e5216c3fb1fa8d60a18c68e4749a3ff902f6678b Mon Sep 17 00:00:00 2001
2From: Ian Zborovsky <ian@veego.io>
3Date: Mon, 6 May 2024 02:01:19 +0300
4Subject: [PATCH 3/4] Fixed miscompilation of unw_getcontext() on ARM
5
6Upstream-Status: Backport
7Signed-off-by: Ross Burton <ross.burton@arm.com>
8---
9 include/libunwind-arm.h | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/include/libunwind-arm.h b/include/libunwind-arm.h
13index 6cfa577d..6643a185 100644
14--- a/include/libunwind-arm.h
15+++ b/include/libunwind-arm.h
16@@ -288,7 +288,7 @@ unw_tdep_context_t;
17 "mov r0, #0\n\t" \
18 "stmia %[base]!, {r0-r15}\n\t" \
19 VSTMIA \
20- : [r0] "=r" (r0) : [base] "r" (unw_base) : "memory"); \
21+ : [r0] "=r" (r0), [base] "+r" (unw_base) : : "memory"); \
22 (int)r0; })
23 #else /* __thumb__ */
24 #define unw_tdep_getcontext(uc) ({ \
25--
262.34.1
27
diff --git a/meta/recipes-support/libunwind/libunwind/0004-Rework-inline-aarch64-as-for-setcontext.patch b/meta/recipes-support/libunwind/libunwind/0004-Rework-inline-aarch64-as-for-setcontext.patch
new file mode 100644
index 0000000000..005a077028
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind/0004-Rework-inline-aarch64-as-for-setcontext.patch
@@ -0,0 +1,163 @@
1From a832070f3665d29a8a06652c15f94d144c24ac69 Mon Sep 17 00:00:00 2001
2From: Stephen Webb <swebb@blackberry.com>
3Date: Mon, 22 Apr 2024 15:56:54 -0400
4Subject: [PATCH 4/5] Rework inline aarch64 as for setcontext
5
6Modern GC and clang were barfing on the inline asm constraints for the
7aarch64-linux setcontext() replacement. Reformulated the asm code to
8reduce the required constraints.
9
10Upstream-Status: Backport
11Signed-off-by: Ross Burton <ross.burton@arm.com>
12---
13 src/aarch64/Gos-linux.c | 115 +++++++++++++++++++++-------------------
14 1 file changed, 61 insertions(+), 54 deletions(-)
15
16diff --git a/src/aarch64/Gos-linux.c b/src/aarch64/Gos-linux.c
17index 7cd8c879..1e494962 100644
18--- a/src/aarch64/Gos-linux.c
19+++ b/src/aarch64/Gos-linux.c
20@@ -2,6 +2,7 @@
21 Copyright (C) 2008 CodeSourcery
22 Copyright (C) 2011-2013 Linaro Limited
23 Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
24+ Copyright 2024 Stephen M. Webb <swebb@blackberry.com>
25
26 This file is part of libunwind.
27
28@@ -28,6 +29,28 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
30 #ifndef UNW_REMOTE_ONLY
31
32+/* Magic constants generated from gen-offsets.c */
33+#define SC_R0_OFF "8"
34+#define SC_R2_OFF "24"
35+#define SC_R18_OFF "152"
36+#define SC_R20_OFF "168"
37+#define SC_R22_OFF "184"
38+#define SC_R24_OFF "200"
39+#define SC_R26_OFF "216"
40+#define SC_R28_OFF "232"
41+#define SC_R30_OFF "248"
42+
43+#define FP_R08_OFF "80"
44+#define FP_R09_OFF "88"
45+#define FP_R10_OFF "96"
46+#define FP_R11_OFF "104"
47+#define FP_R12_OFF "112"
48+#define FP_R13_OFF "120"
49+#define FP_R14_OFF "128"
50+#define FP_R15_OFF "136"
51+
52+#define SC_SP_OFF "0x100"
53+
54 HIDDEN int
55 aarch64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
56 {
57@@ -36,65 +59,49 @@ aarch64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
58
59 if (c->sigcontext_format == AARCH64_SCF_NONE)
60 {
61+
62+ /*
63+ * This is effectively the old POSIX setcontext().
64+ *
65+ * This inline asm is broken up to use local scratch registers for the
66+ * uc_mcontext.regs and FPCTX base addresses because newer versions of GCC
67+ * and clang barf on too many constraints (gh-702) when the C array
68+ * elements are used directly.
69+ *
70+ * Clobbers aren't required for the inline asm because they just convince
71+ * the compiler to save those registers and they never get restored
72+ * becauise the asm ends with a plain ol' ret.
73+ */
74+ register void* uc_mcontext __asm__ ("x5") = (void*) &uc->uc_mcontext;
75+ register void* fpctx __asm__ ("x4") = (void*) GET_FPCTX(uc);
76+
77 /* Since there are no signals involved here we restore EH and non scratch
78 registers only. */
79 __asm__ __volatile__ (
80- "ldr x0, %[x0]\n\t"
81- "ldr x1, %[x1]\n\t"
82- "ldr x2, %[x2]\n\t"
83- "ldr x3, %[x3]\n\t"
84- "ldr x19, %[x19]\n\t"
85- "ldr x20, %[x20]\n\t"
86- "ldr x21, %[x21]\n\t"
87- "ldr x22, %[x22]\n\t"
88- "ldr x23, %[x23]\n\t"
89- "ldr x24, %[x24]\n\t"
90- "ldr x25, %[x25]\n\t"
91- "ldr x26, %[x26]\n\t"
92- "ldr x27, %[x27]\n\t"
93- "ldr x28, %[x28]\n\t"
94- "ldr x29, %[x29]\n\t"
95- "ldr x30, %[x30]\n\t"
96- "ldr d8, %[d8]\n\t"
97- "ldr d9, %[d9]\n\t"
98- "ldr d10, %[d10]\n\t"
99- "ldr d11, %[d11]\n\t"
100- "ldr d12, %[d12]\n\t"
101- "ldr d13, %[d13]\n\t"
102- "ldr d14, %[d14]\n\t"
103- "ldr d15, %[d15]\n\t"
104- "ldr x5, %[sp]\n\t"
105+ "ldp x0, x1, [x5, " SC_R0_OFF "]\n\t"
106+ "ldp x2, x3, [x5, " SC_R2_OFF "]\n\t"
107+ "ldp x18, x19, [x5, " SC_R18_OFF "]\n\t"
108+ "ldp x20, x21, [x5, " SC_R20_OFF "]\n\t"
109+ "ldp x22, x23, [x5, " SC_R22_OFF "]\n\t"
110+ "ldp x24, x25, [x5, " SC_R24_OFF "]\n\t"
111+ "ldp x26, x27, [x5, " SC_R26_OFF "]\n\t"
112+ "ldp x28, x29, [x5, " SC_R28_OFF "]\n\t"
113+ "ldr x30, [x5, " SC_R30_OFF "]\n\t"
114+ "ldr d8, [x4, " FP_R08_OFF "]\n\t"
115+ "ldr d9, [x4, " FP_R09_OFF "]\n\t"
116+ "ldr d10, [x4, " FP_R10_OFF "]\n\t"
117+ "ldr d11, [x4, " FP_R11_OFF "]\n\t"
118+ "ldr d12, [x4, " FP_R12_OFF "]\n\t"
119+ "ldr d13, [x4, " FP_R13_OFF "]\n\t"
120+ "ldr d14, [x4, " FP_R14_OFF "]\n\t"
121+ "ldr d15, [x4, " FP_R15_OFF "]\n\t"
122+ "ldr x5, [x5, " SC_SP_OFF "]\n\t"
123 "mov sp, x5\n\t"
124 "ret\n"
125- :
126- : [x0] "m"(uc->uc_mcontext.regs[0]),
127- [x1] "m"(uc->uc_mcontext.regs[1]),
128- [x2] "m"(uc->uc_mcontext.regs[2]),
129- [x3] "m"(uc->uc_mcontext.regs[3]),
130- [x19] "m"(uc->uc_mcontext.regs[19]),
131- [x20] "m"(uc->uc_mcontext.regs[20]),
132- [x21] "m"(uc->uc_mcontext.regs[21]),
133- [x22] "m"(uc->uc_mcontext.regs[22]),
134- [x23] "m"(uc->uc_mcontext.regs[23]),
135- [x24] "m"(uc->uc_mcontext.regs[24]),
136- [x25] "m"(uc->uc_mcontext.regs[25]),
137- [x26] "m"(uc->uc_mcontext.regs[26]),
138- [x27] "m"(uc->uc_mcontext.regs[27]),
139- [x28] "m"(uc->uc_mcontext.regs[28]),
140- [x29] "m"(uc->uc_mcontext.regs[29]), /* FP */
141- [x30] "m"(uc->uc_mcontext.regs[30]), /* LR */
142- [d8] "m"(GET_FPCTX(uc)->vregs[8]),
143- [d9] "m"(GET_FPCTX(uc)->vregs[9]),
144- [d10] "m"(GET_FPCTX(uc)->vregs[10]),
145- [d11] "m"(GET_FPCTX(uc)->vregs[11]),
146- [d12] "m"(GET_FPCTX(uc)->vregs[12]),
147- [d13] "m"(GET_FPCTX(uc)->vregs[13]),
148- [d14] "m"(GET_FPCTX(uc)->vregs[14]),
149- [d15] "m"(GET_FPCTX(uc)->vregs[15]),
150- [sp] "m"(uc->uc_mcontext.sp)
151- : "x0", "x1", "x2", "x3", "x19", "x20", "x21", "x22", "x23", "x24",
152- "x25", "x26", "x27", "x28", "x29", "x30"
153- );
154+ :
155+ : [uc_mcontext] "r"(uc_mcontext),
156+ [fpctx] "r"(fpctx)
157+ );
158 }
159 else
160 {
161--
1622.34.1
163
diff --git a/meta/recipes-support/libunwind/libunwind/0005-Handle-musl-on-PPC32.patch b/meta/recipes-support/libunwind/libunwind/0005-Handle-musl-on-PPC32.patch
new file mode 100644
index 0000000000..7cad7a5b75
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind/0005-Handle-musl-on-PPC32.patch
@@ -0,0 +1,88 @@
1From 7bd4fbdea43310e52feb57fb5afab6bec798cc99 Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@arm.com>
3Date: Wed, 17 Jan 2024 16:28:39 +0000
4Subject: [PATCH 5/5] Handle musl on PPC32
5
6On Linux, glibc and musl disagree over the layout of the ucontext_t
7structure. For more details, see the musl mailing list:
8
9https://www.openwall.com/lists/musl/2018/02/22/1
10
11Add conditionals to handle both the glibc and musl layout of the
12structures.
13
14Closes #709.
15
16Upstream-Status: Submitted [https://github.com/libunwind/libunwind/pull/710]
17Signed-off-by: Ross Burton <ross.burton@arm.com>
18---
19 src/ppc32/Ginit.c | 13 ++++++++++---
20 src/ppc32/ucontext_i.h | 5 +++++
21 2 files changed, 15 insertions(+), 3 deletions(-)
22
23diff --git a/src/ppc32/Ginit.c b/src/ppc32/Ginit.c
24index 9444cbb8..5e94ed8a 100644
25--- a/src/ppc32/Ginit.c
26+++ b/src/ppc32/Ginit.c
27@@ -42,6 +42,13 @@ static struct unw_addr_space local_addr_space;
28
29 unw_addr_space_t unw_local_addr_space = &local_addr_space;
30
31+/* glibc and musl disagree over the layout of this struct */
32+#ifdef __GLIBC__
33+#define _UC_MCONTEXT_REGS(x) x->uc_mcontext.uc_regs
34+#else
35+#define _UC_MCONTEXT_REGS(x) x->uc_regs
36+#endif
37+
38 static void *
39 uc_addr (ucontext_t *uc, int reg)
40 {
41@@ -49,7 +56,7 @@ uc_addr (ucontext_t *uc, int reg)
42
43 if ((unsigned) (reg - UNW_PPC32_R0) < 32)
44 #if defined(__linux__)
45- addr = &uc->uc_mcontext.uc_regs->gregs[reg - UNW_PPC32_R0];
46+ addr = _UC_MCONTEXT_REGS(&uc)->gregs[reg - UNW_PPC32_R0];
47 #elif defined(__FreeBSD__)
48 addr = &uc->uc_mcontext.mc_gpr[reg - UNW_PPC32_R0];
49 #endif
50@@ -58,7 +65,7 @@ uc_addr (ucontext_t *uc, int reg)
51 if ( ((unsigned) (reg - UNW_PPC32_F0) < 32) &&
52 ((unsigned) (reg - UNW_PPC32_F0) >= 0) )
53 #if defined(__linux__)
54- addr = &uc->uc_mcontext.uc_regs->fpregs.fpregs[reg - UNW_PPC32_F0];
55+ addr = _UC_MCONTEXT_REGS(&uc)->fpregs.fpregs[reg - UNW_PPC32_F0];
56 #elif defined(__FreeBSD__)
57 addr = &uc->uc_mcontext.mc_fpreg[reg - UNW_PPC32_F0];
58 #endif
59@@ -85,7 +92,7 @@ uc_addr (ucontext_t *uc, int reg)
60 return NULL;
61 }
62 #if defined(__linux__)
63- addr = &uc->uc_mcontext.uc_regs->gregs[gregs_idx];
64+ addr = _UC_MCONTEXT_REGS(&uc)->gregs[gregs_idx];
65 #elif defined(__FreeBSD__)
66 addr = &uc->uc_mcontext.mc_gpr[gregs_idx];
67 #endif
68diff --git a/src/ppc32/ucontext_i.h b/src/ppc32/ucontext_i.h
69index ee93c697..cfd8fe0e 100644
70--- a/src/ppc32/ucontext_i.h
71+++ b/src/ppc32/ucontext_i.h
72@@ -44,8 +44,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
73 //#define MQ_IDX 36
74 #define LINK_IDX 36
75
76+#ifdef __GLIBC__
77 #define _UC_MCONTEXT_GPR(x) ( ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[x] - (void *)&dmy_ctxt) )
78 #define _UC_MCONTEXT_FPR(x) ( ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[x] - (void *)&dmy_ctxt) )
79+#else
80+#define _UC_MCONTEXT_GPR(x) ( ((void *)&dmy_ctxt.uc_regs->gregs[x] - (void *)&dmy_ctxt) )
81+#define _UC_MCONTEXT_FPR(x) ( ((void *)&dmy_ctxt.uc_regs->fpregs.fpregs[x] - (void *)&dmy_ctxt) )
82+#endif
83
84 /* These are dummy structures used only for obtaining the offsets of the
85 various structure members. */
86--
872.34.1
88
diff --git a/meta/recipes-support/libunwind/libunwind/0005-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch b/meta/recipes-support/libunwind/libunwind/0005-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch
deleted file mode 100644
index e58a71b741..0000000000
--- a/meta/recipes-support/libunwind/libunwind/0005-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch
+++ /dev/null
@@ -1,247 +0,0 @@
1From 24c751f9d21e892a9833e1b70a696b07872b0f7f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 9 Jul 2016 01:07:53 +0000
4Subject: [PATCH] ppc32: Consider ucontext mismatches between glibc and
5
6 musl
7
8This helps in porting libunwind onto musl based systems
9ptrace.h change is required again an error that surfaces
10with musl
11
12/mnt/oe/openembedded-core/build/tmp-musl/sysroots/qemuppc/usr/include/asm/ptrace.h:31:8: error: redefinition of 'struct pt_regs'
13 struct pt_regs {
14 ^~~~~~~
15In file included from /mnt/oe/openembedded-core/build/tmp-musl/sysroots/qemuppc/usr/include/sys/user.h:11:0,
16 from /mnt/oe/openembedded-core/build/tmp-musl/sysroots/qemuppc/usr/include/sys/procfs.h:9,
17 from ../../git/src/ptrace/_UPT_internal.h:40,
18 from ../../git/src/ptrace/_UPT_reg_offset.c:27:
19/mnt/oe/openembedded-core/build/tmp-musl/sysroots/qemuppc/usr/include/bits/user.h:1:8: note: originally defined here
20 struct pt_regs {
21 ^~~~~~~
22
23Upstream-Status: Pending
24Signed-off-by: Khem Raj <raj.khem@gmail.com>
25
26---
27 src/ppc32/Ginit.c | 6 +-
28 src/ppc32/ucontext_i.h | 158 ++++++++++++++++++-----------------
29 src/ptrace/_UPT_reg_offset.c | 7 ++
30 3 files changed, 92 insertions(+), 79 deletions(-)
31
32diff --git a/src/ppc32/Ginit.c b/src/ppc32/Ginit.c
33index 7b45455..f8d6886 100644
34--- a/src/ppc32/Ginit.c
35+++ b/src/ppc32/Ginit.c
36@@ -48,12 +48,12 @@ uc_addr (ucontext_t *uc, int reg)
37 void *addr;
38
39 if ((unsigned) (reg - UNW_PPC32_R0) < 32)
40- addr = &uc->uc_mcontext.uc_regs->gregs[reg - UNW_PPC32_R0];
41+ addr = &uc->GET_UC_REGS->gregs[reg - UNW_PPC32_R0];
42
43 else
44 if ( ((unsigned) (reg - UNW_PPC32_F0) < 32) &&
45 ((unsigned) (reg - UNW_PPC32_F0) >= 0) )
46- addr = &uc->uc_mcontext.uc_regs->fpregs.fpregs[reg - UNW_PPC32_F0];
47+ addr = &uc->GET_UC_REGS->fpregs.fpregs[reg - UNW_PPC32_F0];
48
49 else
50 {
51@@ -76,7 +76,7 @@ uc_addr (ucontext_t *uc, int reg)
52 default:
53 return NULL;
54 }
55- addr = &uc->uc_mcontext.uc_regs->gregs[gregs_idx];
56+ addr = &uc->GET_UC_REGS->gregs[gregs_idx];
57 }
58 return addr;
59 }
60diff --git a/src/ppc32/ucontext_i.h b/src/ppc32/ucontext_i.h
61index c6ba806..b79f15c 100644
62--- a/src/ppc32/ucontext_i.h
63+++ b/src/ppc32/ucontext_i.h
64@@ -46,83 +46,89 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
65 various structure members. */
66 static ucontext_t dmy_ctxt UNUSED;
67
68-#define UC_MCONTEXT_GREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[0] - (void *)&dmy_ctxt)
69-#define UC_MCONTEXT_GREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[1] - (void *)&dmy_ctxt)
70-#define UC_MCONTEXT_GREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[2] - (void *)&dmy_ctxt)
71-#define UC_MCONTEXT_GREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[3] - (void *)&dmy_ctxt)
72-#define UC_MCONTEXT_GREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[4] - (void *)&dmy_ctxt)
73-#define UC_MCONTEXT_GREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[5] - (void *)&dmy_ctxt)
74-#define UC_MCONTEXT_GREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[6] - (void *)&dmy_ctxt)
75-#define UC_MCONTEXT_GREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[7] - (void *)&dmy_ctxt)
76-#define UC_MCONTEXT_GREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[8] - (void *)&dmy_ctxt)
77-#define UC_MCONTEXT_GREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[9] - (void *)&dmy_ctxt)
78-#define UC_MCONTEXT_GREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[10] - (void *)&dmy_ctxt)
79-#define UC_MCONTEXT_GREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[11] - (void *)&dmy_ctxt)
80-#define UC_MCONTEXT_GREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[12] - (void *)&dmy_ctxt)
81-#define UC_MCONTEXT_GREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[13] - (void *)&dmy_ctxt)
82-#define UC_MCONTEXT_GREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[14] - (void *)&dmy_ctxt)
83-#define UC_MCONTEXT_GREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[15] - (void *)&dmy_ctxt)
84-#define UC_MCONTEXT_GREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[16] - (void *)&dmy_ctxt)
85-#define UC_MCONTEXT_GREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[17] - (void *)&dmy_ctxt)
86-#define UC_MCONTEXT_GREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[18] - (void *)&dmy_ctxt)
87-#define UC_MCONTEXT_GREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[19] - (void *)&dmy_ctxt)
88-#define UC_MCONTEXT_GREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[20] - (void *)&dmy_ctxt)
89-#define UC_MCONTEXT_GREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[21] - (void *)&dmy_ctxt)
90-#define UC_MCONTEXT_GREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[22] - (void *)&dmy_ctxt)
91-#define UC_MCONTEXT_GREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[23] - (void *)&dmy_ctxt)
92-#define UC_MCONTEXT_GREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[24] - (void *)&dmy_ctxt)
93-#define UC_MCONTEXT_GREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[25] - (void *)&dmy_ctxt)
94-#define UC_MCONTEXT_GREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[26] - (void *)&dmy_ctxt)
95-#define UC_MCONTEXT_GREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[27] - (void *)&dmy_ctxt)
96-#define UC_MCONTEXT_GREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[28] - (void *)&dmy_ctxt)
97-#define UC_MCONTEXT_GREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[29] - (void *)&dmy_ctxt)
98-#define UC_MCONTEXT_GREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[30] - (void *)&dmy_ctxt)
99-#define UC_MCONTEXT_GREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[31] - (void *)&dmy_ctxt)
100+#ifdef __GLIBC__
101+#define GET_UC_REGS uc_mcontext.uc_regs
102+#else
103+#define GET_UC_REGS uc_regs
104+#endif
105+
106+#define UC_MCONTEXT_GREGS_R0 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[0] - (void *)&dmy_ctxt)
107+#define UC_MCONTEXT_GREGS_R1 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[1] - (void *)&dmy_ctxt)
108+#define UC_MCONTEXT_GREGS_R2 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[2] - (void *)&dmy_ctxt)
109+#define UC_MCONTEXT_GREGS_R3 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[3] - (void *)&dmy_ctxt)
110+#define UC_MCONTEXT_GREGS_R4 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[4] - (void *)&dmy_ctxt)
111+#define UC_MCONTEXT_GREGS_R5 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[5] - (void *)&dmy_ctxt)
112+#define UC_MCONTEXT_GREGS_R6 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[6] - (void *)&dmy_ctxt)
113+#define UC_MCONTEXT_GREGS_R7 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[7] - (void *)&dmy_ctxt)
114+#define UC_MCONTEXT_GREGS_R8 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[8] - (void *)&dmy_ctxt)
115+#define UC_MCONTEXT_GREGS_R9 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[9] - (void *)&dmy_ctxt)
116+#define UC_MCONTEXT_GREGS_R10 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[10] - (void *)&dmy_ctxt)
117+#define UC_MCONTEXT_GREGS_R11 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[11] - (void *)&dmy_ctxt)
118+#define UC_MCONTEXT_GREGS_R12 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[12] - (void *)&dmy_ctxt)
119+#define UC_MCONTEXT_GREGS_R13 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[13] - (void *)&dmy_ctxt)
120+#define UC_MCONTEXT_GREGS_R14 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[14] - (void *)&dmy_ctxt)
121+#define UC_MCONTEXT_GREGS_R15 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[15] - (void *)&dmy_ctxt)
122+#define UC_MCONTEXT_GREGS_R16 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[16] - (void *)&dmy_ctxt)
123+#define UC_MCONTEXT_GREGS_R17 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[17] - (void *)&dmy_ctxt)
124+#define UC_MCONTEXT_GREGS_R18 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[18] - (void *)&dmy_ctxt)
125+#define UC_MCONTEXT_GREGS_R19 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[19] - (void *)&dmy_ctxt)
126+#define UC_MCONTEXT_GREGS_R20 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[20] - (void *)&dmy_ctxt)
127+#define UC_MCONTEXT_GREGS_R21 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[21] - (void *)&dmy_ctxt)
128+#define UC_MCONTEXT_GREGS_R22 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[22] - (void *)&dmy_ctxt)
129+#define UC_MCONTEXT_GREGS_R23 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[23] - (void *)&dmy_ctxt)
130+#define UC_MCONTEXT_GREGS_R24 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[24] - (void *)&dmy_ctxt)
131+#define UC_MCONTEXT_GREGS_R25 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[25] - (void *)&dmy_ctxt)
132+#define UC_MCONTEXT_GREGS_R26 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[26] - (void *)&dmy_ctxt)
133+#define UC_MCONTEXT_GREGS_R27 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[27] - (void *)&dmy_ctxt)
134+#define UC_MCONTEXT_GREGS_R28 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[28] - (void *)&dmy_ctxt)
135+#define UC_MCONTEXT_GREGS_R29 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[29] - (void *)&dmy_ctxt)
136+#define UC_MCONTEXT_GREGS_R30 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[30] - (void *)&dmy_ctxt)
137+#define UC_MCONTEXT_GREGS_R31 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[31] - (void *)&dmy_ctxt)
138
139-#define UC_MCONTEXT_GREGS_MSR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[MSR_IDX] - (void *)&dmy_ctxt)
140-#define UC_MCONTEXT_GREGS_ORIG_GPR3 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[ORIG_GPR3_IDX] - (void *)&dmy_ctxt)
141-#define UC_MCONTEXT_GREGS_CTR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[CTR_IDX] - (void *)&dmy_ctxt)
142-#define UC_MCONTEXT_GREGS_LINK ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[LINK_IDX] - (void *)&dmy_ctxt)
143-#define UC_MCONTEXT_GREGS_XER ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[XER_IDX] - (void *)&dmy_ctxt)
144-#define UC_MCONTEXT_GREGS_CCR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[CCR_IDX] - (void *)&dmy_ctxt)
145-#define UC_MCONTEXT_GREGS_SOFTE ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[SOFTE_IDX] - (void *)&dmy_ctxt)
146-#define UC_MCONTEXT_GREGS_TRAP ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[TRAP_IDX] - (void *)&dmy_ctxt)
147-#define UC_MCONTEXT_GREGS_DAR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[DAR_IDX] - (void *)&dmy_ctxt)
148-#define UC_MCONTEXT_GREGS_DSISR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[DSISR_IDX] - (void *)&dmy_ctxt)
149-#define UC_MCONTEXT_GREGS_RESULT ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[RESULT_IDX] - (void *)&dmy_ctxt)
150+#define UC_MCONTEXT_GREGS_MSR ((void *)&dmy_ctxt.GET_UC_REGS->gregs[MSR_IDX] - (void *)&dmy_ctxt)
151+#define UC_MCONTEXT_GREGS_ORIG_GPR3 ((void *)&dmy_ctxt.GET_UC_REGS->gregs[ORIG_GPR3_IDX] - (void *)&dmy_ctxt)
152+#define UC_MCONTEXT_GREGS_CTR ((void *)&dmy_ctxt.GET_UC_REGS->gregs[CTR_IDX] - (void *)&dmy_ctxt)
153+#define UC_MCONTEXT_GREGS_LINK ((void *)&dmy_ctxt.GET_UC_REGS->gregs[LINK_IDX] - (void *)&dmy_ctxt)
154+#define UC_MCONTEXT_GREGS_XER ((void *)&dmy_ctxt.GET_UC_REGS->gregs[XER_IDX] - (void *)&dmy_ctxt)
155+#define UC_MCONTEXT_GREGS_CCR ((void *)&dmy_ctxt.GET_UC_REGS->gregs[CCR_IDX] - (void *)&dmy_ctxt)
156+#define UC_MCONTEXT_GREGS_SOFTE ((void *)&dmy_ctxt.GET_UC_REGS->gregs[SOFTE_IDX] - (void *)&dmy_ctxt)
157+#define UC_MCONTEXT_GREGS_TRAP ((void *)&dmy_ctxt.GET_UC_REGS->gregs[TRAP_IDX] - (void *)&dmy_ctxt)
158+#define UC_MCONTEXT_GREGS_DAR ((void *)&dmy_ctxt.GET_UC_REGS->gregs[DAR_IDX] - (void *)&dmy_ctxt)
159+#define UC_MCONTEXT_GREGS_DSISR ((void *)&dmy_ctxt.GET_UC_REGS->gregs[DSISR_IDX] - (void *)&dmy_ctxt)
160+#define UC_MCONTEXT_GREGS_RESULT ((void *)&dmy_ctxt.GET_UC_REGS->gregs[RESULT_IDX] - (void *)&dmy_ctxt)
161
162-#define UC_MCONTEXT_FREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[0] - (void *)&dmy_ctxt)
163-#define UC_MCONTEXT_FREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[1] - (void *)&dmy_ctxt)
164-#define UC_MCONTEXT_FREGS_R2 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[2] - (void *)&dmy_ctxt)
165-#define UC_MCONTEXT_FREGS_R3 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[3] - (void *)&dmy_ctxt)
166-#define UC_MCONTEXT_FREGS_R4 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[4] - (void *)&dmy_ctxt)
167-#define UC_MCONTEXT_FREGS_R5 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[5] - (void *)&dmy_ctxt)
168-#define UC_MCONTEXT_FREGS_R6 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[6] - (void *)&dmy_ctxt)
169-#define UC_MCONTEXT_FREGS_R7 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[7] - (void *)&dmy_ctxt)
170-#define UC_MCONTEXT_FREGS_R8 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[8] - (void *)&dmy_ctxt)
171-#define UC_MCONTEXT_FREGS_R9 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[9] - (void *)&dmy_ctxt)
172-#define UC_MCONTEXT_FREGS_R10 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[10] - (void *)&dmy_ctxt)
173-#define UC_MCONTEXT_FREGS_R11 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[11] - (void *)&dmy_ctxt)
174-#define UC_MCONTEXT_FREGS_R12 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[12] - (void *)&dmy_ctxt)
175-#define UC_MCONTEXT_FREGS_R13 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[13] - (void *)&dmy_ctxt)
176-#define UC_MCONTEXT_FREGS_R14 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[14] - (void *)&dmy_ctxt)
177-#define UC_MCONTEXT_FREGS_R15 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[15] - (void *)&dmy_ctxt)
178-#define UC_MCONTEXT_FREGS_R16 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[16] - (void *)&dmy_ctxt)
179-#define UC_MCONTEXT_FREGS_R17 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[17] - (void *)&dmy_ctxt)
180-#define UC_MCONTEXT_FREGS_R18 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[18] - (void *)&dmy_ctxt)
181-#define UC_MCONTEXT_FREGS_R19 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[19] - (void *)&dmy_ctxt)
182-#define UC_MCONTEXT_FREGS_R20 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[20] - (void *)&dmy_ctxt)
183-#define UC_MCONTEXT_FREGS_R21 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[21] - (void *)&dmy_ctxt)
184-#define UC_MCONTEXT_FREGS_R22 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[22] - (void *)&dmy_ctxt)
185-#define UC_MCONTEXT_FREGS_R23 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[23] - (void *)&dmy_ctxt)
186-#define UC_MCONTEXT_FREGS_R24 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[24] - (void *)&dmy_ctxt)
187-#define UC_MCONTEXT_FREGS_R25 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[25] - (void *)&dmy_ctxt)
188-#define UC_MCONTEXT_FREGS_R26 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[26] - (void *)&dmy_ctxt)
189-#define UC_MCONTEXT_FREGS_R27 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[27] - (void *)&dmy_ctxt)
190-#define UC_MCONTEXT_FREGS_R28 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[28] - (void *)&dmy_ctxt)
191-#define UC_MCONTEXT_FREGS_R29 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[29] - (void *)&dmy_ctxt)
192-#define UC_MCONTEXT_FREGS_R30 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[30] - (void *)&dmy_ctxt)
193-#define UC_MCONTEXT_FREGS_R31 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[31] - (void *)&dmy_ctxt)
194-#define UC_MCONTEXT_FREGS_FPSCR ((void *)&dmy_ctxt.uc_mcontext.uc_regs->fpregs.fpregs[32] - (void *)&dmy_ctxt)
195+#define UC_MCONTEXT_FREGS_R0 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[0] - (void *)&dmy_ctxt)
196+#define UC_MCONTEXT_FREGS_R1 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[1] - (void *)&dmy_ctxt)
197+#define UC_MCONTEXT_FREGS_R2 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[2] - (void *)&dmy_ctxt)
198+#define UC_MCONTEXT_FREGS_R3 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[3] - (void *)&dmy_ctxt)
199+#define UC_MCONTEXT_FREGS_R4 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[4] - (void *)&dmy_ctxt)
200+#define UC_MCONTEXT_FREGS_R5 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[5] - (void *)&dmy_ctxt)
201+#define UC_MCONTEXT_FREGS_R6 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[6] - (void *)&dmy_ctxt)
202+#define UC_MCONTEXT_FREGS_R7 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[7] - (void *)&dmy_ctxt)
203+#define UC_MCONTEXT_FREGS_R8 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[8] - (void *)&dmy_ctxt)
204+#define UC_MCONTEXT_FREGS_R9 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[9] - (void *)&dmy_ctxt)
205+#define UC_MCONTEXT_FREGS_R10 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[10] - (void *)&dmy_ctxt)
206+#define UC_MCONTEXT_FREGS_R11 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[11] - (void *)&dmy_ctxt)
207+#define UC_MCONTEXT_FREGS_R12 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[12] - (void *)&dmy_ctxt)
208+#define UC_MCONTEXT_FREGS_R13 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[13] - (void *)&dmy_ctxt)
209+#define UC_MCONTEXT_FREGS_R14 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[14] - (void *)&dmy_ctxt)
210+#define UC_MCONTEXT_FREGS_R15 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[15] - (void *)&dmy_ctxt)
211+#define UC_MCONTEXT_FREGS_R16 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[16] - (void *)&dmy_ctxt)
212+#define UC_MCONTEXT_FREGS_R17 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[17] - (void *)&dmy_ctxt)
213+#define UC_MCONTEXT_FREGS_R18 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[18] - (void *)&dmy_ctxt)
214+#define UC_MCONTEXT_FREGS_R19 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[19] - (void *)&dmy_ctxt)
215+#define UC_MCONTEXT_FREGS_R20 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[20] - (void *)&dmy_ctxt)
216+#define UC_MCONTEXT_FREGS_R21 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[21] - (void *)&dmy_ctxt)
217+#define UC_MCONTEXT_FREGS_R22 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[22] - (void *)&dmy_ctxt)
218+#define UC_MCONTEXT_FREGS_R23 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[23] - (void *)&dmy_ctxt)
219+#define UC_MCONTEXT_FREGS_R24 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[24] - (void *)&dmy_ctxt)
220+#define UC_MCONTEXT_FREGS_R25 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[25] - (void *)&dmy_ctxt)
221+#define UC_MCONTEXT_FREGS_R26 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[26] - (void *)&dmy_ctxt)
222+#define UC_MCONTEXT_FREGS_R27 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[27] - (void *)&dmy_ctxt)
223+#define UC_MCONTEXT_FREGS_R28 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[28] - (void *)&dmy_ctxt)
224+#define UC_MCONTEXT_FREGS_R29 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[29] - (void *)&dmy_ctxt)
225+#define UC_MCONTEXT_FREGS_R30 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[30] - (void *)&dmy_ctxt)
226+#define UC_MCONTEXT_FREGS_R31 ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[31] - (void *)&dmy_ctxt)
227+#define UC_MCONTEXT_FREGS_FPSCR ((void *)&dmy_ctxt.GET_UC_REGS->fpregs.fpregs[32] - (void *)&dmy_ctxt)
228
229 #endif
230diff --git a/src/ptrace/_UPT_reg_offset.c b/src/ptrace/_UPT_reg_offset.c
231index b7dd3b7..bfaf756 100644
232--- a/src/ptrace/_UPT_reg_offset.c
233+++ b/src/ptrace/_UPT_reg_offset.c
234@@ -27,6 +27,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
235 #include "_UPT_internal.h"
236
237 #include <stddef.h>
238+#if !defined(__GLIBC__)
239+# define pt_regs uapi_pt_regs
240+#endif
241+#include <asm/ptrace.h>
242+#if !defined(__GLIBC__)
243+# undef pt_regs
244+#endif
245
246 #ifdef HAVE_ASM_PTRACE_H
247 # include <asm/ptrace.h>
diff --git a/meta/recipes-support/libunwind/libunwind/mips-byte-order.patch b/meta/recipes-support/libunwind/libunwind/mips-byte-order.patch
index 8848780fd1..3336b79055 100644
--- a/meta/recipes-support/libunwind/libunwind/mips-byte-order.patch
+++ b/meta/recipes-support/libunwind/libunwind/mips-byte-order.patch
@@ -6,7 +6,7 @@ Subject: [PATCH 2/2] byte order
6endian.h on musl/mips can't be included in __ASSEMBLER__ mode, 6endian.h on musl/mips can't be included in __ASSEMBLER__ mode,
7so use the __BYTE_ORDER__ symbol instead. 7so use the __BYTE_ORDER__ symbol instead.
8 8
9Upstream-Status: Pending 9Upstream-Status: Submitted [https://github.com/libunwind/libunwind/pull/816]
10Signed-off-by: Ross Burton <ross.burton@arm.com> 10Signed-off-by: Ross Burton <ross.burton@arm.com>
11--- 11---
12 src/mips/getcontext.S | 3 +-- 12 src/mips/getcontext.S | 3 +--
diff --git a/meta/recipes-support/libunwind/libunwind_1.6.2.bb b/meta/recipes-support/libunwind/libunwind_1.6.2.bb
deleted file mode 100644
index b2e7ec7719..0000000000
--- a/meta/recipes-support/libunwind/libunwind_1.6.2.bb
+++ /dev/null
@@ -1,50 +0,0 @@
1SUMMARY = "Library for obtaining the call-chain of a program"
2DESCRIPTION = "a portable and efficient C programming interface (API) to determine the call-chain of a program"
3HOMEPAGE = "http://www.nongnu.org/libunwind"
4LICENSE = "MIT"
5LIC_FILES_CHKSUM = "file://COPYING;md5=2d80c8ed4062b8339b715f90fa68cc9f"
6DEPENDS += "libatomic-ops"
7DEPENDS:append:libc-musl = " libucontext"
8
9SRC_URI = "http://download.savannah.nongnu.org/releases/libunwind/libunwind-${PV}.tar.gz \
10 file://mips-byte-order.patch \
11 file://mips-coredump-register.patch \
12 file://0005-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch \
13 file://0001-src-Gtrace-remove-unguarded-print-calls.patch \
14 "
15
16SRC_URI[sha256sum] = "4a6aec666991fb45d0889c44aede8ad6eb108071c3554fcdff671f9c94794976"
17
18inherit autotools multilib_header
19
20COMPATIBLE_HOST:riscv32 = "null"
21
22PACKAGECONFIG ??= ""
23PACKAGECONFIG[lzma] = "--enable-minidebuginfo,--disable-minidebuginfo,xz"
24PACKAGECONFIG[zlib] = "--enable-zlibdebuginfo,--disable-zlibdebuginfo,zlib"
25PACKAGECONFIG[latexdocs] = "--enable-documentation, --disable-documentation, latex2man-native"
26
27EXTRA_OECONF = "--enable-static"
28
29# http://errors.yoctoproject.org/Errors/Details/20487/
30ARM_INSTRUCTION_SET:armv4 = "arm"
31ARM_INSTRUCTION_SET:armv5 = "arm"
32
33LDFLAGS += "-Wl,-z,relro,-z,now"
34
35SECURITY_LDFLAGS:append:libc-musl = " -lssp_nonshared"
36CACHED_CONFIGUREVARS:append:libc-musl = " LDFLAGS='${LDFLAGS} -lucontext'"
37
38do_install:append () {
39 oe_multilib_header libunwind.h
40}
41
42BBCLASSEXTEND = "native"
43
44# http://errors.yoctoproject.org/Errors/Build/183144/
45# libunwind-1.6.2/include/tdep-aarch64/libunwind_i.h:123:47: error: passing argument 1 of '_ULaarch64_uc_addr' from incompatible pointer type [-Wincompatible-pointer-types]
46# libunwind-1.6.2/src/aarch64/Ginit.c:348:28: error: initialization of 'unw_tdep_context_t *' from incompatible pointer type 'ucontext_t *' [-Wincompatible-pointer-types]
47# libunwind-1.6.2/src/aarch64/Ginit.c:377:28: error: initialization of 'unw_tdep_context_t *' from incompatible pointer type 'ucontext_t *' [-Wincompatible-pointer-types]
48# libunwind-1.6.2/src/aarch64/Ginit_local.c:51:9: error: assignment to 'ucontext_t *' from incompatible pointer type 'unw_context_t *' {aka 'unw_tdep_context_t *'} [-Wincompatible-pointer-types]
49# libunwind-1.6.2/src/aarch64/Gresume.c:37:28: error: initialization of 'unw_tdep_context_t *' from incompatible pointer type 'ucontext_t *' [-Wincompatible-pointer-types]
50CFLAGS += "-Wno-error=incompatible-pointer-types"
diff --git a/meta/recipes-support/libunwind/libunwind_1.8.1.bb b/meta/recipes-support/libunwind/libunwind_1.8.1.bb
new file mode 100644
index 0000000000..1885da4d09
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind_1.8.1.bb
@@ -0,0 +1,49 @@
1SUMMARY = "Library for obtaining the call-chain of a program"
2DESCRIPTION = "a portable and efficient C programming interface (API) to determine the call-chain of a program"
3HOMEPAGE = "http://www.nongnu.org/libunwind"
4LICENSE = "MIT"
5LIC_FILES_CHKSUM = "file://COPYING;md5=2d80c8ed4062b8339b715f90fa68cc9f"
6DEPENDS:append:libc-musl = " libucontext"
7
8SRC_URI = "https://github.com/libunwind/libunwind/releases/download/v${PV}/${BP}.tar.gz \
9 file://mips-byte-order.patch \
10 file://0001-tests-Garm64-test-sve-signal-check-that-SVE-is-prese.patch \
11 file://0002-coredump-use-glibc-or-musl-register-names-as-appropr.patch \
12 file://0003-Fixed-miscompilation-of-unw_getcontext-on-ARM.patch \
13 file://0004-Rework-inline-aarch64-as-for-setcontext.patch \
14 file://0005-Handle-musl-on-PPC32.patch \
15 "
16
17SRC_URI[sha256sum] = "ddf0e32dd5fafe5283198d37e4bf9decf7ba1770b6e7e006c33e6df79e6a6157"
18
19inherit autotools multilib_header
20
21COMPATIBLE_HOST:riscv32 = "null"
22
23PACKAGECONFIG ??= ""
24PACKAGECONFIG[lzma] = "--enable-minidebuginfo,--disable-minidebuginfo,xz"
25PACKAGECONFIG[zlib] = "--enable-zlibdebuginfo,--disable-zlibdebuginfo,zlib"
26PACKAGECONFIG[latexdocs] = "--enable-documentation, --disable-documentation, latex2man-native"
27
28EXTRA_OECONF = "--enable-static"
29
30# http://errors.yoctoproject.org/Errors/Details/20487/
31ARM_INSTRUCTION_SET:armv4 = "arm"
32ARM_INSTRUCTION_SET:armv5 = "arm"
33
34LDFLAGS += "-Wl,-z,relro,-z,now"
35LDFLAGS:append:powerpc:libc-musl = " -latomic"
36
37SECURITY_LDFLAGS:append:libc-musl = " -lssp_nonshared"
38CACHED_CONFIGUREVARS:append:libc-musl = " LDFLAGS='${LDFLAGS} -lucontext'"
39
40do_install:append () {
41 oe_multilib_header libunwind.h
42}
43
44BBCLASSEXTEND = "native"
45
46# libunwind-1.8.1/src/elfxx.c:205:44: error: passing argument 3 of '_Uppc32_get_func_addr' from incompatible pointer type [-Wincompatible-pointer-types]
47# libunwind-1.8.1/src/elfxx.c:279:52: error: passing argument 3 of '_Uppc32_get_func_addr' from incompatible pointer type [-Wincompatible-pointer-types]
48# and others
49CFLAGS:append:powerpc:libc-musl = " -Wno-error=incompatible-pointer-types"