diff mbox series

[v2,1/2] Makefile: Remove '--gcc-toolchain' flag

Message ID 20210309205915.2340265-1-nathan@kernel.org (mailing list archive)
State New
Headers show
Series [v2,1/2] Makefile: Remove '--gcc-toolchain' flag | expand

Commit Message

Nathan Chancellor March 9, 2021, 8:59 p.m. UTC
This flag was originally added to allow clang to find the GNU cross
tools in commit 785f11aa595b ("kbuild: Add better clang cross build
support"). This flag was not enough to find the tools at times so
'--prefix' was added to the list in commit ef8c4ed9db80 ("kbuild: allow
to use GCC toolchain not in Clang search path") and improved upon in
commit ca9b31f6bb9c ("Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang
cross compilation"). Now that '--prefix' specifies a full path and
prefix, '--gcc-toolchain' serves no purpose because the kernel builds
with '-nostdinc' and '-nostdlib'.

This has been verified with self compiled LLVM 10.0.1 and LLVM 13.0.0 as
well as a distribution version of LLVM 11.1.0 without binutils in the
LLVM toolchain locations.

Link: https://reviews.llvm.org/D97902
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---

v1 -> v2:

* Improve commit message (add history behind flag and link to Fangrui's
  documentation improvement).

I did not carry tags forward so that people could re-review and test.

 Makefile | 4 ----
 1 file changed, 4 deletions(-)


base-commit: a38fd8748464831584a19438cbb3082b5a2dab15

Comments

Fāng-ruì Sòng March 9, 2021, 9:15 p.m. UTC | #1
On 2021-03-09, Nathan Chancellor wrote:
>This flag was originally added to allow clang to find the GNU cross
>tools in commit 785f11aa595b ("kbuild: Add better clang cross build
>support"). This flag was not enough to find the tools at times so
>'--prefix' was added to the list in commit ef8c4ed9db80 ("kbuild: allow
>to use GCC toolchain not in Clang search path") and improved upon in
>commit ca9b31f6bb9c ("Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang
>cross compilation"). Now that '--prefix' specifies a full path and
>prefix, '--gcc-toolchain' serves no purpose because the kernel builds
>with '-nostdinc' and '-nostdlib'.
>
>This has been verified with self compiled LLVM 10.0.1 and LLVM 13.0.0 as
>well as a distribution version of LLVM 11.1.0 without binutils in the
>LLVM toolchain locations.
>
>Link: https://reviews.llvm.org/D97902
>Signed-off-by: Nathan Chancellor <nathan@kernel.org>

The wording looks good.

Reviewed-by: Fangrui Song <maskray@google.com>
Masahiro Yamada March 15, 2021, 4:21 p.m. UTC | #2
On Wed, Mar 10, 2021 at 5:59 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> This flag was originally added to allow clang to find the GNU cross
> tools in commit 785f11aa595b ("kbuild: Add better clang cross build
> support"). This flag was not enough to find the tools at times so
> '--prefix' was added to the list in commit ef8c4ed9db80 ("kbuild: allow
> to use GCC toolchain not in Clang search path") and improved upon in
> commit ca9b31f6bb9c ("Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang
> cross compilation"). Now that '--prefix' specifies a full path and
> prefix, '--gcc-toolchain' serves no purpose because the kernel builds
> with '-nostdinc' and '-nostdlib'.
>
> This has been verified with self compiled LLVM 10.0.1 and LLVM 13.0.0 as
> well as a distribution version of LLVM 11.1.0 without binutils in the
> LLVM toolchain locations.
>
> Link: https://reviews.llvm.org/D97902
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> v1 -> v2:
>
> * Improve commit message (add history behind flag and link to Fangrui's
>   documentation improvement).


Both applied to linux-kbuild. Thanks.





> I did not carry tags forward so that people could re-review and test.
>
>  Makefile | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 31dcdb3d61fa..182e93d91198 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -568,10 +568,6 @@ ifneq ($(CROSS_COMPILE),)
>  CLANG_FLAGS    += --target=$(notdir $(CROSS_COMPILE:%-=%))
>  GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
>  CLANG_FLAGS    += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
> -GCC_TOOLCHAIN  := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
> -endif
> -ifneq ($(GCC_TOOLCHAIN),)
> -CLANG_FLAGS    += --gcc-toolchain=$(GCC_TOOLCHAIN)
>  endif
>  ifneq ($(LLVM_IAS),1)
>  CLANG_FLAGS    += -no-integrated-as
>
> base-commit: a38fd8748464831584a19438cbb3082b5a2dab15
> --
> 2.31.0.rc1
>
Sedat Dilek March 15, 2021, 4:41 p.m. UTC | #3
On Mon, Mar 15, 2021 at 5:22 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Wed, Mar 10, 2021 at 5:59 AM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > This flag was originally added to allow clang to find the GNU cross
> > tools in commit 785f11aa595b ("kbuild: Add better clang cross build
> > support"). This flag was not enough to find the tools at times so
> > '--prefix' was added to the list in commit ef8c4ed9db80 ("kbuild: allow
> > to use GCC toolchain not in Clang search path") and improved upon in
> > commit ca9b31f6bb9c ("Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang
> > cross compilation"). Now that '--prefix' specifies a full path and
> > prefix, '--gcc-toolchain' serves no purpose because the kernel builds
> > with '-nostdinc' and '-nostdlib'.
> >
> > This has been verified with self compiled LLVM 10.0.1 and LLVM 13.0.0 as
> > well as a distribution version of LLVM 11.1.0 without binutils in the
> > LLVM toolchain locations.
> >
> > Link: https://reviews.llvm.org/D97902
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> >
> > v1 -> v2:
> >
> > * Improve commit message (add history behind flag and link to Fangrui's
> >   documentation improvement).
>
>
> Both applied to linux-kbuild. Thanks.
>

Sorry for being pedantic: This misses my Tested-by#s (see [1]).

Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v13-git

AFAICS v2 changes some comments in the commit only but not code?

- Sedat -

[1] https://marc.info/?l=linux-kernel&m=161480031518629&w=2
[2] https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git/commit/?h=kbuild&id=d4aa405bc9cd506532f075456645716cdd1739c1

>
>
>
>
> > I did not carry tags forward so that people could re-review and test.
> >
> >  Makefile | 4 ----
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 31dcdb3d61fa..182e93d91198 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -568,10 +568,6 @@ ifneq ($(CROSS_COMPILE),)
> >  CLANG_FLAGS    += --target=$(notdir $(CROSS_COMPILE:%-=%))
> >  GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
> >  CLANG_FLAGS    += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
> > -GCC_TOOLCHAIN  := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
> > -endif
> > -ifneq ($(GCC_TOOLCHAIN),)
> > -CLANG_FLAGS    += --gcc-toolchain=$(GCC_TOOLCHAIN)
> >  endif
> >  ifneq ($(LLVM_IAS),1)
> >  CLANG_FLAGS    += -no-integrated-as
> >
> > base-commit: a38fd8748464831584a19438cbb3082b5a2dab15
> > --
> > 2.31.0.rc1
> >
>
>
> --
> Best Regards
> Masahiro Yamada
Masahiro Yamada March 16, 2021, 3:36 p.m. UTC | #4
On Tue, Mar 16, 2021 at 1:42 AM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Mon, Mar 15, 2021 at 5:22 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > On Wed, Mar 10, 2021 at 5:59 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > >
> > > This flag was originally added to allow clang to find the GNU cross
> > > tools in commit 785f11aa595b ("kbuild: Add better clang cross build
> > > support"). This flag was not enough to find the tools at times so
> > > '--prefix' was added to the list in commit ef8c4ed9db80 ("kbuild: allow
> > > to use GCC toolchain not in Clang search path") and improved upon in
> > > commit ca9b31f6bb9c ("Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang
> > > cross compilation"). Now that '--prefix' specifies a full path and
> > > prefix, '--gcc-toolchain' serves no purpose because the kernel builds
> > > with '-nostdinc' and '-nostdlib'.
> > >
> > > This has been verified with self compiled LLVM 10.0.1 and LLVM 13.0.0 as
> > > well as a distribution version of LLVM 11.1.0 without binutils in the
> > > LLVM toolchain locations.
> > >
> > > Link: https://reviews.llvm.org/D97902
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > > ---
> > >
> > > v1 -> v2:
> > >
> > > * Improve commit message (add history behind flag and link to Fangrui's
> > >   documentation improvement).
> >
> >
> > Both applied to linux-kbuild. Thanks.
> >
>
> Sorry for being pedantic: This misses my Tested-by#s (see [1]).
>
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v13-git
>
> AFAICS v2 changes some comments in the commit only but not code?


For 1/2, yes. The difference is only comments.


For 2/2, the code was changed.
Actually, v1 was wrong.
That is why the tags were dropped.


I will re-add the tags to 1/2
since there is no code diff.


If you re-test 2/2, I will add your tag again.







> - Sedat -
>
> [1] https://marc.info/?l=linux-kernel&m=161480031518629&w=2
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git/commit/?h=kbuild&id=d4aa405bc9cd506532f075456645716cdd1739c1
>
> >
> >
> >
> >
> > > I did not carry tags forward so that people could re-review and test.
> > >
> > >  Makefile | 4 ----
> > >  1 file changed, 4 deletions(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 31dcdb3d61fa..182e93d91198 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -568,10 +568,6 @@ ifneq ($(CROSS_COMPILE),)
> > >  CLANG_FLAGS    += --target=$(notdir $(CROSS_COMPILE:%-=%))
> > >  GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
> > >  CLANG_FLAGS    += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
> > > -GCC_TOOLCHAIN  := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
> > > -endif
> > > -ifneq ($(GCC_TOOLCHAIN),)
> > > -CLANG_FLAGS    += --gcc-toolchain=$(GCC_TOOLCHAIN)
> > >  endif
> > >  ifneq ($(LLVM_IAS),1)
> > >  CLANG_FLAGS    += -no-integrated-as
> > >
> > > base-commit: a38fd8748464831584a19438cbb3082b5a2dab15
> > > --
> > > 2.31.0.rc1
> > >
> >
> >
> > --
> > Best Regards
> > Masahiro Yamada
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 31dcdb3d61fa..182e93d91198 100644
--- a/Makefile
+++ b/Makefile
@@ -568,10 +568,6 @@  ifneq ($(CROSS_COMPILE),)
 CLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
 GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
 CLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
-GCC_TOOLCHAIN	:= $(realpath $(GCC_TOOLCHAIN_DIR)/..)
-endif
-ifneq ($(GCC_TOOLCHAIN),)
-CLANG_FLAGS	+= --gcc-toolchain=$(GCC_TOOLCHAIN)
 endif
 ifneq ($(LLVM_IAS),1)
 CLANG_FLAGS	+= -no-integrated-as