lkml.org 
[lkml]   [2022]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC PATCH] kbuild: pass objects instead of archives to linker
On Wed, Nov 2, 2022 at 6:21 PM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> Hello Masahiro,
>
> On Wed, 2 Nov 2022 at 10:13, Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > This is an experimental patch, driven by the feedback from Jiri Slaby
> > and Michael Matz. [1]
> >
> > Michael Matz says:
> > "I know of no linker (outside LTO-like modes) that processes
> > archives in a different order than first-to-last-member (under
> > whole-archive), but that's not guaranteed anywhere. So relying on
> > member-order within archives is always brittle."
> >
> > It is pretty easy to pass the list of objects instead of a thin archive
> > because the linker supports the '@file' syntax, where command line
> > arguments are read from 'file'.
> >
>
> Can you explain which problem is solved by doing this?


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@kernel.org/


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.






>
> If we can only produce a working kernel if each object is linked in
> the order it appears in the archive, I think we have bigger problems
> that need solving regardless. And for the .head.text objects that need
> to appear at the start of the binary image, I think the reported issue
> with __head annotated C functions on x86 needs to be addressed by
> getting rid of __head entirely (which seems to have been introduced
> without proper justification)


I agree that it is the correct approach.


I think my patch is unneeded (hence RFC), but I just wanted to know
if linkers (gnu ld and lld) see any difference.






--
Best Regards
Masahiro Yamada

\
 
 \ /
  Last update: 2022-11-02 10:47    [W:0.055 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site