diff options
author | Ingo Molnar <mingo@kernel.org> | 2021-05-13 13:41:41 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2021-05-14 08:50:28 +0200 |
commit | 41f45fb045bcc20e71eb705b361356e715682162 (patch) | |
tree | 8686bfcdc92bf180c7127d6ba0a0c94f049245a8 /arch/x86/include/asm/asm.h | |
parent | 9ddcb87b9218dec760e8d8a780bc8ad514c3d36a (diff) | |
download | linux-41f45fb045bcc20e71eb705b361356e715682162.tar.gz linux-41f45fb045bcc20e71eb705b361356e715682162.tar.bz2 linux-41f45fb045bcc20e71eb705b361356e715682162.zip |
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: Stephen Rothwell <sfr@canb.auug.org.au>
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/asm.h')
-rw-r--r-- | arch/x86/include/asm/asm.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 507a37a46027..3ad3da9a7d97 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -120,6 +120,8 @@ # define CC_OUT(c) [_cc_ ## c] "=qm" #endif +#ifdef __KERNEL__ + /* Exception table entry */ #ifdef __ASSEMBLY__ # define _ASM_EXTABLE_HANDLE(from, to, handler) \ @@ -186,4 +188,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP); #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) #endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ + #endif /* _ASM_X86_ASM_H */ |