Subject: Re: [PATCH v3 00/16] objtool: Enable and implement --mcount option on powerpc

From: Peter Zijlstra <[email-masked]>
Date: Tue, 13 Sep 2022 16:13:52 +0200

On Mon, Sep 12, 2022 at 01:50:04PM +0530, Sathvika Vasireddy wrote:
> Christophe Leroy (4):
>   objtool: Fix SEGFAULT
>   objtool: Use target file endianness instead of a compiled constant
>   objtool: Use target file class size instead of a compiled constant

> Sathvika Vasireddy (12):
>   objtool: Add --mnop as an option to --mcount
>   objtool: Read special sections with alts only when specific options are selected
>   objtool: Use macros to define arch specific reloc types
>   objtool: Add arch specific function arch_ftrace_match()
>   objtool/powerpc: Enable objtool to be built on ppc
>   objtool/powerpc: Add --mcount specific implementation

>  tools/objtool/arch/powerpc/Build              |   2 +
>  tools/objtool/arch/powerpc/decode.c           | 101 ++++++++++++++++++
>  .../arch/powerpc/include/arch/cfi_regs.h      |  11 ++
>  tools/objtool/arch/powerpc/include/arch/elf.h |  10 ++
>  .../arch/powerpc/include/arch/special.h       |  21 ++++
>  tools/objtool/arch/powerpc/special.c          |  19 ++++
>  tools/objtool/arch/x86/decode.c               |   5 +
>  tools/objtool/arch/x86/include/arch/elf.h     |   2 +
>  .../arch/x86/include/arch/endianness.h        |   9 --
>  tools/objtool/builtin-check.c                 |  14 +++
>  tools/objtool/check.c                         |  53 ++++-----
>  tools/objtool/elf.c                           |   8 +-
>  tools/objtool/include/objtool/arch.h          |   2 +
>  tools/objtool/include/objtool/builtin.h       |   1 +
>  tools/objtool/include/objtool/elf.h           |   8 ++
>  tools/objtool/include/objtool/endianness.h    |  32 +++---
>  tools/objtool/orc_dump.c                      |  11 +-
>  tools/objtool/orc_gen.c                       |   4 +-
>  tools/objtool/special.c                       |   3 +-

This seems to painlessly merge with the objtool changes I have in
queue.git/call-depth-tracking. After that all I need is the below little
patch to make it to build ppc44x_defconfig + CONFIG_DYNAMIC_FTRACE=y.

So I think these patches can go through the powerpc tree if Michael
wants. Josh you okay with that, or should we do something complicated?

diff --git a/tools/objtool/arch/powerpc/decode.c b/tools/objtool/arch/powerpc/decode.c
index ea2b1968f0ee..8343e2c4cea0 100644
--- a/tools/objtool/arch/powerpc/decode.c
+++ b/tools/objtool/arch/powerpc/decode.c
@@ -24,6 +24,11 @@ bool arch_callee_saved_reg(unsigned char reg)
 	return false;
 }
 
+bool arch_pc_relative_reloc(struct reloc *reloc)
+{
+	exit(-1);
+}
+
 int arch_decode_hint_reg(u8 sp_reg, int *base)
 {
 	exit(-1);