Commit 41f45fb0 authored by Ingo Molnar's avatar Ingo Molnar

x86/asm: Make <asm/asm.h> valid on cross-builds as well

Stephen Rothwell reported that the objtool cross-build breaks on
non-x86 hosts:

  > tools/arch/x86/include/asm/asm.h:185:24: error: invalid register name for 'current_stack_pointer'
  >   185 | register unsigned long current_stack_pointer asm(_ASM_SP);
  >       |                        ^~~~~~~~~~~~~~~~~~~~~

The PowerPC host obviously doesn't know much about x86 register names.

Protect the kernel-specific bits of <asm/asm.h>, so that it can be
included by tooling and cross-built.
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Reviewed-by: default avatarH. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 9ddcb87b
...@@ -120,6 +120,8 @@ ...@@ -120,6 +120,8 @@
# define CC_OUT(c) [_cc_ ## c] "=qm" # define CC_OUT(c) [_cc_ ## c] "=qm"
#endif #endif
#ifdef __KERNEL__
/* Exception table entry */ /* Exception table entry */
#ifdef __ASSEMBLY__ #ifdef __ASSEMBLY__
# define _ASM_EXTABLE_HANDLE(from, to, handler) \ # define _ASM_EXTABLE_HANDLE(from, to, handler) \
...@@ -186,4 +188,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP); ...@@ -186,4 +188,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP);
#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* _ASM_X86_ASM_H */ #endif /* _ASM_X86_ASM_H */
...@@ -120,6 +120,8 @@ ...@@ -120,6 +120,8 @@
# define CC_OUT(c) [_cc_ ## c] "=qm" # define CC_OUT(c) [_cc_ ## c] "=qm"
#endif #endif
#ifdef __KERNEL__
/* Exception table entry */ /* Exception table entry */
#ifdef __ASSEMBLY__ #ifdef __ASSEMBLY__
# define _ASM_EXTABLE_HANDLE(from, to, handler) \ # define _ASM_EXTABLE_HANDLE(from, to, handler) \
...@@ -186,4 +188,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP); ...@@ -186,4 +188,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP);
#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* _ASM_X86_ASM_H */ #endif /* _ASM_X86_ASM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment