Thread (44 messages) 44 messages, 6 authors, 8d ago

Re: [PATCH v2 1/8] scripts/sorttable: Handle RISC-V patchable ftrace entries

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2026-06-01 13:58:06
Also in: linux-kselftest, linux-perf-users, linux-riscv, live-patching, lkml

On Mon, 1 Jun 2026 14:17:08 +0800
Shuai Xue [off-list ref] wrote:
quoted
diff --git a/scripts/sorttable.c b/scripts/sorttable.c
index e8ed11c680c6..4c10e85bb5af 100644
--- a/scripts/sorttable.c
+++ b/scripts/sorttable.c
@@ -891,17 +891,21 @@ static int do_file(char const *const fname, void *addr)
  	table_sort_t custom_sort = NULL;
  
  	switch (elf_map_machine(ehdr)) {
-	case EM_AARCH64:
  #ifdef MCOUNT_SORT_ENABLED
+	case EM_AARCH64:
  		sort_reloc = true;
  		rela_type = 0x403;
-		/* arm64 uses patchable function entry placing before function */
+		/* fallthrough */
+	case EM_RISCV:
+		/* arm64 and RISC-V place patchable entries before the function */
  		before_func = 8;  
Nit: The shared comment now sits under `case EM_RISCV:` but the two
lines above it (sort_reloc / rela_type = 0x403) are strictly
arm64-only — they configure the RELA-based weak-function fixup that
RISC-V does not need. On a quick read it is easy to wonder if RISC-V
is implicitly inheriting that path. Splitting the comments would
help, e.g.:

        case EM_AARCH64:
            /* arm64 needs RELA-based weak-function fixup */
            sort_reloc = true;
            rela_type = 0x403;
            /* fallthrough */
        case EM_RISCV:
            /* arm64 and RISC-V place patchable entries before the function */
            before_func = 8;
Makes sense.

Care to send a v3?

-- Steve
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help