Skip to contentSkip to conversation

Place __kernel_entry at the beginning of text section

PATCH In review Rong Xu 3 participants 5 messages Nov 26, 2024 – Dec 2, 2024 MIPS

lore
Share & tools
lore

Rong Xu

author
#0 lore raw

PATCH v2 1/1 Place __kernel_entry at the beginning of text section

Mark __kernel_entry as ".head.text" and place HEAD_TEXT before TEXT_TEXT in the linker script. This ensures that __kernel_entry will be placed at the beginning of text section.

Drop mips from scripts/head-object-list.txt.

---
 arch/mips/kernel/head.S        | 1 +
 arch/mips/kernel/vmlinux.lds.S | 1 +
 scripts/head-object-list.txt   | 1 -
 3 files changed, 2 insertions(+), 1 deletion(-)
arch/mips/kernel/head.S +1 -0
index e90695b2b60e..c7528d96dd1a 100644
@@ -59,6 +59,7 @@
 #endif
 	.endm
 
+	__HEAD
 #ifndef CONFIG_NO_EXCEPT_FILL
 	/*
 	 * Reserved space for exception handlers.
arch/mips/kernel/vmlinux.lds.S +1 -0
index d575f945d422..c9c1ba85ac7b 100644
@@ -62,6 +62,7 @@ SECTIONS
 	_text = .;	/* Text and read-only data */
 	_stext = .;
 	.text : {
+		HEAD_TEXT
 		TEXT_TEXT
 		SCHED_TEXT
 		LOCK_TEXT
scripts/head-object-list.txt +0 -1
index fd5d00bac447..f12b4a7b8406 100644
@@ -23,7 +23,6 @@ arch/m68k/coldfire/head.o
 arch/m68k/kernel/head.o
 arch/m68k/kernel/sun3-head.o
 arch/microblaze/kernel/head.o
-arch/mips/kernel/head.o
 arch/nios2/kernel/head.o
 arch/openrisc/kernel/head.o
 arch/parisc/kernel/head.o

base-commit: 3596c721c4348b2a964e43f9296a0c01509ba927

Signature · 1 line
2.47.0.338.g60cca15819-goog
author
#1 lore raw

I forgot to add the changelog for this V2: The change was to move __HEAD down based on Chris Packham's review.

-Rong

Quoted 58 lines · Rong Xu

Mark __kernel_entry as ".head.text" and place HEAD_TEXT before TEXT_TEXT in the linker script. This ensures that __kernel_entry will be placed at the beginning of text section.

Drop mips from scripts/head-object-list.txt.

---
 arch/mips/kernel/head.S        | 1 +
 arch/mips/kernel/vmlinux.lds.S | 1 +
 scripts/head-object-list.txt   | 1 -
 3 files changed, 2 insertions(+), 1 deletion(-)
arch/mips/kernel/head.S +1 -0
index e90695b2b60e..c7528d96dd1a 100644
@@ -59,6 +59,7 @@
 #endif
        .endm
 
+       __HEAD
 #ifndef CONFIG_NO_EXCEPT_FILL
        /*
         * Reserved space for exception handlers.
arch/mips/kernel/vmlinux.lds.S +1 -0
index d575f945d422..c9c1ba85ac7b 100644
@@ -62,6 +62,7 @@ SECTIONS
        _text = .;      /* Text and read-only data */
        _stext = .;
        .text : {
+               HEAD_TEXT
                TEXT_TEXT
                SCHED_TEXT
                LOCK_TEXT
scripts/head-object-list.txt +0 -1
index fd5d00bac447..f12b4a7b8406 100644
@@ -23,7 +23,6 @@ arch/m68k/coldfire/head.o
 arch/m68k/kernel/head.o
 arch/m68k/kernel/sun3-head.o
 arch/microblaze/kernel/head.o
-arch/mips/kernel/head.o
 arch/nios2/kernel/head.o
 arch/openrisc/kernel/head.o
 arch/parisc/kernel/head.o

base-commit: 3596c721c4348b2a964e43f9296a0c01509ba927 --
2.47.0.338.g60cca15819-goog

#2 lore raw
In reply to Rong Xu
Quoted 11 lines · Rong Xu

Mark __kernel_entry as ".head.text" and place HEAD_TEXT before TEXT_TEXT in the linker script. This ensures that __kernel_entry will be placed at the beginning of text section.

Drop mips from scripts/head-object-list.txt.

Applied to linux-kbuild.
(Inserted before the offending commit)

Thanks!

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw
In reply to Rong Xu

arch/mips/kernel/head.S line 65

Quoted 12 lines · Rong Xu
arch/mips/kernel/head.S +1 -0
index e90695b2b60e..c7528d96dd1a 100644
@@ -59,6 +59,7 @@
 #endif
 	.endm
 
+	__HEAD
 #ifndef CONFIG_NO_EXCEPT_FILL
 	/*
 	 * Reserved space for exception handlers.

A new line would be preferable afterwards so as to visually separate the
directive from the conditional part that follows. It looks messy as it stands (and we have prior art further down the file with __REF). Please send a fix.

Maciej

author
#4 lore raw

Sure. I'll send a separate patch for this format change (not v3 as this patch was already submitted).

Thanks!

-Rong

Quoted 22 lines · Maciej W. Rozycki

arch/mips/kernel/head.S line 65

Quoted 12 lines · Rong Xu
arch/mips/kernel/head.S +1 -0
index e90695b2b60e..c7528d96dd1a 100644
@@ -59,6 +59,7 @@
 #endif
      .endm
 
+     __HEAD
 #ifndef CONFIG_NO_EXCEPT_FILL
      /*
       * Reserved space for exception handlers.

A new line would be preferable afterwards so as to visually separate the
directive from the conditional part that follows. It looks messy as it stands (and we have prior art further down the file with __REF). Please send a fix.

Maciej