Skip to content

Commit c984aef

Browse files
sathvika-vmpe
authored andcommitted
objtool/powerpc: Add --mcount specific implementation
This patch enables objtool --mcount on powerpc, and adds implementation specific to powerpc. Tested-by: Naveen N. Rao <[email protected]> Reviewed-by: Naveen N. Rao <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Signed-off-by: Sathvika Vasireddy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent e52ec98 commit c984aef

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

arch/powerpc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ config PPC
239239
select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S)
240240
select HAVE_OPTPROBES
241241
select HAVE_OBJTOOL if PPC32 || MPROFILE_KERNEL
242+
select HAVE_OBJTOOL_MCOUNT if HAVE_OBJTOOL
242243
select HAVE_PERF_EVENTS
243244
select HAVE_PERF_EVENTS_NMI if PPC64
244245
select HAVE_PERF_REGS

tools/objtool/arch/powerpc/decode.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
#include <objtool/builtin.h>
1010
#include <objtool/endianness.h>
1111

12+
int arch_ftrace_match(char *name)
13+
{
14+
return !strcmp(name, "_mcount");
15+
}
16+
1217
unsigned long arch_dest_reloc_offset(int addend)
1318
{
1419
return addend;
@@ -50,6 +55,17 @@ int arch_decode_instruction(struct objtool_file *file, const struct section *sec
5055
typ = INSN_OTHER;
5156
imm = 0;
5257

58+
switch (opcode) {
59+
case 18: /* b[l][a] */
60+
if ((insn & 3) == 1) /* bl */
61+
typ = INSN_CALL;
62+
63+
imm = insn & 0x3fffffc;
64+
if (imm & 0x2000000)
65+
imm -= 0x4000000;
66+
break;
67+
}
68+
5369
if (opcode == 1)
5470
*len = 8;
5571
else

tools/objtool/arch/powerpc/include/arch/elf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
#define _OBJTOOL_ARCH_ELF
55

66
#define R_NONE R_PPC_NONE
7+
#define R_ABS64 R_PPC64_ADDR64
8+
#define R_ABS32 R_PPC_ADDR32
79

810
#endif /* _OBJTOOL_ARCH_ELF */

0 commit comments

Comments
 (0)