* Re: [PATCH 3/4] Makefile: lld: tell clang to use lld
@ 2019-02-08 14:21 Sedat Dilek
2019-02-08 16:24 ` Nathan Chancellor
0 siblings, 1 reply; 11+ messages in thread
From: Sedat Dilek @ 2019-02-08 14:21 UTC (permalink / raw)
To: Masahiro Yamada, Nick Desaulniers, Nathan Chancellor,
Michal Marek, linux-kbuild, linux-kernel
Hi Nick,
why don't you simply check for CONFIG_LD_IS_LLD existing (when [1] applied)?
If you want a specific version of ld.lld (you mentioned kernel module
linking failure was fixed recently) why not transfer this into a
scripts/lld-version.sh file?
Greetings,
- Sedat -
[1] https://lore.kernel.org/patchwork/patch/1039719/ ("[1/4]
init/Kconfig: add config support for detecting linker")
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] Makefile: lld: tell clang to use lld
2019-02-08 14:21 [PATCH 3/4] Makefile: lld: tell clang to use lld Sedat Dilek
@ 2019-02-08 16:24 ` Nathan Chancellor
0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2019-02-08 16:24 UTC (permalink / raw)
To: Sedat Dilek
Cc: Masahiro Yamada, Nick Desaulniers, Michal Marek, linux-kbuild,
linux-kernel
On Fri, Feb 08, 2019 at 03:21:15PM +0100, Sedat Dilek wrote:
> Hi Nick,
>
> why don't you simply check for CONFIG_LD_IS_LLD existing (when [1] applied)?
>
Hi Sedat,
This section runs before Kconfig so we can't rely on the symbols it
generates. See commit 995167420797 ("kbuild: remove cc-name variable")
for Masahiro's explanation.
> If you want a specific version of ld.lld (you mentioned kernel module
> linking failure was fixed recently) why not transfer this into a
> scripts/lld-version.sh file?
>
We'll probably need that eventually but given that lld isn't ready for
widespread use, I don't think it's necessary.
> Greetings,
> - Sedat -
>
> [1] https://lore.kernel.org/patchwork/patch/1039719/ ("[1/4]
> init/Kconfig: add config support for detecting linker")
Nathan
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/4] init/Kconfig: add config support for detecting linker
@ 2019-02-07 22:01 ndesaulniers
2019-02-07 22:01 ` [PATCH 3/4] Makefile: lld: tell clang to use lld ndesaulniers
0 siblings, 1 reply; 11+ messages in thread
From: ndesaulniers @ 2019-02-07 22:01 UTC (permalink / raw)
To: yamada.masahiro
Cc: Nick Desaulniers, Nathan Chancellor, Sami Tolvanen,
Andrew Morton, Peter Zijlstra (Intel),
Johannes Weiner, Kees Cook, Dominik Brodowski, Nicholas Piggin,
Mathieu Desnoyers, Vasily Gorbik, Adrian Reber,
Richard Guy Briggs, linux-kernel
Similar to how we differentiate between CONFIG_CC_IS_GCC and
CONFIG_CC_IS_CLANG, add CONFIG_LD_IS_BFD, CONFIG_LD_IS_GOLD, and
CONFIG_LD_IS_LLD.
This simiplifies patches to Makefiles that need to do different things
for different linkers.
Cc: Nathan Chancellor <natechancellor@gmail.com>
Cc: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
init/Kconfig | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/init/Kconfig b/init/Kconfig
index c9386a365eea..b6046dcf7794 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -26,6 +26,15 @@ config CLANG_VERSION
config CC_HAS_ASM_GOTO
def_bool $(success,$(srctree)/scripts/gcc-goto.sh $(CC))
+config LD_IS_BFD
+ def_bool $(success,$(LD) --version | head -n 1 | grep -q 'GNU ld')
+
+config LD_IS_GOLD
+ def_bool $(success,$(LD) --version | head -n 1 | grep -q 'GNU gold')
+
+config LD_IS_LLD
+ def_bool $(success,$(LD) --version | head -n 1 | grep -q 'LLD')
+
config CONSTRUCTORS
bool
depends on !UML
--
2.20.1.791.gb4d0f1c61a-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/4] Makefile: lld: tell clang to use lld
2019-02-07 22:01 [PATCH 1/4] init/Kconfig: add config support for detecting linker ndesaulniers
@ 2019-02-07 22:01 ` ndesaulniers
2019-02-08 5:50 ` Nathan Chancellor
0 siblings, 1 reply; 11+ messages in thread
From: ndesaulniers @ 2019-02-07 22:01 UTC (permalink / raw)
To: yamada.masahiro
Cc: Nick Desaulniers, Nathan Chancellor, Michal Marek, linux-kbuild,
linux-kernel
This is needed because clang doesn't select which linker to use based on
$LD but rather -fuse-ld=$(LD). This is problematic especially for
cc-ldoption, which checks for linker flag support via invoking the
compiler, rather than the linker.
Link: https://github.com/ClangBuiltLinux/linux/issues/342
Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Makefile b/Makefile
index 0eae4277206e..6307c17259ea 100644
--- a/Makefile
+++ b/Makefile
@@ -502,6 +502,9 @@ endif
CLANG_FLAGS += -no-integrated-as
KBUILD_CFLAGS += $(CLANG_FLAGS)
KBUILD_AFLAGS += $(CLANG_FLAGS)
+ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),)
+CLANG_FLAGS += -fuse-ld=lld
+endif
export CLANG_FLAGS
endif
--
2.20.1.791.gb4d0f1c61a-goog
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] Makefile: lld: tell clang to use lld
2019-02-07 22:01 ` [PATCH 3/4] Makefile: lld: tell clang to use lld ndesaulniers
@ 2019-02-08 5:50 ` Nathan Chancellor
2019-02-08 17:27 ` Nick Desaulniers
2019-02-11 19:26 ` Nick Desaulniers
0 siblings, 2 replies; 11+ messages in thread
From: Nathan Chancellor @ 2019-02-08 5:50 UTC (permalink / raw)
To: ndesaulniers; +Cc: yamada.masahiro, Michal Marek, linux-kbuild, linux-kernel
On Thu, Feb 07, 2019 at 02:01:51PM -0800, ndesaulniers@google.com wrote:
> This is needed because clang doesn't select which linker to use based on
> $LD but rather -fuse-ld=$(LD). This is problematic especially for
> cc-ldoption, which checks for linker flag support via invoking the
> compiler, rather than the linker.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/342
> Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Makefile | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 0eae4277206e..6307c17259ea 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -502,6 +502,9 @@ endif
> CLANG_FLAGS += -no-integrated-as
> KBUILD_CFLAGS += $(CLANG_FLAGS)
> KBUILD_AFLAGS += $(CLANG_FLAGS)
> +ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),)
> +CLANG_FLAGS += -fuse-ld=lld
> +endif
This section needs to be moved up above KBUILD_CFLAGS otherwise it never
actually gets passed along.
With that change, please add:
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
> export CLANG_FLAGS
> endif
>
> --
> 2.20.1.791.gb4d0f1c61a-goog
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] Makefile: lld: tell clang to use lld
2019-02-08 5:50 ` Nathan Chancellor
@ 2019-02-08 17:27 ` Nick Desaulniers
2019-02-08 17:45 ` Nathan Chancellor
2019-02-11 15:32 ` Masahiro Yamada
2019-02-11 19:26 ` Nick Desaulniers
1 sibling, 2 replies; 11+ messages in thread
From: Nick Desaulniers @ 2019-02-08 17:27 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Masahiro Yamada, Michal Marek, Linux Kbuild mailing list, LKML,
sedat.dilek
On Thu, Feb 7, 2019 at 9:51 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Thu, Feb 07, 2019 at 02:01:51PM -0800, ndesaulniers@google.com wrote:
> > This is needed because clang doesn't select which linker to use based on
> > $LD but rather -fuse-ld=$(LD). This is problematic especially for
> > cc-ldoption, which checks for linker flag support via invoking the
> > compiler, rather than the linker.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/342
> > Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > ---
> > Makefile | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/Makefile b/Makefile
> > index 0eae4277206e..6307c17259ea 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -502,6 +502,9 @@ endif
> > CLANG_FLAGS += -no-integrated-as
> > KBUILD_CFLAGS += $(CLANG_FLAGS)
> > KBUILD_AFLAGS += $(CLANG_FLAGS)
> > +ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),)
> > +CLANG_FLAGS += -fuse-ld=lld
Sorry, Sedat reports [0] that this is not quite correct; if $(LD)
matches LLD, then we need to set -fuse-ld=$(LD), not -fuse-ld=lld,
since you may have lld installed as lld-7 or lld-8, for example:
https://github.com/ClangBuiltLinux/linux/issues/358
> > +endif
>
> This section needs to be moved up above KBUILD_CFLAGS otherwise it never
> actually gets passed along.
>
> With that change, please add:
>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> Tested-by: Nathan Chancellor <natechancellor@gmail.com>
>
> > export CLANG_FLAGS
> > endif
> >
> > --
> > 2.20.1.791.gb4d0f1c61a-goog
> >
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] Makefile: lld: tell clang to use lld
2019-02-08 17:27 ` Nick Desaulniers
@ 2019-02-08 17:45 ` Nathan Chancellor
2019-02-11 15:32 ` Masahiro Yamada
1 sibling, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2019-02-08 17:45 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Masahiro Yamada, Michal Marek, Linux Kbuild mailing list, LKML,
sedat.dilek
On Fri, Feb 08, 2019 at 09:27:19AM -0800, Nick Desaulniers wrote:
> On Thu, Feb 7, 2019 at 9:51 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > On Thu, Feb 07, 2019 at 02:01:51PM -0800, ndesaulniers@google.com wrote:
> > > This is needed because clang doesn't select which linker to use based on
> > > $LD but rather -fuse-ld=$(LD). This is problematic especially for
> > > cc-ldoption, which checks for linker flag support via invoking the
> > > compiler, rather than the linker.
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/342
> > > Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> > > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > > ---
> > > Makefile | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 0eae4277206e..6307c17259ea 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -502,6 +502,9 @@ endif
> > > CLANG_FLAGS += -no-integrated-as
> > > KBUILD_CFLAGS += $(CLANG_FLAGS)
> > > KBUILD_AFLAGS += $(CLANG_FLAGS)
> > > +ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),)
> > > +CLANG_FLAGS += -fuse-ld=lld
>
> Sorry, Sedat reports [0] that this is not quite correct; if $(LD)
> matches LLD, then we need to set -fuse-ld=$(LD), not -fuse-ld=lld,
> since you may have lld installed as lld-7 or lld-8, for example:
> https://github.com/ClangBuiltLinux/linux/issues/358
>
We'll need to make sure that it is compatible with the way that Clang
expects arguments to '-fuse-ld=' because it looks like 'ld.' is
automatically appended.
https://github.com/llvm/llvm-project/blob/5be3dbdb082ffba4f846e3572ea802d156dd8d34/clang/lib/Driver/ToolChain.cpp#L438-L468
> > > +endif
> >
> > This section needs to be moved up above KBUILD_CFLAGS otherwise it never
> > actually gets passed along.
> >
> > With that change, please add:
> >
> > Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> > Tested-by: Nathan Chancellor <natechancellor@gmail.com>
> >
> > > export CLANG_FLAGS
> > > endif
> > >
> > > --
> > > 2.20.1.791.gb4d0f1c61a-goog
> > >
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] Makefile: lld: tell clang to use lld
2019-02-08 17:27 ` Nick Desaulniers
2019-02-08 17:45 ` Nathan Chancellor
@ 2019-02-11 15:32 ` Masahiro Yamada
2019-02-11 16:05 ` Sedat Dilek
2019-02-11 19:27 ` Nick Desaulniers
1 sibling, 2 replies; 11+ messages in thread
From: Masahiro Yamada @ 2019-02-11 15:32 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Nathan Chancellor, Michal Marek, Linux Kbuild mailing list, LKML,
Sedat Dilek
On Sat, Feb 9, 2019 at 2:27 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> On Thu, Feb 7, 2019 at 9:51 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > On Thu, Feb 07, 2019 at 02:01:51PM -0800, ndesaulniers@google.com wrote:
> > > This is needed because clang doesn't select which linker to use based on
> > > $LD but rather -fuse-ld=$(LD). This is problematic especially for
> > > cc-ldoption, which checks for linker flag support via invoking the
> > > compiler, rather than the linker.
What do you mean by 'problematic' ?
I see no build error in
arch/arm64/kernel/vdso/Makefile, at least.
Clang uses BFD linker by default,
which may not match to the $(LD) passed in.
Is this what you mean?
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/342
> > > Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> > > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > > ---
> > > Makefile | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 0eae4277206e..6307c17259ea 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -502,6 +502,9 @@ endif
> > > CLANG_FLAGS += -no-integrated-as
> > > KBUILD_CFLAGS += $(CLANG_FLAGS)
> > > KBUILD_AFLAGS += $(CLANG_FLAGS)
> > > +ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),)
> > > +CLANG_FLAGS += -fuse-ld=lld
>
> Sorry, Sedat reports [0] that this is not quite correct; if $(LD)
> matches LLD, then we need to set -fuse-ld=$(LD), not -fuse-ld=lld,
> since you may have lld installed as lld-7 or lld-8, for example:
> https://github.com/ClangBuiltLinux/linux/issues/358
Hmm, $(LD) might be a full path.
Looks like Clang can take a full-path for -fuse-ld=,
but does it work for GCC?
> > > +endif
> >
> > This section needs to be moved up above KBUILD_CFLAGS otherwise it never
> > actually gets passed along.
> >
> > With that change, please add:
> >
> > Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> > Tested-by: Nathan Chancellor <natechancellor@gmail.com>
> >
> > > export CLANG_FLAGS
> > > endif
> > >
> > > --
> > > 2.20.1.791.gb4d0f1c61a-goog
> > >
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] Makefile: lld: tell clang to use lld
2019-02-11 15:32 ` Masahiro Yamada
@ 2019-02-11 16:05 ` Sedat Dilek
2019-02-11 19:30 ` Nick Desaulniers
2019-02-11 19:27 ` Nick Desaulniers
1 sibling, 1 reply; 11+ messages in thread
From: Sedat Dilek @ 2019-02-11 16:05 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Nick Desaulniers, Nathan Chancellor, Michal Marek,
Linux Kbuild mailing list, LKML
On Mon, Feb 11, 2019 at 4:33 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
[ ... ]
> > > > Link: https://github.com/ClangBuiltLinux/linux/issues/342
> > > > Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> > > > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > > > ---
> > > > Makefile | 3 +++
> > > > 1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/Makefile b/Makefile
> > > > index 0eae4277206e..6307c17259ea 100644
> > > > --- a/Makefile
> > > > +++ b/Makefile
> > > > @@ -502,6 +502,9 @@ endif
> > > > CLANG_FLAGS += -no-integrated-as
> > > > KBUILD_CFLAGS += $(CLANG_FLAGS)
> > > > KBUILD_AFLAGS += $(CLANG_FLAGS)
> > > > +ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),)
> > > > +CLANG_FLAGS += -fuse-ld=lld
> >
> > Sorry, Sedat reports [0] that this is not quite correct; if $(LD)
> > matches LLD, then we need to set -fuse-ld=$(LD), not -fuse-ld=lld,
> > since you may have lld installed as lld-7 or lld-8, for example:
> > https://github.com/ClangBuiltLinux/linux/issues/358
>
>
> Hmm, $(LD) might be a full path.
>
> Looks like Clang can take a full-path for -fuse-ld=,
> but does it work for GCC?
>
Nope. GCC expects "-fuse-ld={bfd,gold,lld} ".
Adding suffix "$-VER" was not recognized while building a
llvm-toolchain, so I guess this will be the same for the Linux kernel
side.
- Sedat -
[1] https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
[2] https://github.com/ClangBuiltLinux/linux/issues/358
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] Makefile: lld: tell clang to use lld
2019-02-11 16:05 ` Sedat Dilek
@ 2019-02-11 19:30 ` Nick Desaulniers
0 siblings, 0 replies; 11+ messages in thread
From: Nick Desaulniers @ 2019-02-11 19:30 UTC (permalink / raw)
To: Sedat Dilek
Cc: Masahiro Yamada, Nathan Chancellor, Michal Marek,
Linux Kbuild mailing list, LKML
On Mon, Feb 11, 2019 at 8:05 AM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Mon, Feb 11, 2019 at 4:33 PM Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> [ ... ]
> > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/342
> > > > > Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> > > > > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > > > > ---
> > > > > Makefile | 3 +++
> > > > > 1 file changed, 3 insertions(+)
> > > > >
> > > > > diff --git a/Makefile b/Makefile
> > > > > index 0eae4277206e..6307c17259ea 100644
> > > > > --- a/Makefile
> > > > > +++ b/Makefile
> > > > > @@ -502,6 +502,9 @@ endif
> > > > > CLANG_FLAGS += -no-integrated-as
> > > > > KBUILD_CFLAGS += $(CLANG_FLAGS)
> > > > > KBUILD_AFLAGS += $(CLANG_FLAGS)
> > > > > +ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),)
> > > > > +CLANG_FLAGS += -fuse-ld=lld
> > >
> > > Sorry, Sedat reports [0] that this is not quite correct; if $(LD)
> > > matches LLD, then we need to set -fuse-ld=$(LD), not -fuse-ld=lld,
> > > since you may have lld installed as lld-7 or lld-8, for example:
> > > https://github.com/ClangBuiltLinux/linux/issues/358
> >
> >
> > Hmm, $(LD) might be a full path.
> >
> > Looks like Clang can take a full-path for -fuse-ld=,
> > but does it work for GCC?
> >
>
> Nope. GCC expects "-fuse-ld={bfd,gold,lld} ".
> Adding suffix "$-VER" was not recognized while building a
> llvm-toolchain, so I guess this will be the same for the Linux kernel
> side.
Well for now, let's add support for just `ld.lld` since a build of
llvm will create such a symlink. If folks really need to
differentiate between different versions of lld, let's cross that
bridge when we get there.
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] Makefile: lld: tell clang to use lld
2019-02-11 15:32 ` Masahiro Yamada
2019-02-11 16:05 ` Sedat Dilek
@ 2019-02-11 19:27 ` Nick Desaulniers
1 sibling, 0 replies; 11+ messages in thread
From: Nick Desaulniers @ 2019-02-11 19:27 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Nathan Chancellor, Michal Marek, Linux Kbuild mailing list, LKML,
Sedat Dilek
On Mon, Feb 11, 2019 at 7:33 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> On Sat, Feb 9, 2019 at 2:27 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
> >
> > On Thu, Feb 7, 2019 at 9:51 PM Nathan Chancellor
> > <natechancellor@gmail.com> wrote:
> > >
> > > On Thu, Feb 07, 2019 at 02:01:51PM -0800, ndesaulniers@google.com wrote:
> > > > This is needed because clang doesn't select which linker to use based on
> > > > $LD but rather -fuse-ld=$(LD). This is problematic especially for
> > > > cc-ldoption, which checks for linker flag support via invoking the
> > > > compiler, rather than the linker.
>
> What do you mean by 'problematic' ?
>
> I see no build error in
> arch/arm64/kernel/vdso/Makefile, at least.
>
> Clang uses BFD linker by default,
> which may not match to the $(LD) passed in.
>
> Is this what you mean?
Right, when using a linker other than BFD, we want cc-ldoption to tell
us whether that linker supports a linker flag or not.
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/4] Makefile: lld: tell clang to use lld
2019-02-08 5:50 ` Nathan Chancellor
2019-02-08 17:27 ` Nick Desaulniers
@ 2019-02-11 19:26 ` Nick Desaulniers
1 sibling, 0 replies; 11+ messages in thread
From: Nick Desaulniers @ 2019-02-11 19:26 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Masahiro Yamada, Michal Marek, Linux Kbuild mailing list, LKML
On Thu, Feb 7, 2019 at 9:51 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Thu, Feb 07, 2019 at 02:01:51PM -0800, ndesaulniers@google.com wrote:
> > This is needed because clang doesn't select which linker to use based on
> > $LD but rather -fuse-ld=$(LD). This is problematic especially for
> > cc-ldoption, which checks for linker flag support via invoking the
> > compiler, rather than the linker.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/342
> > Suggested-by: Nathan Chancellor <natechancellor@gmail.com>
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > ---
> > Makefile | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/Makefile b/Makefile
> > index 0eae4277206e..6307c17259ea 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -502,6 +502,9 @@ endif
> > CLANG_FLAGS += -no-integrated-as
> > KBUILD_CFLAGS += $(CLANG_FLAGS)
> > KBUILD_AFLAGS += $(CLANG_FLAGS)
> > +ifneq ($(shell $(LD) --version 2>&1 | head -n 1 | grep LLD),)
> > +CLANG_FLAGS += -fuse-ld=lld
> > +endif
>
> This section needs to be moved up above KBUILD_CFLAGS otherwise it never
> actually gets passed along.
Great catch! I had that correct in my Pixel kernel patches; messed
that up forward porting them. Included in v2 (sending imminently).
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2019-02-11 19:36 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-08 14:21 [PATCH 3/4] Makefile: lld: tell clang to use lld Sedat Dilek
2019-02-08 16:24 ` Nathan Chancellor
-- strict thread matches above, loose matches on Subject: below --
2019-02-07 22:01 [PATCH 1/4] init/Kconfig: add config support for detecting linker ndesaulniers
2019-02-07 22:01 ` [PATCH 3/4] Makefile: lld: tell clang to use lld ndesaulniers
2019-02-08 5:50 ` Nathan Chancellor
2019-02-08 17:27 ` Nick Desaulniers
2019-02-08 17:45 ` Nathan Chancellor
2019-02-11 15:32 ` Masahiro Yamada
2019-02-11 16:05 ` Sedat Dilek
2019-02-11 19:30 ` Nick Desaulniers
2019-02-11 19:27 ` Nick Desaulniers
2019-02-11 19:26 ` Nick Desaulniers
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).