Re: [PATCH v3 6/7] kbuild: use obj-y instead extra-y for objects placed at the head

From: Jiri Slaby
Date: Wed Oct 26 2022 - 04:35:55 EST


On 25. 10. 22, 14:26, Michael Matz wrote:
Ideas, comments? I'll send the attachment as a PATCH later (if there are
no better suggestions).

This will work. An alternative way would be to explicitly name the input
file in the section commands, without renaming the section:

@@ -126,6 +126,7 @@ SECTIONS
_text = .;
_stext = .;
/* bootstrapping code */
+ KEEP(vmlinux.a:head64.o(.head.text))
HEAD_TEXT
TEXT_TEXT

But I guess not all arch's name their must-be-first file head64.o (or even
have such requirement), so that's probably still arch-dependend and hence
not inherently better than your way.

The downside of this is that it doesn't make sure the function (startup_64()) is the first one. When someone sticks something before it, it breaks again. But leaving the decision up to the x86 maintainers ;).

Re. other archs, I have absolutely no idea (haven't looked into that at all).

thanks,
--
js