From: Rong Xu <xur@google.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Masahiro Yamada <masahiroy@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Klara Modin <klarasmodin@gmail.com>, Rong Xu <xur@google.com>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] MIPS: move _stext definition to vmlinux.lds.S
Date: Tue, 12 Nov 2024 22:40:28 -0800 [thread overview]
Message-ID: <20241113064028.2795128-1-xur@google.com> (raw)
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
next reply other threads:[~2024-11-13 6:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 6:40 Rong Xu [this message]
2024-11-13 11:12 ` [PATCH v2] MIPS: move _stext definition to vmlinux.lds.S 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241113064028.2795128-1-xur@google.com \
--to=xur@google.com \
--cc=klarasmodin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=ndesaulniers@google.com \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox