m68k: Avoid CONFIG_COLDFIRE switch in uapi header
Quoted 20 lines · Thomas Huth
We should not use any CONFIG switches in uapi headers since these only work during kernel compilation. They are not defined for userspace. Let's use the
__mcoldfire__switch from the compiler here instead.Signed-off-by Thomas Huth <[email protected]>---
Marked as RFC since I didn't test it - I'd appreciate if someone could give it a try on a real system.arch/m68k/include/uapi/asm/ptrace.h | 2 +- scripts/headers_install.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)arch/m68k/include/uapi/asm/ptrace.h +0
-0
arch/m68k/include/uapi/asm/ptrace.h struct pt_regs { · line 45
Quoted 8 lines
arch/m68k/include/uapi/asm/ptrace.h +1
-1@@ -39,7 +39,7 @@ struct pt_regs {long d0;long orig_d0;long stkadj; -#ifdef CONFIG_COLDFIRE +#ifdef __mcoldfire__ unsigned format : 4; /* frame format specifier */ unsigned vector : 12; /* vector offset */unsigned short sr;
I think this should be harmless, but I'm not sure we even need the structure in a uapi header: about half the architectures define this in a user-visible way, while the others don't.
On csky, powerpc and microblaze, pt_regs is used inside of the 'struct sigcontext' definition, but I don't think this was ever the case on m68k.
The other one that is accessed in userspace is 'struct user_regs_struct', but this one is actually not in the uapi headers on m68k or x86.
Arnd
RFC PATCH 1/1 m68k: Avoid CONFIG_COLDFIRE switch in uapi header
We should not use any CONFIG switches in uapi headers since these only work during kernel compilation. They are not defined for userspace. Let's use the __mcoldfire__ switch from the compiler here instead.
---
Marked as RFC since I didn't test it - I'd appreciate if someone could give it a try on a real system.
arch/m68k/include/uapi/asm/ptrace.h | 2 +- scripts/headers_install.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
arch/m68k/include/uapi/asm/ptrace.h +1 -1
@@ -39,7 +39,7 @@ struct pt_regs {long d0;long orig_d0;long stkadj; -#ifdef CONFIG_COLDFIRE +#ifdef __mcoldfire__ unsigned format : 4; /* frame format specifier */ unsigned vector : 12; /* vector offset */unsigned short sr;
scripts/headers_install.sh +0 -1
@@ -75,7 +75,6 @@ arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_4K arch/arc/include/uapi/asm/swab.h:CONFIG_ARC_HAS_SWAPE arch/arm/include/uapi/asm/ptrace.h:CONFIG_CPU_ENDIAN_BE8 arch/hexagon/include/uapi/asm/user.h:CONFIG_HEXAGON_ARCH_VERSION -arch/m68k/include/uapi/asm/ptrace.h:CONFIG_COLDFIRE arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_NO arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_SUPPORT arch/x86/include/uapi/asm/auxvec.h:CONFIG_IA32_EMULATION
Signature · 1 line
2.41.0
Quoted 15 lines · Arnd Bergmann
Quoted 14 lines · Thomas Huth
We should not use any CONFIG switches in uapi headers since these only work during kernel compilation. They are not defined for userspace. Let's use the
__mcoldfire__switch from the compiler here instead.Signed-off-by Thomas Huth <[email protected]>---
Marked as RFC since I didn't test it - I'd appreciate if someone could give it a try on a real system.arch/m68k/include/uapi/asm/ptrace.h | 2 +- scripts/headers_install.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
Quoted 16 lines
Quoted 6 lines
arch/m68k/include/uapi/asm/ptrace.h +0
-0arch/m68k/include/uapi/asm/ptrace.h struct pt_regs { · line 45
Quoted 8 lines
arch/m68k/include/uapi/asm/ptrace.h +1
-1@@ -39,7 +39,7 @@ struct pt_regs {long d0;long orig_d0;long stkadj; -#ifdef CONFIG_COLDFIRE +#ifdef __mcoldfire__ unsigned format : 4; /* frame format specifier */ unsigned vector : 12; /* vector offset */unsigned short sr;I think this should be harmless,
I expect it would be, we have done this in at least one other uapi file, arch/m68k/include/uapi/asm/swab.h.
Quoted 11 lines
but I'm not sure we even
need the structure in a uapi header: about half the architectures define this in a user-visible way, while the others don't.On csky, powerpc and microblaze,
pt_regsis used inside of the 'struct sigcontext' definition, but I don't think this was ever the case on m68k.The other one that is accessed in userspace is 'struct
user_regs_struct', but this one is actually not in the uapi headers on m68k or x86.
I don't think we need them in the uapi header at all. Trivially moving those 2 structures into the non-uapi ptrace.h seems to build fine on most simple setups I tried (systems using uClibc, with applications like strace). Should we try moving them out?
Regards
Greg
Quoted 47 lines · Greg Ungerer
Quoted 15 lines · Arnd Bergmann
Quoted 14 lines · Thomas Huth
We should not use any CONFIG switches in uapi headers since these only work during kernel compilation. They are not defined for userspace. Let's use the
__mcoldfire__switch from the compiler here instead.Signed-off-by Thomas Huth <[email protected]>---
Marked as RFC since I didn't test it - I'd appreciate if someone could give it a try on a real system.
arch/m68k/include/uapi/asm/ptrace.h| 2 +-
scripts/headers_install.sh | 1 -2 files changed, 1 insertion(+), 2 deletions(-)Quoted 16 lines
Quoted 11 lines
arch/m68k/include/uapi/asm/ptrace.h +1
-1@@ -39,7 +39,7 @@ struct pt_regs { long d0; long orig_d0; long stkadj; -#ifdef CONFIG_COLDFIRE +#ifdef __mcoldfire__Quoted 3 lines
unsigned format : 4; /* frame format specifier */ unsigned vector : 12; /* vector offset */ unsigned short sr;
I think this should be harmless,
I expect it would be, we have done this in at least one other uapi file,
arch/m68k/include/uapi/asm/swab.h.Quoted 8 lines
but I'm not sure we even
need the structure in a uapi header: about half the architectures define this in a user-visible way, while the others don't.On csky, powerpc and microblaze,
pt_regsis used inside of the 'struct sigcontext' definition, but I don't think this was ever the case on m68k.
Quoted 8 lines
Quoted 3 lines
The other one that is accessed in userspace is 'struct
user_regs_struct', but this one is actually not in the uapi headers on m68k or x86.I don't think we need them in the uapi header at all. Trivially moving those 2 structures into the non-uapi
ptrace.hseems to build fine on most simple setups I tried (systems using uClibc, with applications like strace). Should we try moving them out?
Yes, please! Can you send your patch?
Thomas