From: Nathan Chancellor <nathan@kernel.org>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: llvm@lists.linux.dev, Nick Desaulniers <ndesaulniers@google.com>,
patches@lists.linux.dev, Paul Mackerras <paulus@samba.org>,
Tom Rix <trix@redhat.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/2] powerpc/vdso: Link with ld.lld when requested
Date: Tue, 10 May 2022 09:25:11 -0700 [thread overview]
Message-ID: <YnqR5/RSMIwqcUx9@dev-arch.thelio-3990X> (raw)
In-Reply-To: <ddd263c7-f27b-9543-55a3-d4efd899afac@ozlabs.ru>
On Tue, May 10, 2022 at 04:22:12PM +1000, Alexey Kardashevskiy wrote:
>
>
> On 5/10/22 06:46, Nathan Chancellor wrote:
> > The PowerPC vDSO is linked with $(CC) instead of $(LD), which means the
> > default linker of the compiler is used instead of the linker requested
> > by the builder.
> >
> > $ make ARCH=powerpc LLVM=1 mrproper defconfig arch/powerpc/kernel/vdso/
> > ...
> >
> > $ llvm-readelf -p .comment arch/powerpc/kernel/vdso/vdso{32,64}.so.dbg
> >
> > File: arch/powerpc/kernel/vdso/vdso32.so.dbg
> > String dump of section '.comment':
> > [ 0] clang version 14.0.0 (Fedora 14.0.0-1.fc37)
> >
> > File: arch/powerpc/kernel/vdso/vdso64.so.dbg
> > String dump of section '.comment':
> > [ 0] clang version 14.0.0 (Fedora 14.0.0-1.fc37)
> >
> > The compiler option '-fuse-ld' tells the compiler which linker to use
> > when it is invoked as both the compiler and linker. Use '-fuse-ld=lld'
> > when LD=ld.lld has been specified (CONFIG_LD_IS_LLD) so that the vDSO is
> > linked with the same linker as the rest of the kernel.
> >
> > $ llvm-readelf -p .comment arch/powerpc/kernel/vdso/vdso{32,64}.so.dbg
> >
> > File: arch/powerpc/kernel/vdso/vdso32.so.dbg
> > String dump of section '.comment':
> > [ 0] Linker: LLD 14.0.0
> > [ 14] clang version 14.0.0 (Fedora 14.0.0-1.fc37)
> >
> > File: arch/powerpc/kernel/vdso/vdso64.so.dbg
> > String dump of section '.comment':
> > [ 0] Linker: LLD 14.0.0
> > [ 14] clang version 14.0.0 (Fedora 14.0.0-1.fc37)
> >
> > LD can be a full path to ld.lld, which will not be handled properly by
> > '-fuse-ld=lld' if the full path to ld.lld is outside of the compiler's
> > search path. '-fuse-ld' can take a path to the linker but it is
> > deprecated in clang 12.0.0; '--ld-path' is preferred for this scenario.
> >
> > Use '--ld-path' if it is supported, as it will handle a full path or
> > just 'ld.lld' properly. See the LLVM commit below for the full details
> > of '--ld-path'.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/774
> > Link: https://github.com/llvm/llvm-project/commit/1bc5c84710a8c73ef21295e63c19d10a8c71f2f5
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > arch/powerpc/kernel/vdso/Makefile | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> > index 954974287ee7..096b0bf1335f 100644
> > --- a/arch/powerpc/kernel/vdso/Makefile
> > +++ b/arch/powerpc/kernel/vdso/Makefile
> > @@ -48,6 +48,7 @@ UBSAN_SANITIZE := n
> > KASAN_SANITIZE := n
> > ccflags-y := -shared -fno-common -fno-builtin -nostdlib -Wl,--hash-style=both
> > +ccflags-$(CONFIG_LD_IS_LLD) += $(call cc-option,--ld-path=$(LD),-fuse-ld=lld)
>
>
> Out of curiosity - how does this work exactly? I can see --ld-path= in the
> output so it works but there is no -fuse-ld=lld, is the second argument of
> cc-option only picked when the first one is not supported?
Correct. See Documentation/kbuild/makefiles.rst for more information
about those macros if you are curious.
> Anyway,
>
> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Thanks a lot!
Cheers,
Nathan
prev parent reply other threads:[~2022-05-10 16:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-09 20:46 [PATCH 0/2] Link the PowerPC vDSO with ld.lld Nathan Chancellor
2022-05-09 20:46 ` [PATCH 1/2] powerpc/vdso: Remove unused ENTRY in linker scripts Nathan Chancellor
2022-05-09 21:05 ` Nick Desaulniers
2022-05-10 6:22 ` Alexey Kardashevskiy
2022-05-10 6:41 ` Fangrui Song
2022-05-09 20:46 ` [PATCH 2/2] powerpc/vdso: Link with ld.lld when requested Nathan Chancellor
2022-05-09 21:24 ` Nick Desaulniers
2022-05-09 21:47 ` Nathan Chancellor
2022-05-09 21:58 ` Nick Desaulniers
2022-05-09 22:30 ` Nathan Chancellor
2022-05-10 6:22 ` Alexey Kardashevskiy
2022-05-10 16:25 ` Nathan Chancellor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YnqR5/RSMIwqcUx9@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=aik@ozlabs.ru \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=llvm@lists.linux.dev \
--cc=ndesaulniers@google.com \
--cc=patches@lists.linux.dev \
--cc=paulus@samba.org \
--cc=trix@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox