From: Ard Biesheuvel <ardb+git@google.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Ard Biesheuvel <ardb@kernel.org>, Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-riscv@lists.infradead.org
Subject: [PATCH 2/3] riscv: Make _text point to the start of the kernel image
Date: Wed, 11 Nov 2026 17:43:48 +0100 [thread overview]
Message-ID: <20261111164345.4059964-7-ardb+git@google.com> (raw)
In-Reply-To: <20261111164345.4059964-5-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
On RISC-V, _text currently refers to the start of the .text output
section, which is placed after the image header (.head.text), and is
therefore equal to _stext. On most other architectures such, _text
refers to the start of the image, and is used as such by generic code,
e.g., to describe the kernel mapping in /proc/kcore and in the ELF
headers of the vmcore, and by the EFI stub.
Now that arch/riscv no longer uses _text to refer to the start of the
kernel code, move it to the start of the image so that it is equal to
_start, and the distinction between _text and _stext is the same as on
other architectures.
This also means that the image header is no longer omitted from the
/proc/kcore and vmcore kernel text mappings. Other users of _text, such
as kallsyms and ftrace, only use it as a reference point to calculate
relative offsets, and are not affected by this change.
Note that, as on arm64, _text will no longer appear in /proc/kallsyms
unless CONFIG_KALLSYMS_ALL=y, given that it now lives outside of the
[_stext, _etext) range. User space tools such as perf already fall back
to _stext in this case.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/riscv/kernel/vmlinux.lds.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index 1f4f8496941a..9849a3e4d102 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -28,11 +28,11 @@ SECTIONS
/* Beginning of code and text segment */
. = LOAD_OFFSET;
_start = .;
+ _text = .;
HEAD_TEXT_SECTION
. = ALIGN(PAGE_SIZE);
.text : {
- _text = .;
_stext = .;
TEXT_TEXT
SCHED_TEXT
--
2.56.0.611.g1030f0b940-goog
next prev parent reply other threads:[~2026-11-11 16:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 16:43 [PATCH 0/3] riscv: Align section markers with other archs Ard Biesheuvel
2026-11-11 16:43 ` [PATCH 1/3] riscv: Use _stext not _text to denote the start of kernel code Ard Biesheuvel
2026-11-11 16:43 ` Ard Biesheuvel [this message]
2026-11-11 16:43 ` [PATCH 3/3] riscv: Rename __init_text_end to __inittext_end like other archs Ard Biesheuvel
2026-11-12 4:35 ` [PATCH 0/3] riscv: Align section markers with " Jisheng Zhang
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=20261111164345.4059964-7-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=ardb@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
/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