[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXGNZQLGxZm8487MRcViriv=S21erw+qMq05BUr0v+8=AQ@mail.gmail.com>
Date: Wed, 26 Oct 2022 13:20:58 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: Jiri Slaby <jirislaby@...nel.org>
Cc: Michael Matz <matz@...e.de>,
Masahiro Yamada <masahiroy@...nel.org>,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nathan Chancellor <nathan@...nel.org>,
Martin Liška <mliska@...e.cz>,
Borislav Petkov <bpetkov@...e.de>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v3 6/7] kbuild: use obj-y instead extra-y for objects
placed at the head
On Wed, 26 Oct 2022 at 10:35, Jiri Slaby <jirislaby@...nel.org> 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@...ux.intel.com>
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@...ux.intel.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: kernel test robot <fengguang.wu@...el.com>
Cc: wfg@...ux.intel.com
Link: http://lkml.kernel.org/r/20170616113024.ajmif63cmcszry5a@black.fi.intel.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Powered by blists - more mailing lists