Re: [RFC PATCH] kbuild: pass objects instead of archives to linker

From: Masahiro Yamada
Date: Thu Nov 03 2022 - 10:48:29 EST


On Thu, Nov 3, 2022 at 4:22 PM Jiri Slaby <jirislaby@xxxxxxxxxx> wrote:
>
> On 02. 11. 22, 10:44, Masahiro Yamada wrote:
> > Jiri Slaby reported that the (not-upstreamed) GCC-LTO tree got broken
> > due to 321648455061 ("kbuild: use obj-y instead extra-y for objects
> > placed at the head")
> >
> > https://lore.kernel.org/linux-kbuild/ea468b86-abb7-bb2b-1e0a-4c8959d23f1c@xxxxxxxxxx/
> >
> >
> > I am not pretty sure because I did not check the downstream code.
> >
> >
> > If I understood his report correctly, the reason for the breakage is
> > because I put all objects into the thin archive, expecting
> > the linker would preserve the object order in the archive.
> >
> > By specifying the object order directly in the command line,
> > GCC-LTO should get back working again.
>
> ...
>
> > I think my patch is unneeded (hence RFC), but I just wanted to know
> > if linkers (gnu ld and lld) see any difference.
>
> Yes, including your patch (instead of vmlinux.S and /compressed/*
> changes) also fixes the issue. So the linker (gcc-ld) indeed respects
> command line, but not order of objects in .a.
>


Can I see your LTO implementation somewhere in public?


I know Andy Kleen's GCC-LTO, the latest version is 5.13-ish.

https://github.com/andikleen/linux-misc.git





> thanks,
> --
> js
> suse labs
>


--
Best Regards
Masahiro Yamada