Re: [PATCH v4 4/5] MIPS: VDSO: Use $(LD) instead of $(CC) to link VDSO

Nathan Chancellor
2020-05-02T15:49:49Z

On Sat, May 02, 2020 at 02:50:34PM +0100, Maciej W. Rozycki wrote:
> On Tue, 28 Apr 2020, Nathan Chancellor wrote:
>
> > Before this patch, LD=ld.lld did nothing:
> >
> > $ llvm-readelf -p.comment arch/mips/vdso/vdso.so.dbg | sed 's/(.*//'
> > String dump of section '.comment':
> > [ 0] ClangBuiltLinux clang version 11.0.0
>
> What does it mean "did nothing", is `arch/mips/vdso/vdso.so.dbg.raw' not
> produced? Where does `arch/mips/vdso/vdso.so.dbg' come from then?
>
> Maciej

A better wording might be "Before this patch, specifying a linker like
ld.lld via the LD variable was not respected by the MIPS VDSO". I should
also probably expand on the second paragraph, maybe something like:

When clang is built in a default configuration, it first attempts to use
the target triple's default linker then the system's default linker,
which is almost always ld.bfd. To use ld.lld, '-fuse-ld=lld' must be
passed to clang. However, we do not use -fuse-ld=lld because it can be
brittle and we have support for invoking $(LD) directly because we have
separate compilation and link steps. See commit fe00e50b2db8c ("ARM:
8858/1: vdso: use $(LD) instead of $(CC) to link VDSO") and
commit 691efbedc60d2 ("arm64: vdso: use $(LD) instead of $(CC) to link
VDSO") for examples of doing this in the VDSO.