Skip to content

Commit 41f45fb

Browse files
committed
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>
1 parent 9ddcb87 commit 41f45fb

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

  • arch/x86/include/asm
  • tools/arch/x86/include/asm

arch/x86/include/asm/asm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@
120120
# define CC_OUT(c) [_cc_ ## c] "=qm"
121121
#endif
122122

123+
#ifdef __KERNEL__
124+
123125
/* Exception table entry */
124126
#ifdef __ASSEMBLY__
125127
# define _ASM_EXTABLE_HANDLE(from, to, handler) \
@@ -186,4 +188,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP);
186188
#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
187189
#endif /* __ASSEMBLY__ */
188190

191+
#endif /* __KERNEL__ */
192+
189193
#endif /* _ASM_X86_ASM_H */

tools/arch/x86/include/asm/asm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@
120120
# define CC_OUT(c) [_cc_ ## c] "=qm"
121121
#endif
122122

123+
#ifdef __KERNEL__
124+
123125
/* Exception table entry */
124126
#ifdef __ASSEMBLY__
125127
# define _ASM_EXTABLE_HANDLE(from, to, handler) \
@@ -186,4 +188,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP);
186188
#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
187189
#endif /* __ASSEMBLY__ */
188190

191+
#endif /* __KERNEL__ */
192+
189193
#endif /* _ASM_X86_ASM_H */

0 commit comments

Comments
 (0)