linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: check CONFIG_AS_IS_LLVM instead of LLVM_IAS
@ 2021-08-05 15:01 Masahiro Yamada
  2021-08-05 18:22 ` Nick Desaulniers
  2021-08-05 18:46 ` Nathan Chancellor
  0 siblings, 2 replies; 4+ messages in thread
From: Masahiro Yamada @ 2021-08-05 15:01 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Albert Ou, Michal Marek, Nathan Chancellor,
	Nick Desaulniers, Palmer Dabbelt, Paul Walmsley,
	clang-built-linux, linux-kernel, linux-riscv

LLVM_IAS is the user interface to set the -(no-)integrated-as flag,
and it should be used only for that purpose.

LLVM_IAS is checked in some places to determine the assembler type,
but it is not precise.

 $ make CC=gcc LLVM_IAS=1

... will use the GNU assembler since LLVM_IAS=1 is effective only when
$(CC) is clang.

Of course, the combination of CC=gcc and LLVM_IAS=1 does not make
sense, but the build system can be more robust against such insane
input.

Commit ba64beb17493a ("kbuild: check the minimum assembler version in
Kconfig") introduced CONFIG_AS_IS_GNU/LLVM, which is more precise
because Kconfig checks the version string from the assembler in use.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 Makefile            | 2 +-
 arch/riscv/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 4ab151060931..8b56c9692c3c 100644
--- a/Makefile
+++ b/Makefile
@@ -844,7 +844,7 @@ else
 DEBUG_CFLAGS	+= -g
 endif
 
-ifneq ($(LLVM_IAS),1)
+ifndef CONFIG_AS_IS_LLVM
 KBUILD_AFLAGS	+= -Wa,-gdwarf-2
 endif
 
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index bc74afdbf31e..dcfbd2a87d41 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -41,7 +41,7 @@ endif
 ifeq ($(CONFIG_LD_IS_LLD),y)
 	KBUILD_CFLAGS += -mno-relax
 	KBUILD_AFLAGS += -mno-relax
-ifneq ($(LLVM_IAS),1)
+ifndef CONFIG_AS_IS_LLVM
 	KBUILD_CFLAGS += -Wa,-mno-relax
 	KBUILD_AFLAGS += -Wa,-mno-relax
 endif
-- 
2.30.2


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

* Re: [PATCH] kbuild: check CONFIG_AS_IS_LLVM instead of LLVM_IAS
  2021-08-05 15:01 [PATCH] kbuild: check CONFIG_AS_IS_LLVM instead of LLVM_IAS Masahiro Yamada
@ 2021-08-05 18:22 ` Nick Desaulniers
  2021-08-05 18:46 ` Nathan Chancellor
  1 sibling, 0 replies; 4+ messages in thread
From: Nick Desaulniers @ 2021-08-05 18:22 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Albert Ou, Michal Marek, Nathan Chancellor,
	Palmer Dabbelt, Paul Walmsley, clang-built-linux, linux-kernel,
	linux-riscv

On Thu, Aug 5, 2021 at 8:01 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> LLVM_IAS is the user interface to set the -(no-)integrated-as flag,
> and it should be used only for that purpose.
>
> LLVM_IAS is checked in some places to determine the assembler type,
> but it is not precise.
>
>  $ make CC=gcc LLVM_IAS=1
>
> ... will use the GNU assembler since LLVM_IAS=1 is effective only when
> $(CC) is clang.
>
> Of course, the combination of CC=gcc and LLVM_IAS=1 does not make
> sense, but the build system can be more robust against such insane
> input.
>
> Commit ba64beb17493a ("kbuild: check the minimum assembler version in
> Kconfig") introduced CONFIG_AS_IS_GNU/LLVM, which is more precise
> because Kconfig checks the version string from the assembler in use.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>
>  Makefile            | 2 +-
>  arch/riscv/Makefile | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 4ab151060931..8b56c9692c3c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -844,7 +844,7 @@ else
>  DEBUG_CFLAGS   += -g
>  endif
>
> -ifneq ($(LLVM_IAS),1)
> +ifndef CONFIG_AS_IS_LLVM
>  KBUILD_AFLAGS  += -Wa,-gdwarf-2
>  endif
>
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index bc74afdbf31e..dcfbd2a87d41 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -41,7 +41,7 @@ endif
>  ifeq ($(CONFIG_LD_IS_LLD),y)
>         KBUILD_CFLAGS += -mno-relax
>         KBUILD_AFLAGS += -mno-relax
> -ifneq ($(LLVM_IAS),1)
> +ifndef CONFIG_AS_IS_LLVM
>         KBUILD_CFLAGS += -Wa,-mno-relax
>         KBUILD_AFLAGS += -Wa,-mno-relax
>  endif
> --
> 2.30.2
>


-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] kbuild: check CONFIG_AS_IS_LLVM instead of LLVM_IAS
  2021-08-05 15:01 [PATCH] kbuild: check CONFIG_AS_IS_LLVM instead of LLVM_IAS Masahiro Yamada
  2021-08-05 18:22 ` Nick Desaulniers
@ 2021-08-05 18:46 ` Nathan Chancellor
  2021-08-10  0:05   ` Masahiro Yamada
  1 sibling, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2021-08-05 18:46 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild
  Cc: Albert Ou, Michal Marek, Nick Desaulniers, Palmer Dabbelt,
	Paul Walmsley, clang-built-linux, linux-kernel, linux-riscv

On 8/5/2021 8:01 AM, Masahiro Yamada wrote:
> LLVM_IAS is the user interface to set the -(no-)integrated-as flag,
> and it should be used only for that purpose.
> 
> LLVM_IAS is checked in some places to determine the assembler type,
> but it is not precise.
> 
>   $ make CC=gcc LLVM_IAS=1
> 
> ... will use the GNU assembler since LLVM_IAS=1 is effective only when
> $(CC) is clang.
> 
> Of course, the combination of CC=gcc and LLVM_IAS=1 does not make
> sense, but the build system can be more robust against such insane
> input.
> 
> Commit ba64beb17493a ("kbuild: check the minimum assembler version in
> Kconfig") introduced CONFIG_AS_IS_GNU/LLVM, which is more precise
> because Kconfig checks the version string from the assembler in use.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> 
>   Makefile            | 2 +-
>   arch/riscv/Makefile | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 4ab151060931..8b56c9692c3c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -844,7 +844,7 @@ else
>   DEBUG_CFLAGS	+= -g
>   endif
>   
> -ifneq ($(LLVM_IAS),1)
> +ifndef CONFIG_AS_IS_LLVM
>   KBUILD_AFLAGS	+= -Wa,-gdwarf-2
>   endif
>   
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index bc74afdbf31e..dcfbd2a87d41 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -41,7 +41,7 @@ endif
>   ifeq ($(CONFIG_LD_IS_LLD),y)
>   	KBUILD_CFLAGS += -mno-relax
>   	KBUILD_AFLAGS += -mno-relax
> -ifneq ($(LLVM_IAS),1)
> +ifndef CONFIG_AS_IS_LLVM
>   	KBUILD_CFLAGS += -Wa,-mno-relax
>   	KBUILD_AFLAGS += -Wa,-mno-relax
>   endif
> 

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

* Re: [PATCH] kbuild: check CONFIG_AS_IS_LLVM instead of LLVM_IAS
  2021-08-05 18:46 ` Nathan Chancellor
@ 2021-08-10  0:05   ` Masahiro Yamada
  0 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2021-08-10  0:05 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Linux Kbuild mailing list, Albert Ou, Michal Marek,
	Nick Desaulniers, Palmer Dabbelt, Paul Walmsley,
	clang-built-linux, Linux Kernel Mailing List,
	open list:SIFIVE DRIVERS

On Fri, Aug 6, 2021 at 3:46 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On 8/5/2021 8:01 AM, Masahiro Yamada wrote:
> > LLVM_IAS is the user interface to set the -(no-)integrated-as flag,
> > and it should be used only for that purpose.
> >
> > LLVM_IAS is checked in some places to determine the assembler type,
> > but it is not precise.
> >
> >   $ make CC=gcc LLVM_IAS=1
> >
> > ... will use the GNU assembler since LLVM_IAS=1 is effective only when
> > $(CC) is clang.
> >
> > Of course, the combination of CC=gcc and LLVM_IAS=1 does not make
> > sense, but the build system can be more robust against such insane
> > input.
> >
> > Commit ba64beb17493a ("kbuild: check the minimum assembler version in
> > Kconfig") introduced CONFIG_AS_IS_GNU/LLVM, which is more precise
> > because Kconfig checks the version string from the assembler in use.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>





Applied to linux-kbuild.




> > ---
> >
> >   Makefile            | 2 +-
> >   arch/riscv/Makefile | 2 +-
> >   2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 4ab151060931..8b56c9692c3c 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -844,7 +844,7 @@ else
> >   DEBUG_CFLAGS        += -g
> >   endif
> >
> > -ifneq ($(LLVM_IAS),1)
> > +ifndef CONFIG_AS_IS_LLVM
> >   KBUILD_AFLAGS       += -Wa,-gdwarf-2
> >   endif
> >
> > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> > index bc74afdbf31e..dcfbd2a87d41 100644
> > --- a/arch/riscv/Makefile
> > +++ b/arch/riscv/Makefile
> > @@ -41,7 +41,7 @@ endif
> >   ifeq ($(CONFIG_LD_IS_LLD),y)
> >       KBUILD_CFLAGS += -mno-relax
> >       KBUILD_AFLAGS += -mno-relax
> > -ifneq ($(LLVM_IAS),1)
> > +ifndef CONFIG_AS_IS_LLVM
> >       KBUILD_CFLAGS += -Wa,-mno-relax
> >       KBUILD_AFLAGS += -Wa,-mno-relax
> >   endif
> >



-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2021-08-10  0:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 15:01 [PATCH] kbuild: check CONFIG_AS_IS_LLVM instead of LLVM_IAS Masahiro Yamada
2021-08-05 18:22 ` Nick Desaulniers
2021-08-05 18:46 ` Nathan Chancellor
2021-08-10  0:05   ` Masahiro Yamada

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).