public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash
@ 2022-11-15 11:01 alexandre.belloni
  2022-11-21 19:31 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: alexandre.belloni @ 2022-11-15 11:01 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson, Nick Desaulniers
  Cc: Alexandre Belloni, linux-kernel

From: Alexandre Belloni <alexandre.belloni@bootlin.com>

When using dash as /bin/sh, the CC_HAS_ASM_GOTO_TIED_OUTPUT test fails
with a syntax error which is not the one we are looking for:

<stdin>: In function ‘foo’:
<stdin>:1:29: warning: missing terminating " character
<stdin>:1:29: error: missing terminating " character
<stdin>:2:5: error: expected ‘:’ before ‘+’ token
<stdin>:2:7: warning: missing terminating " character
<stdin>:2:7: error: missing terminating " character
<stdin>:2:5: error: expected declaration or statement at end of input

Removing '\n' solves this.

Fixes: 1aa0e8b144b6 ("Kconfig: Add option for asm goto w/ tied outputs to workaround clang-13 bug")
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 init/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/Kconfig b/init/Kconfig
index 694f7c160c9c..13e93bcbc807 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -87,7 +87,7 @@ config CC_HAS_ASM_GOTO_OUTPUT
 config CC_HAS_ASM_GOTO_TIED_OUTPUT
 	depends on CC_HAS_ASM_GOTO_OUTPUT
 	# Detect buggy gcc and clang, fixed in gcc-11 clang-14.
-	def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .\n": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null)
+	def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null)
 
 config TOOLS_SUPPORT_RELR
 	def_bool $(success,env "CC=$(CC)" "LD=$(LD)" "NM=$(NM)" "OBJCOPY=$(OBJCOPY)" $(srctree)/scripts/tools-support-relr.sh)
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash
  2022-11-15 11:01 [PATCH v2] init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash alexandre.belloni
@ 2022-11-21 19:31 ` Sean Christopherson
  2022-11-22 13:42   ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2022-11-21 19:31 UTC (permalink / raw)
  To: alexandre.belloni
  Cc: Paolo Bonzini, Nick Desaulniers, linux-kernel, Masahiro Yamada,
	linux-kbuild

+Masahiro and build, as I don't think this should go through the KVM tree (which
is also partly why no one has responded).

On a related topic, should init/Kconfig be added to the KCONFIG MAINTAINERS entry?
Or is there a better owner for this?

diff --git a/MAINTAINERS b/MAINTAINERS
index 046ff06ff97f..ffff36e16b88 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11040,6 +11040,7 @@ T:      git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
 F:     Documentation/kbuild/kconfig*
 F:     scripts/Kconfig.include
 F:     scripts/kconfig/
+F:     init/Kconfig
 
 KCOV
 R:     Dmitry Vyukov <dvyukov@google.com>

On Tue, Nov 15, 2022, alexandre.belloni@bootlin.com wrote:
> From: Alexandre Belloni <alexandre.belloni@bootlin.com>
> 
> When using dash as /bin/sh, the CC_HAS_ASM_GOTO_TIED_OUTPUT test fails
> with a syntax error which is not the one we are looking for:
> 
> <stdin>: In function ‘foo’:
> <stdin>:1:29: warning: missing terminating " character
> <stdin>:1:29: error: missing terminating " character
> <stdin>:2:5: error: expected ‘:’ before ‘+’ token
> <stdin>:2:7: warning: missing terminating " character
> <stdin>:2:7: error: missing terminating " character
> <stdin>:2:5: error: expected declaration or statement at end of input
> 
> Removing '\n' solves this.
> 
> Fixes: 1aa0e8b144b6 ("Kconfig: Add option for asm goto w/ tied outputs to workaround clang-13 bug")
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
>  init/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/init/Kconfig b/init/Kconfig
> index 694f7c160c9c..13e93bcbc807 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -87,7 +87,7 @@ config CC_HAS_ASM_GOTO_OUTPUT
>  config CC_HAS_ASM_GOTO_TIED_OUTPUT
>  	depends on CC_HAS_ASM_GOTO_OUTPUT
>  	# Detect buggy gcc and clang, fixed in gcc-11 clang-14.
> -	def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .\n": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null)
> +	def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null)

Tested a variety of compiler versions via godbolt, and the results are the same
for all cases, so with the caveat that I am far from a shell expert:

Reviewed-by: Sean Christopherson <seanjc@google.com>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash
  2022-11-21 19:31 ` Sean Christopherson
@ 2022-11-22 13:42   ` Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2022-11-22 13:42 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: alexandre.belloni, Paolo Bonzini, Nick Desaulniers, linux-kernel,
	linux-kbuild

On Tue, Nov 22, 2022 at 4:31 AM Sean Christopherson <seanjc@google.com> wrote:
>
> +Masahiro and build, as I don't think this should go through the KVM tree (which
> is also partly why no one has responded).


Presumably this was sent to the author and the commiter of
1aa0e8b144b6474c4914439d232d15bfe883636b

If Paolo does not pick this up, I can.


Now applied to linux-kbuild/fixes. Thanks.



> On a related topic, should init/Kconfig be added to the KCONFIG MAINTAINERS entry?


No, I do not think so.

init/Kconfig contains a lot, which I am not responsible for.







> Or is there a better owner for this?
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 046ff06ff97f..ffff36e16b88 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11040,6 +11040,7 @@ T:      git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
>  F:     Documentation/kbuild/kconfig*
>  F:     scripts/Kconfig.include
>  F:     scripts/kconfig/
> +F:     init/Kconfig
>
>  KCOV
>  R:     Dmitry Vyukov <dvyukov@google.com>
>
> On Tue, Nov 15, 2022, alexandre.belloni@bootlin.com wrote:
> > From: Alexandre Belloni <alexandre.belloni@bootlin.com>
> >
> > When using dash as /bin/sh, the CC_HAS_ASM_GOTO_TIED_OUTPUT test fails
> > with a syntax error which is not the one we are looking for:
> >
> > <stdin>: In function ‘foo’:
> > <stdin>:1:29: warning: missing terminating " character
> > <stdin>:1:29: error: missing terminating " character
> > <stdin>:2:5: error: expected ‘:’ before ‘+’ token
> > <stdin>:2:7: warning: missing terminating " character
> > <stdin>:2:7: error: missing terminating " character
> > <stdin>:2:5: error: expected declaration or statement at end of input
> >
> > Removing '\n' solves this.
> >
> > Fixes: 1aa0e8b144b6 ("Kconfig: Add option for asm goto w/ tied outputs to workaround clang-13 bug")
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> > ---
> >  init/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/init/Kconfig b/init/Kconfig
> > index 694f7c160c9c..13e93bcbc807 100644
> > --- a/init/Kconfig
> > +++ b/init/Kconfig
> > @@ -87,7 +87,7 @@ config CC_HAS_ASM_GOTO_OUTPUT
> >  config CC_HAS_ASM_GOTO_TIED_OUTPUT
> >       depends on CC_HAS_ASM_GOTO_OUTPUT
> >       # Detect buggy gcc and clang, fixed in gcc-11 clang-14.
> > -     def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .\n": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null)
> > +     def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null)
>
> Tested a variety of compiler versions via godbolt, and the results are the same
> for all cases, so with the caveat that I am far from a shell expert:
>
> Reviewed-by: Sean Christopherson <seanjc@google.com>



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-22 13:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-15 11:01 [PATCH v2] init/Kconfig: fix CC_HAS_ASM_GOTO_TIED_OUTPUT test with dash alexandre.belloni
2022-11-21 19:31 ` Sean Christopherson
2022-11-22 13:42   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox