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

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

 



On Wed, 26 Oct 2022 at 10:35, Jiri Slaby <jirislaby@xxxxxxxxxx> wrote:
>
> 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).
>

I seriously doubt that those __head routines need to be in .head.text.
At the time, there seems to have been some regression related to
5-level paging, but whether and how that change actually fixed
anything at all is undocumented.

So the fix here is to move those __head routines into __init, so that
only startup_64 remains in .head.text, and the existing linker script
will put it where it belongs.





commit 26179670a68b7b365fbfe38afb043dcd2e1a4678
Author: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
Date:   Fri Jun 16 14:30:24 2017 +0300

    x86/boot/64: Put __startup_64() into .head.text

    Put __startup_64() and fixup_pointer() into .head.text section to make
    sure it's always near startup_64() and always callable.

    Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
    Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Cc: kernel test robot <fengguang.wu@xxxxxxxxx>
    Cc: wfg@xxxxxxxxxxxxxxx
    Link: http://lkml.kernel.org/r/20170616113024.ajmif63cmcszry5a@xxxxxxxxxxxxxxxxxx
    Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>



[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