@@ -233,6 +233,7 @@ config PPC
select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S)
select HAVE_OPTPROBES
select HAVE_OBJTOOL if PPC64
+ select HAVE_OBJTOOL_MCOUNT if HAVE_OBJTOOL
select HAVE_PERF_EVENTS
select HAVE_PERF_EVENTS_NMI if PPC64
select HAVE_PERF_REGS
@@ -9,6 +9,14 @@
#include <objtool/builtin.h>
#include <objtool/endianness.h>
+bool arch_ftrace_match(char *name)
+{
+ if ((!strcmp(name, "_mcount")) || (!strcmp(name, "._mcount")))
+ return true;
+
+ return false;
+}
+
unsigned long arch_dest_reloc_offset(int addend)
{
return addend;
@@ -41,12 +49,26 @@ int arch_decode_instruction(struct objtool_file *file, const struct section *sec
struct list_head *ops_list)
{
u32 insn;
+ unsigned int opcode;
*immediate = 0;
insn = bswap_if_needed(file->elf, *(u32 *)(sec->data->d_buf + offset));
*len = 4;
*type = INSN_OTHER;
+ opcode = insn >> 26;
+
+ switch (opcode) {
+ case 18: /* bl */
+ if ((insn & 3) == 1) {
+ *type = INSN_CALL;
+ *immediate = insn & 0x3fffffc;
+ if (*immediate & 0x2000000)
+ *immediate -= 0x4000000;
+ }
+ break;
+ }
+
return 0;
}
@@ -4,5 +4,7 @@
#define _OBJTOOL_ARCH_ELF
#define R_NONE R_PPC_NONE
+#define R_ABS64 R_PPC64_ADDR64
+#define R_ABS32 R_PPC_ADDR32
#endif /* _OBJTOOL_ARCH_ELF */
This patch enables objtool --mcount on powerpc, and adds implementation specific to powerpc. Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com> --- arch/powerpc/Kconfig | 1 + tools/objtool/arch/powerpc/decode.c | 22 +++++++++++++++++++ tools/objtool/arch/powerpc/include/arch/elf.h | 2 ++ 3 files changed, 25 insertions(+)