Re: [PATCH v6 3/3] Documentation/llvm: update CROSS_COMPILE inferencing

From: Nick Desaulniers
Date: Thu Aug 05 2021 - 14:29:18 EST


On Thu, Aug 5, 2021 at 11:27 AM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> On Thu, Aug 5, 2021 at 6:58 AM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> >
> > On Tue, Aug 3, 2021 at 3:39 AM 'Nick Desaulniers' via Clang Built
> > Linux <clang-built-linux@xxxxxxxxxxxxxxxx> wrote:
> > > diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst
> > > index b18401d2ba82..f8a360958f4c 100644
> > > --- a/Documentation/kbuild/llvm.rst
> > > +++ b/Documentation/kbuild/llvm.rst
> > > @@ -63,6 +63,23 @@ They can be enabled individually. The full list of the parameters: ::
> > > Currently, the integrated assembler is disabled by default. You can pass
> > > ``LLVM_IAS=1`` to enable it.
> > >
> > > +Omitting CROSS_COMPILE
> > > +----------------------
> > > +
> > > +As explained above, ``CROSS_COMPILE`` is used to set ``--target=<triple>``.
> > > +
> > > +Unless ``LLVM_IAS=1`` is specified, ``CROSS_COMPILE`` is also used to derive
> > > +``--prefix=<path>`` to search for the GNU assembler and linker.
> >
> >
> > Is there any place where we rely on --prefix
> > to search for the linker?
> >
> > In general, the compiler stops after generating an object
> > since it is passed with the -c option.
> > The linking stage is separated.
> >
> > In the old days, VDSO was an exceptional case
> > where $(CC) was used as the linker driver, but
> > commit fe00e50b2db8c60e4ec90befad1f5bab8ca2c800 fixed it.
>
> See my previous reply to Fangrui.
> https://lore.kernel.org/lkml/CAKwvOdnK=SUm1_--tcLRO3LVeXd_2Srfv2tsZCUW0uXXa1W_pg@xxxxxxxxxxxxxx/
>
> To be more specific, I believe this is still a problem for ppc vdso.
> https://github.com/ClangBuiltLinux/linux/issues/774
>
> I had sent patches for that, but binutils 2.26 would crash (IIUC,
> newer GNU binutils are ok). See this thread:
> https://lore.kernel.org/lkml/b2066ccd-2b81-6032-08e3-41105b400f75@xxxxxxxxxx/
>
> So "we'd prefer the linker was used as the driver, but there's at
> least one place I know of in the tree where that's not currently the
> case."

Also, I think the CC_CAN_LINK functionality also fits the bill.
https://github.com/ClangBuiltLinux/linux/issues/1290
--
Thanks,
~Nick Desaulniers