linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: Re: [PATCH] x86/asm: Make <asm/asm.h> valid on cross-builds as well
Date: Thu, 13 May 2021 07:10:11 -0700	[thread overview]
Message-ID: <712482C6-B967-4F3D-A47F-0945219A9CBB@zytor.com> (raw)
In-Reply-To: <YJ0RM2JIfFL8a0X2@gmail.com>

Makes sense to me.

Reviewed-by: H. Peter Anvin <hpa@zytor.com>

On May 13, 2021 4:44:51 AM PDT, Ingo Molnar <mingo@kernel.org> wrote:
>
>* H. Peter Anvin <hpa@zytor.com> wrote:
>
>> Needed some head scratching, but then...
>> 
>> It makes sense for the cross-build: it's building for the host, and a
>
>> non-x86 machine isn't doing to have a register named "%rsp".
>
>Oh, indeed, sfr is building on powerpc64 I think?
>
>> So this needs to be protected from non-kernel use either via
>__KERNEL__ 
>> or by factoring the basic macros out into a separate file.
>
>So something like the below?
>
>The exception table stuff is definitely kernel-only. The others could,
>in 
>principle, be used by tooling as well.
>
>Thanks,
>
>	Ingo
>
>=======================>
>From: Ingo Molnar <mingo@kernel.org>
>Date: Thu, 13 May 2021 13:41:41 +0200
>Subject: [PATCH] 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>
>Signed-off-by: Ingo Molnar <mingo@kernel.org>
>---
> arch/x86/include/asm/asm.h       | 4 ++++
> tools/arch/x86/include/asm/asm.h | 4 ++++
> 2 files changed, 8 insertions(+)
>
>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 */
>diff --git a/tools/arch/x86/include/asm/asm.h
>b/tools/arch/x86/include/asm/asm.h
>index 507a37a46027..3ad3da9a7d97 100644
>--- a/tools/arch/x86/include/asm/asm.h
>+++ b/tools/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 */

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

      reply	other threads:[~2021-05-13 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  2:05 linux-next: build failure after merge of the tip tree Stephen Rothwell
2021-05-13 10:51 ` Ingo Molnar
2021-05-13 11:11   ` H. Peter Anvin
2021-05-13 11:44     ` [PATCH] x86/asm: Make <asm/asm.h> valid on cross-builds as well Ingo Molnar
2021-05-13 14:10       ` H. Peter Anvin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=712482C6-B967-4F3D-A47F-0945219A9CBB@zytor.com \
    --to=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).