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

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

 



On Tue, Oct 18, 2022 at 5:16 PM Jiri Slaby <jirislaby@xxxxxxxxxx> wrote:
>
> 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.


Indeed, I see the same message.


sed does not show such an error, though.


masahiro@zoe:~/ref/linux$ gcc-ar t vmlinux.a | head -n1
arch/x86/kernel/head_64.o
/usr/bin/ar terminated with signal 13 [Broken pipe]


masahiro@zoe:~/ref/linux$ gcc-ar t vmlinux.a | sed -n 1p
arch/x86/kernel/head_64.o







-- 
Best Regards
Masahiro Yamada



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux