Re: [RFC PATCH 25/28] x86: Use PIE codegen for the core kernel
From: Linus Torvalds
Date: Wed Oct 02 2024 - 16:02:32 EST
On Wed, 2 Oct 2024 at 08:31, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>
> I guess you are referring to the use of a GOT? That is a valid
> concern, but it does not apply here. With hidden visibility and
> compiler command line options like -mdirect-access-extern, all emitted
> symbol references are direct.
I absolutely hate GOT entries. We definitely shouldn't ever do
anything that causes them on x86-64.
I'd much rather just do boot-time relocation, and I don't think the
"we run code at a different location than we told the linker" is an
arghument against it.
Please, let's make sure we never have any of the global offset table horror.
Yes, yes, you can't avoid them on other architectures.
That said, doing changes like changing "mov $sym" to "lea sym(%rip)" I
feel are a complete no-brainer and should be done regardless of any
other code generation issues.
Let's not do relocation for no good reason.
Linus