Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH v2] MIPS: move _stext definition to vmlinux.lds.S
@ 2024-11-13  6:40 Rong Xu
  2024-11-13 11:12 ` Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Rong Xu @ 2024-11-13  6:40 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Masahiro Yamada, Nick Desaulniers,
	Klara Modin, Rong Xu, linux-mips, linux-kernel

The _stext symbol is intended to reference the start of the text section.
However, it currently relies on a fragile link order because the existing
EXPORT(_stext) resides within the .text section, which is not guaranteed
to be placed first.

Move the _stext definition to the linker script to enforce an explicit
ordering.

Signed-off-by: Rong Xu <xur@google.com>
Reported-by: Klara Modin <klarasmodin@gmail.com>
Tested-by: Klara Modin <klarasmodin@gmail.com>
---
V2 Changelog:
Incorporated Masahiro Yamada's suggestions:
1. Refined the commit message
2. Removed unnecessary comments
3. Use a standardized way for _stext definition
---
 arch/mips/kernel/head.S        | 2 --
 arch/mips/kernel/vmlinux.lds.S | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index b825ed4476c7..e90695b2b60e 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -67,8 +67,6 @@
 	.fill	0x400
 #endif
 
-EXPORT(_stext)
-
 #ifdef CONFIG_BOOT_RAW
 	/*
 	 * Give us a fighting chance of running if execution beings at the
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 9ff55cb80a64..d575f945d422 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -60,6 +60,7 @@ SECTIONS
 	. = LINKER_LOAD_ADDRESS;
 	/* read-only */
 	_text = .;	/* Text and read-only data */
+	_stext = .;
 	.text : {
 		TEXT_TEXT
 		SCHED_TEXT

base-commit: 06513ddaf77b8f49ef8540c92d92c9ef0ad49426
-- 
2.47.0.338.g60cca15819-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-11-17  4:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13  6:40 [PATCH v2] MIPS: move _stext definition to vmlinux.lds.S Rong Xu
2024-11-13 11:12 ` Masahiro Yamada
2024-11-13 15:55 ` Maciej W. Rozycki
2024-11-13 18:13   ` Rong Xu
2024-11-13 21:17     ` Masahiro Yamada
2024-11-13 21:15   ` Masahiro Yamada
2024-11-14  1:29     ` Maciej W. Rozycki
2024-11-17  4:50 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox