Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objtool: Improve register reporting during function validation

When tracing function validation, instruction state changes can
report changes involving registers. These registers are reported
with the name "r<num>" (e.g. "r3"). Print the CPU specific register
name instead of a generic name (e.g. print "rbx" instead of "r3"
on x86).

Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://patch.msgid.link/20251121095340.464045-13-alexandre.chartre@oracle.com

authored by

Alexandre Chartre and committed by
Peter Zijlstra
26a453fb fcb268b4

+40
+11
tools/objtool/arch/loongarch/decode.c
··· 8 8 #include <linux/objtool_types.h> 9 9 #include <arch/elf.h> 10 10 11 + const char *arch_reg_name[CFI_NUM_REGS] = { 12 + "zero", "ra", "tp", "sp", 13 + "a0", "a1", "a2", "a3", 14 + "a4", "a5", "a6", "a7", 15 + "t0", "t1", "t2", "t3", 16 + "t4", "t5", "t6", "t7", 17 + "t8", "u0", "fp", "s0", 18 + "s1", "s2", "s3", "s4", 19 + "s5", "s6", "s7", "s8" 20 + }; 21 + 11 22 int arch_ftrace_match(const char *name) 12 23 { 13 24 return !strcmp(name, "_mcount");
+12
tools/objtool/arch/powerpc/decode.c
··· 9 9 #include <objtool/warn.h> 10 10 #include <objtool/builtin.h> 11 11 12 + const char *arch_reg_name[CFI_NUM_REGS] = { 13 + "r0", "sp", "r2", "r3", 14 + "r4", "r5", "r6", "r7", 15 + "r8", "r9", "r10", "r11", 16 + "r12", "r13", "r14", "r15", 17 + "r16", "r17", "r18", "r19", 18 + "r20", "r21", "r22", "r23", 19 + "r24", "r25", "r26", "r27", 20 + "r28", "r29", "r30", "r31", 21 + "ra" 22 + }; 23 + 12 24 int arch_ftrace_match(const char *name) 13 25 { 14 26 return !strcmp(name, "_mcount");
+8
tools/objtool/arch/x86/decode.c
··· 23 23 #include <objtool/builtin.h> 24 24 #include <arch/elf.h> 25 25 26 + const char *arch_reg_name[CFI_NUM_REGS] = { 27 + "rax", "rcx", "rdx", "rbx", 28 + "rsp", "rbp", "rsi", "rdi", 29 + "r8", "r9", "r10", "r11", 30 + "r12", "r13", "r14", "r15", 31 + "ra" 32 + }; 33 + 26 34 int arch_ftrace_match(const char *name) 27 35 { 28 36 return !strcmp(name, "__fentry__");
+2
tools/objtool/include/objtool/arch.h
··· 103 103 unsigned int arch_reloc_size(struct reloc *reloc); 104 104 unsigned long arch_jump_table_sym_offset(struct reloc *reloc, struct reloc *table); 105 105 106 + extern const char *arch_reg_name[CFI_NUM_REGS]; 107 + 106 108 #ifdef DISAS 107 109 108 110 #include <bfd.h>
+7
tools/objtool/trace.c
··· 34 34 static const char *cfi_reg_name(unsigned int reg) 35 35 { 36 36 static char rname_buffer[CFI_REG_NAME_MAXLEN]; 37 + const char *rname; 37 38 38 39 switch (reg) { 39 40 case CFI_UNDEFINED: ··· 45 44 return "(sp)"; 46 45 case CFI_BP_INDIRECT: 47 46 return "(bp)"; 47 + } 48 + 49 + if (reg < CFI_NUM_REGS) { 50 + rname = arch_reg_name[reg]; 51 + if (rname) 52 + return rname; 48 53 } 49 54 50 55 if (snprintf(rname_buffer, CFI_REG_NAME_MAXLEN, "r%d", reg) == -1)