objtool: Use macros to define arch specific reloc types
authorSathvika Vasireddy <sv@linux.ibm.com>
Mon, 14 Nov 2022 17:57:51 +0000 (23:27 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 18 Nov 2022 08:00:16 +0000 (19:00 +1100)
Make relocation types architecture specific.

Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221114175754.1131267-14-sv@linux.ibm.com
tools/objtool/arch/x86/include/arch/elf.h
tools/objtool/check.c

index 69cc426..ac14987 100644 (file)
@@ -2,5 +2,7 @@
 #define _OBJTOOL_ARCH_ELF
 
 #define R_NONE R_X86_64_NONE
+#define R_ABS64 R_X86_64_64
+#define R_ABS32 R_X86_64_32
 
 #endif /* _OBJTOOL_ARCH_ELF */
index 752a6ff..2d7153b 100644 (file)
@@ -885,7 +885,7 @@ static int create_mcount_loc_sections(struct objtool_file *file)
                memset(loc, 0, addrsize);
 
                if (elf_add_reloc_to_insn(file->elf, sec, idx,
-                                         R_X86_64_64,
+                                         addrsize == sizeof(u64) ? R_ABS64 : R_ABS32,
                                          insn->sec, insn->offset))
                        return -1;