Re: [PATCH v3 3/7] x86/boot: Move the early GDT/IDT setup code into startup/

From: Ingo Molnar
Date: Wed Apr 09 2025 - 06:09:18 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

>
> * Ard Biesheuvel <ardb+git@xxxxxxxxxx> wrote:
>
> > From: Ard Biesheuvel <ardb@xxxxxxxxxx>
> >
> > Move the early GDT/IDT setup code that runs long before the kernel
> > virtual mapping is up into arch/x86/boot/startup/, and build it in a way
> > that ensures that the code tolerates being called from the 1:1 mapping
> > of memory. The code itself is left unchanged by this patch.
> >
> > Also tweak the sed symbol matching pattern in the decompressor to match
> > on lower case 't' or 'b', as these will be emitted by Clang for symbols
> > with hidden linkage.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
> > ---
> > arch/x86/boot/compressed/Makefile | 2 +-
> > arch/x86/boot/startup/Makefile | 15 ++++
> > arch/x86/boot/startup/gdt_idt.c | 83 ++++++++++++++++++++
> > arch/x86/kernel/head64.c | 73 -----------------
> > 4 files changed, 99 insertions(+), 74 deletions(-)
>
> This causes the following build failure on x86-64-defconfig:
>
> arch/x86/boot/startup/gdt_idt.c:67:55: error: cast to generic address space pointer from disjoint ‘__seg_gs’ address space pointer [-Werror]

Caused by the previous patch:

x86/asm: Make rip_rel_ptr() usable from fPIC code

Thanks,

Ingo