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@xxxxxxxxxx> Reported-by: Klara Modin <klarasmodin@xxxxxxxxx> Tested-by: Klara Modin <klarasmodin@xxxxxxxxx> --- 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