[tip: x86/build] x86/vmlinux.lds.S: Remove conditional definition of LOAD_OFFSET

tip-bot2 for Wei Yang posted 1 patch 1 year, 11 months ago
arch/x86/kernel/vmlinux.lds.S | 4 ----
1 file changed, 4 deletions(-)
[tip: x86/build] x86/vmlinux.lds.S: Remove conditional definition of LOAD_OFFSET
Posted by tip-bot2 for Wei Yang 1 year, 11 months ago
The following commit has been merged into the x86/build branch of tip:

Commit-ID:     a5cffd056ef52280c07a7f6a3b3faacf6b318e8e
Gitweb:        https://git.kernel.org/tip/a5cffd056ef52280c07a7f6a3b3faacf6b318e8e
Author:        Wei Yang <richard.weiyang@gmail.com>
AuthorDate:    Wed, 13 Mar 2024 07:58:38 
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 13 Mar 2024 11:29:10 +01:00

x86/vmlinux.lds.S: Remove conditional definition of LOAD_OFFSET

In vmlinux.lds.S, we define LOAD_OFFSET conditionally to __PAGE_OFFSET
or __START_KERNEL_map. While __START_KERNEL_map is already defined to
the same value with the same condition.

So it is fine to define LOAD_OFFSET to __START_KERNEL_map directly.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20240313075839.8321-4-richard.weiyang@gmail.com
---
 arch/x86/kernel/vmlinux.lds.S | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 56451fd..88dcf93 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -15,11 +15,7 @@
  * put it inside the section definition.
  */
 
-#ifdef CONFIG_X86_32
-#define LOAD_OFFSET __PAGE_OFFSET
-#else
 #define LOAD_OFFSET __START_KERNEL_map
-#endif
 
 #define RUNTIME_DISCARD_EXIT
 #define EMITS_PT_NOTE
Re: [tip: x86/build] x86/vmlinux.lds.S: Remove conditional definition of LOAD_OFFSET
Posted by Borislav Petkov 1 year, 11 months ago
On Wed, Mar 13, 2024 at 10:39:58AM -0000, tip-bot2 for Wei Yang wrote:
> -#ifdef CONFIG_X86_32
> -#define LOAD_OFFSET __PAGE_OFFSET
> -#else
>  #define LOAD_OFFSET __START_KERNEL_map
> -#endif

And, as a next step, you can get rid of LOAD_OFFSET completely and use
__START_KERNEL_map everywhere.

Even less ifdeffery.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [tip: x86/build] x86/vmlinux.lds.S: Remove conditional definition of LOAD_OFFSET
Posted by Wei Yang 1 year, 11 months ago
On Wed, Mar 13, 2024 at 02:18:33PM +0100, Borislav Petkov wrote:
>On Wed, Mar 13, 2024 at 10:39:58AM -0000, tip-bot2 for Wei Yang wrote:
>> -#ifdef CONFIG_X86_32
>> -#define LOAD_OFFSET __PAGE_OFFSET
>> -#else
>>  #define LOAD_OFFSET __START_KERNEL_map
>> -#endif
>
>And, as a next step, you can get rid of LOAD_OFFSET completely and use
>__START_KERNEL_map everywhere.
>
>Even less ifdeffery.

You mean remove the definition of LOAD_OFFSET?

I have tried this, but I found this is used in vmlinux.lds.h. So I don't
figure out a way to get rid of it.

>
>-- 
>Regards/Gruss,
>    Boris.
>
>https://people.kernel.org/tglx/notes-about-netiquette

-- 
Wei Yang
Help you, Help me