Re: [PATCH v2 15/16] objtool/powerpc: Enable objtool to be built on ppc
From: Christophe Leroy <hidden>
Date: 2022-09-01 09:32:58
Also in:
lkml
Le 29/08/2022 à 07:52, Sathvika Vasireddy a écrit :
This patch adds [stub] implementations for required functions, inorder to enable objtool build on powerpc. Signed-off-by: Sathvika Vasireddy <redacted> [Christophe Leroy: powerpc: Add missing asm/asm.h for objtool] Signed-off-by: Christophe Leroy <redacted> --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/asm.h | 7 ++ tools/objtool/arch/powerpc/Build | 2 + tools/objtool/arch/powerpc/decode.c | 74 +++++++++++++++++++ .../arch/powerpc/include/arch/cfi_regs.h | 11 +++ tools/objtool/arch/powerpc/include/arch/elf.h | 8 ++ .../arch/powerpc/include/arch/special.h | 21 ++++++ tools/objtool/arch/powerpc/special.c | 19 +++++ 8 files changed, 143 insertions(+) create mode 100644 arch/powerpc/include/asm/asm.h create mode 100644 tools/objtool/arch/powerpc/Build create mode 100644 tools/objtool/arch/powerpc/decode.c create mode 100644 tools/objtool/arch/powerpc/include/arch/cfi_regs.h create mode 100644 tools/objtool/arch/powerpc/include/arch/elf.h create mode 100644 tools/objtool/arch/powerpc/include/arch/special.h create mode 100644 tools/objtool/arch/powerpc/special.c
quoted hunk ↗ jump to hunk
+int arch_decode_instruction(struct objtool_file *file, const struct section *sec, + unsigned long offset, unsigned int maxlen, + unsigned int *len, enum insn_type *type, + unsigned long *immediate, + struct list_head *ops_list) +{ + u32 insn; + + *immediate = 0; + insn = bswap_if_needed(file->elf, *(u32 *)(sec->data->d_buf + offset)); + *len = 4;
Should be *len = 8 when insn >> 26 == 1. I will send you something later on.
quoted hunk ↗ jump to hunk
+ *type = INSN_OTHER; + + return 0; +} + +unsigned long arch_jump_destination(struct instruction *insn) +{ + return insn->offset + insn->immediate;
Two spaces after the + Should be only one.
quoted hunk ↗ jump to hunk
+} + +void arch_initial_func_cfi_state(struct cfi_init_state *state) +{ + int i; + + for (i = 0; i < CFI_NUM_REGS; i++) { + state->regs[i].base = CFI_UNDEFINED; + state->regs[i].offset = 0; + } + + /* initial CFA (call frame address) */ + state->cfa.base = CFI_SP; + state->cfa.offset = 0; + + /* initial LR (return address) */ + state->regs[CFI_RA].base = CFI_CFA; + state->regs[CFI_RA].offset = 0; +}