Skip to contentSkip to conversation

package/musl: fix conflict with riscv kernel headers

PATCH New Baruch Siach 2 participants 2 messages Aug 8, 2019 – Aug 12, 2019 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/musl: fix conflict with riscv kernel headers

Add two upstream patches fixing musl vs kernel headers conflict. This fixes build of strace for risc64 at it happens to use headers from both sources.

Modify patch #3 to leave a single newline in user.h. Otherwise 'patch -E' in apply-patches.sh deletes user.h instead of leaving it empty.

Fixes (strace):
http://autobuild.buildroot.net/results/ac32e83dc5eb5ce2809fc4b9d11f540dbdae9ed6/

Cc Thomas Petazzoni <[email protected]>

---
v2: Use upstream patch (slightly modified) for user.h

---
 ...-risc64-conflict-with-kernel-headers.patch | 61 ++++++++++++++++
 ...-remove-riscv64-bits-user.h-contents.patch | 69 +++++++++++++++++++
 2 files changed, 130 insertions(+)
 create mode 100644 package/musl/0002-fix-risc64-conflict-with-kernel-headers.patch
 create mode 100644 package/musl/0003-remove-riscv64-bits-user.h-contents.patch
package/musl/0002-fix-risc64-conflict-with-kernel-headers.patch new file +61 -0
new file mode 100644
index 000000000000..8ae7b0200ae5
@@ -0,0 +1,61 @@
+From 8acc688548b27151c45ee8a80f3a0b75f4a761c0 Mon Sep 17 00:00:00 2001
+From: Baruch Siach <[email protected]>
+Date: Tue, 6 Aug 2019 08:51:13 +0300
+Subject: [PATCH] fix risc64 conflict with kernel headers
+
+Rename user registers struct definitions to avoid conflict with the
+asm/ptrace.h kernel header that defines the same structs. Use the
+__riscv_mc prefix as glibc does.
+
+Signed-off-by: Baruch Siach <[email protected]>
+---
+Upstream status: commit 8acc688548b
+
+ arch/riscv64/bits/signal.h | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/arch/riscv64/bits/signal.h b/arch/riscv64/bits/signal.h
+index 4c94a8f02edc..76d7ad80c8cd 100644
+--- a/arch/riscv64/bits/signal.h
++++ b/arch/riscv64/bits/signal.h
+@@ -12,29 +12,29 @@
+ typedef unsigned long greg_t;
+ typedef unsigned long gregset_t[32];
+ 
+-struct __riscv_f_ext_state {
++struct __riscv_mc_f_ext_state {
+ 	unsigned int f[32];
+ 	unsigned int fcsr;
+ };
+ 
+-struct __riscv_d_ext_state {
++struct __riscv_mc_d_ext_state {
+ 	unsigned long long f[32];
+ 	unsigned int fcsr;
+ };
+ 
+-struct __riscv_q_ext_state {
++struct __riscv_mc_q_ext_state {
+ 	unsigned long long f[64] __attribute__((aligned(16)));
+ 	unsigned int fcsr;
+ 	unsigned int reserved[3];
+ };
+ 
+-union __riscv_fp_state {
+-	struct __riscv_f_ext_state f;
+-	struct __riscv_d_ext_state d;
+-	struct __riscv_q_ext_state q;
++union __riscv_mc_fp_state {
++	struct __riscv_mc_f_ext_state f;
++	struct __riscv_mc_d_ext_state d;
++	struct __riscv_mc_q_ext_state q;
+ };
+ 
+-typedef union __riscv_fp_state fpregset_t;
++typedef union __riscv_mc_fp_state fpregset_t;
+ 
+ typedef struct sigcontext {
+ 	gregset_t gregs;
+-- 
+2.20.1
+
package/musl/0003-remove-riscv64-bits-user.h-contents.patch new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/1 package/musl: fix conflict with riscv kernel headers

Quoted 12 lines · On Thu, 8 Aug 2019 21:38:47 +0300 Baruch Siach <[email protected]> wrote:

Add two upstream patches fixing musl vs kernel headers conflict. This fixes build of strace for risc64 at it happens to use headers from both sources.

Modify patch #3 to leave a single newline in user.h. Otherwise 'patch -E' in apply-patches.sh deletes user.h instead of leaving it empty.

Fixes (strace):
http://autobuild.buildroot.net/results/ac32e83dc5eb5ce2809fc4b9d11f540dbdae9ed6/

Cc Thomas Petazzoni <[email protected]>
Quoted 8 lines

---
v2: Use upstream patch (slightly modified) for user.h

---
 ...-risc64-conflict-with-kernel-headers.patch | 61 ++++++++++++++++
 ...-remove-riscv64-bits-user.h-contents.patch | 69 +++++++++++++++++++
 2 files changed, 130 insertions(+)
 create mode 100644 package/musl/0002-fix-risc64-conflict-with-kernel-headers.patch
 create mode 100644 package/musl/0003-remove-riscv64-bits-user.h-contents.patch

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com