Skip to contentSkip to conversation

ppc: Include asm/ptrace.h for pt_regs struct definition

PATCH Superseded Khem Raj 3 participants 5 messages Mar 14, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 ppc: Include asm/ptrace.h for pt_regs struct definition

Fixes
../qemu-6.2.0/linux-user/host/ppc64/../ppc/host-signal.h:16:32: error: incomplete definition of type 'struct pt_regs'

    return uc->uc_mcontext.regs->nip;
           ~~~~~~~~~~~~~~~~~~~~^
Cc Peter Maydell <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
Cc Richard Henderson <[email protected]>
---
 linux-user/include/host/ppc/host-signal.h | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/include/host/ppc/host-signal.h +4 -0
index b80384d135..43ee2eee3b 100644
@@ -11,6 +11,10 @@
 #ifndef PPC_HOST_SIGNAL_H
 #define PPC_HOST_SIGNAL_H
 
+#if defined(__powerpc__)
+#include <asm/ptrace.h>
+#endif
+
 /* The third argument to a SA_SIGINFO handler is ucontext_t. */
 typedef ucontext_t host_sigcontext;
 
Signature · 1 line
2.35.1
#1 lore raw
Quoted 19 lines · Khem Raj

Fixes
../qemu-6.2.0/linux-user/host/ppc64/../ppc/host-signal.h:16:32: error: incomplete definition of type 'struct pt_regs'

    return uc->uc_mcontext.regs->nip;
           ~~~~~~~~~~~~~~~~~~~~^
Cc Peter Maydell <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
Cc Richard Henderson <[email protected]>
---
 linux-user/include/host/ppc/host-signal.h | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/include/host/ppc/host-signal.h +0 -0
index b80384d135..43ee2eee3b 100644

linux-user/include/host/ppc/host-signal.h line 14

Quoted 4 lines
linux-user/include/host/ppc/host-signal.h +1 -0
@@ -11,6 +11,10 @@
 #ifndef PPC_HOST_SIGNAL_H
 #define PPC_HOST_SIGNAL_H
 
+#if defined(__powerpc__)

Why is this #if defined() needed ?

linux-user/include/host/ppc/host-signal.h line 16

Quoted 2 lines
linux-user/include/host/ppc/host-signal.h +2 -0
+#include <asm/ptrace.h>
+#endif

What host distro are you building with? We do test ppc64be at least in our CI, and that builds OK.

thanks
-- PMM

author
#2 lore raw
Quoted 24 lines · Peter Maydell
Quoted 22 lines · Khem Raj

Fixes
../qemu-6.2.0/linux-user/host/ppc64/../ppc/host-signal.h:16:32: error: incomplete definition of type 'struct pt_regs'

    return uc->uc_mcontext.regs->nip;
           ~~~~~~~~~~~~~~~~~~~~^
Cc Peter Maydell <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
Cc Richard Henderson <[email protected]>
---
 linux-user/include/host/ppc/host-signal.h | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/include/host/ppc/host-signal.h +0 -0
index b80384d135..43ee2eee3b 100644
@@ -11,6 +11,10 @@
 #ifndef PPC_HOST_SIGNAL_H
 #define PPC_HOST_SIGNAL_H
 
Quoted 3 lines

linux-user/include/host/ppc/host-signal.h line 14

Quoted 1 line
linux-user/include/host/ppc/host-signal.h +1 -0
+#if defined(__powerpc__)

Why is this #if defined() needed ?

yeah the define is redundant. I will send a v2

Quoted 6 lines

linux-user/include/host/ppc/host-signal.h line 16

Quoted 3 lines
linux-user/include/host/ppc/host-signal.h +2 -0
+#include <asm/ptrace.h>
+#endif

What host distro are you building with? We do test ppc64be at least in our CI, and that builds OK.

I have a custom distro building with Yocto which is using musl C library instead of glibc.
may be adelie linux or alpine will exhibit same issue

Quoted 3 lines

thanks
-- PMM

#3 lore raw
Quoted 33 lines · Khem Raj
Quoted 24 lines · Peter Maydell
Quoted 22 lines · Khem Raj

Fixes
../qemu-6.2.0/linux-user/host/ppc64/../ppc/host-signal.h:16:32: error: incomplete definition of type 'struct pt_regs'

    return uc->uc_mcontext.regs->nip;
           ~~~~~~~~~~~~~~~~~~~~^
Cc Peter Maydell <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
Cc Richard Henderson <[email protected]>
---
 linux-user/include/host/ppc/host-signal.h | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/include/host/ppc/host-signal.h +0 -0
index b80384d135..43ee2eee3b 100644
@@ -11,6 +11,10 @@
 #ifndef PPC_HOST_SIGNAL_H
 #define PPC_HOST_SIGNAL_H
 
Quoted 3 lines

linux-user/include/host/ppc/host-signal.h line 14

Quoted 1 line
linux-user/include/host/ppc/host-signal.h +1 -0
+#if defined(__powerpc__)

Why is this #if defined() needed ?

yeah the define is redundant. I will send a v2

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

linux-user/include/host/ppc/host-signal.h line 16

Quoted 2 lines
linux-user/include/host/ppc/host-signal.h +2 -0
+#include <asm/ptrace.h>
+#endif

What host distro are you building with? We do test ppc64be at least in our CI, and that builds OK.

I have a custom distro building with Yocto which is using musl C library instead of glibc.

Ah, musl. I found this gcc mailing list post from one of the musl upstream developers:
https://www.mail-archive.com/[email protected]/msg281012.html

where he suggests a different approach involving uc_regs->gregs[32] for ppc32 and uc_mcontext.gp_regs[32] for ppc64.

Richard: any opinion on that idea ?

-- PMM

#4 lore raw
Quoted 11 lines · Peter Maydell
Quoted 2 lines

I have a custom distro building with Yocto which is using musl C library instead of glibc.

Ah, musl. I found this gcc mailing list post from one of the musl upstream developers:
https://www.mail-archive.com/[email protected]/msg281012.html

where he suggests a different approach involving uc_regs->gregs[32] for ppc32 and uc_mcontext.gp_regs[32] for ppc64.

Richard: any opinion on that idea ?

Reasonable. I would also remove the indirection between linux-user/include/host/ppc64/host-signal.h to linux-user/include/host/ppc/host-signal.h.

We don't support ppc32 anymore -- there are afaik no current distros supporting ppc32 with which we could even test.

r~