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

From: Jiri Slaby
Date: Thu Nov 03 2022 - 03:22:54 EST


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.

thanks,
--
js
suse labs