diff mbox series

kbuild: check CONFIG_AS_IS_LLVM instead of LLVM_IAS

Message ID 20210805150102.131008-1-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series kbuild: check CONFIG_AS_IS_LLVM instead of LLVM_IAS | expand

Commit Message

Masahiro Yamada Aug. 5, 2021, 3:01 p.m. UTC
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(-)

Comments

Nick Desaulniers Aug. 5, 2021, 6:22 p.m. UTC | #1
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
>
Nathan Chancellor Aug. 5, 2021, 6:46 p.m. UTC | #2
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
>
Masahiro Yamada Aug. 10, 2021, 12:05 a.m. UTC | #3
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
> >
diff mbox series

Patch

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