Re: [PATCH] scripts: remove obsolete gcc-ld script

From: Masahiro Yamada
Date: Mon Aug 29 2022 - 04:32:04 EST


On Mon, Aug 29, 2022 at 4:08 PM Jiri Slaby <jirislaby@xxxxxxxxxx> wrote:
>
> On 25. 08. 22, 19:19, Nick Desaulniers wrote:
> > + Jiri in case this needs to be carried downstream.
>
> Thanks.
>
> > On Thu, Aug 25, 2022 at 2:15 AM Lukas Bulwahn <lukas.bulwahn@xxxxxxxxx> wrote:
> >>
> >> Since commit 8564ed2b3888 ("Kbuild, lto: Add a gcc-ld script to let run gcc
> >> as ld") in 2014, there was not specific work on this the gcc-ld script
> >> other than treewide clean-ups.
> >>
> >> There are no users within the kernel tree, and probably no out-of-tree
> >> users either, and there is no dedicated maintainer in MAINTAINERS.
>
> There are out-of-tree users.
>
> >> Delete this obsolete gcc-ld script.
> >>
> >> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@xxxxxxxxx>
> >
> > No callers in-tree; happy to bring it back though should there later
> > be. Thanks for the patch.
>
> I agree to have this downstream-only for the time being. We have updates
> for it queued, so we'd only start tracking the full content now...
>
> BTW the script is not nice at all. How do the clang people cope with the
> issue? (Running gcc-ld instead of ld with proper arguments when linking
> using (full) LTO. For example "-z now" -> "-Wl,-z,now".)



This comes from the difference in which layer LTO is implemented.



GCC LTO is a feature of the GCC compiler.
GNU binutils is agnostic about LTO.
So, you need to use $(CC) as the linker driver.
scripts/gcc-ld adds the '-Wl,' prefix to linker options.




Clang LTO works in cooperation with the LLD linker.
So, the direct use of $(LD) works.
scripts/gcc-ld is unneeded.







--
Best Regards
Masahiro Yamada