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

objtool/powerpc: Add --mcount specific implementation

This patch enables objtool --mcount on powerpc, and adds implementation
specific to powerpc.

Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221114175754.1131267-17-sv@linux.ibm.com

authored by

Sathvika Vasireddy and committed by
Michael Ellerman
c984aef8 e52ec98c

+19
+1
arch/powerpc/Kconfig
··· 239 239 select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S) 240 240 select HAVE_OPTPROBES 241 241 select HAVE_OBJTOOL if PPC32 || MPROFILE_KERNEL 242 + select HAVE_OBJTOOL_MCOUNT if HAVE_OBJTOOL 242 243 select HAVE_PERF_EVENTS 243 244 select HAVE_PERF_EVENTS_NMI if PPC64 244 245 select HAVE_PERF_REGS
+16
tools/objtool/arch/powerpc/decode.c
··· 9 9 #include <objtool/builtin.h> 10 10 #include <objtool/endianness.h> 11 11 12 + int arch_ftrace_match(char *name) 13 + { 14 + return !strcmp(name, "_mcount"); 15 + } 16 + 12 17 unsigned long arch_dest_reloc_offset(int addend) 13 18 { 14 19 return addend; ··· 54 49 opcode = insn >> 26; 55 50 typ = INSN_OTHER; 56 51 imm = 0; 52 + 53 + switch (opcode) { 54 + case 18: /* b[l][a] */ 55 + if ((insn & 3) == 1) /* bl */ 56 + typ = INSN_CALL; 57 + 58 + imm = insn & 0x3fffffc; 59 + if (imm & 0x2000000) 60 + imm -= 0x4000000; 61 + break; 62 + } 57 63 58 64 if (opcode == 1) 59 65 *len = 8;
+2
tools/objtool/arch/powerpc/include/arch/elf.h
··· 4 4 #define _OBJTOOL_ARCH_ELF 5 5 6 6 #define R_NONE R_PPC_NONE 7 + #define R_ABS64 R_PPC64_ADDR64 8 + #define R_ABS32 R_PPC_ADDR32 7 9 8 10 #endif /* _OBJTOOL_ARCH_ELF */