Re: [PATCH v3 7/7] kbuild: remove head-y syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 24. 09. 22, 20:19, Masahiro Yamada wrote:
Kbuild puts the objects listed in head-y at the head of vmlinux.
Conventionally, we do this for head*.S, which contains the kernel entry
point.

A counter approach is to control the section order by the linker script.
Actually, the code marked as __HEAD goes into the ".head.text" section,
which is placed before the normal ".text" section.

I do not know if both of them are needed. From the build system
perspective, head-y is not mandatory. If you can achieve the proper code
placement by the linker script only, it would be cleaner.

I collected the current head-y objects into head-object-list.txt. It is
a whitelist. My hope is it will be reduced in the long run.

Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
...
--- a/Makefile
+++ b/Makefile
@@ -1149,10 +1149,10 @@ quiet_cmd_ar_vmlinux.a = AR      $@
        cmd_ar_vmlinux.a = \
  	rm -f $@; \
  	$(AR) cDPrST $@ $(KBUILD_VMLINUX_OBJS); \
-	$(AR) mPiT $$($(AR) t $@ | head -n1) $@ $(head-y)
+	$(AR) mPiT $$($(AR) t $@ | head -n1) $@ $$($(AR) t $@ | grep -F --file=$(srctree)/scripts/head-object-list.txt)

With AR=gcc-ar, the "| head -n1" results in:
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ar terminated with signal 13 [Broken pipe]

I found out only with gcc-lto. But maybe we should make it silent in any case? I'm not sure how. This looks ugly (and needs the whole output to be piped):
gcc-ar t vmlinux.a | ( head -n1; cat >/dev/null )

Note the result appears to be correct, it's only that gcc-ar complains after printing out the very first line.

thanks,
--
js
suse labs




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux