summaryrefslogtreecommitdiff
path: root/tools/kvm
diff options
context:
space:
mode:
authorTiezhu Yang <yangtiezhu@loongson.cn>2025-02-11 19:50:12 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-10 14:44:35 +0200
commita7a8e0ccaf730b25b36d63bd4260307e99c5cda8 (patch)
tree102eaf03cb81190761b70d3cd5f5a4ca67eae3a9 /tools/kvm
parent4f47818652684c185210a4c625e757f9e08d2e95 (diff)
downloadlinux-a7a8e0ccaf730b25b36d63bd4260307e99c5cda8.tar.gz
linux-a7a8e0ccaf730b25b36d63bd4260307e99c5cda8.tar.bz2
linux-a7a8e0ccaf730b25b36d63bd4260307e99c5cda8.zip
objtool: Handle PC relative relocation type
[ Upstream commit c4b93b06230ae49870187189d9f7342f6ad4f14e ] For the most part, an absolute relocation type is used for rodata. In the case of STT_SECTION, reloc->sym->offset is always zero, for the other symbol types, reloc_addend(reloc) is always zero, thus it can use a simple statement "reloc->sym->offset + reloc_addend(reloc)" to obtain the symbol offset for various symbol types. When compiling on LoongArch, there exist PC relative relocation types for rodata, it needs to calculate the symbol offset with "S + A - PC" according to the spec of "ELF for the LoongArch Architecture". If there is only one jump table in the rodata, the "PC" is the entry address which is equal with the value of reloc_offset(reloc), at this time, reloc_offset(table) is 0. If there are many jump tables in the rodata, the "PC" is the offset of the jump table's base address which is equal with the value of reloc_offset(reloc) - reloc_offset(table). So for LoongArch, if the relocation type is PC relative, it can use a statement "reloc_offset(reloc) - reloc_offset(table)" to get the "PC" value when calculating the symbol offset with "S + A - PC" for one or many jump tables in the rodata. Add an arch-specific function arch_jump_table_sym_offset() to assign the symbol offset, for the most part that is an absolute relocation, the default value is "reloc->sym->offset + reloc_addend(reloc)" in the weak definition, it can be overridden by each architecture that has different requirements. Link: https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Link: https://lore.kernel.org/r/20250211115016.26913-4-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/kvm')
0 files changed, 0 insertions, 0 deletions