summaryrefslogtreecommitdiff
path: root/tools/objtool/arch/powerpc/decode.c
diff options
context:
space:
mode:
authorTiezhu Yang <yangtiezhu@loongson.cn>2025-02-11 19:50:11 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-10 14:44:35 +0200
commit4f47818652684c185210a4c625e757f9e08d2e95 (patch)
tree3078481dff18b2c64ada1c33a3374936a27ac283 /tools/objtool/arch/powerpc/decode.c
parent5c747362c357cd2c91331a0aee28576c8589c688 (diff)
downloadlinux-4f47818652684c185210a4c625e757f9e08d2e95.tar.gz
linux-4f47818652684c185210a4c625e757f9e08d2e95.tar.bz2
linux-4f47818652684c185210a4c625e757f9e08d2e95.zip
objtool: Handle different entry size of rodata
[ Upstream commit 091bf313f8a852a7f30c3a8dcef569edfd06f5dc ] In the most cases, the entry size of rodata is 8 bytes because the relocation type is 64 bit. There are also 32 bit relocation types, the entry size of rodata should be 4 bytes in this case. Add an arch-specific function arch_reloc_size() to assign the entry size of rodata for x86, powerpc and LoongArch. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Link: https://lore.kernel.org/r/20250211115016.26913-3-yangtiezhu@loongson.cn Acked-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Stable-dep-of: ef753d66051c ("objtool: Fix detection of consecutive jump tables on Clang 20") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/objtool/arch/powerpc/decode.c')
-rw-r--r--tools/objtool/arch/powerpc/decode.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/objtool/arch/powerpc/decode.c b/tools/objtool/arch/powerpc/decode.c
index 53b55690f320..7c0bf2429067 100644
--- a/tools/objtool/arch/powerpc/decode.c
+++ b/tools/objtool/arch/powerpc/decode.c
@@ -106,3 +106,17 @@ void arch_initial_func_cfi_state(struct cfi_init_state *state)
state->regs[CFI_RA].base = CFI_CFA;
state->regs[CFI_RA].offset = 0;
}
+
+unsigned int arch_reloc_size(struct reloc *reloc)
+{
+ switch (reloc_type(reloc)) {
+ case R_PPC_REL32:
+ case R_PPC_ADDR32:
+ case R_PPC_UADDR32:
+ case R_PPC_PLT32:
+ case R_PPC_PLTREL32:
+ return 4;
+ default:
+ return 8;
+ }
+}