Thread (64 messages) 64 messages, 10 authors, 2023-02-04

Re: [PATCH v2 13/16] objtool: Use macros to define arch specific reloc types

From: Christophe Leroy <hidden>
Date: 2022-08-30 06:34:01
Also in: lkml


Le 29/08/2022 à 07:52, Sathvika Vasireddy a écrit :
Make relocation types architecture specific.

Signed-off-by: Sathvika Vasireddy <redacted>
Reviewed-by: Christophe Leroy <redacted>
quoted hunk ↗ jump to hunk
---
  tools/objtool/arch/x86/include/arch/elf.h | 2 ++
  tools/objtool/check.c                     | 2 +-
  2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/objtool/arch/x86/include/arch/elf.h b/tools/objtool/arch/x86/include/arch/elf.h
index 69cc4264b28a..ac14987cf687 100644
--- a/tools/objtool/arch/x86/include/arch/elf.h
+++ b/tools/objtool/arch/x86/include/arch/elf.h
@@ -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 */
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 5298a143ceac..f1d055467926 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -883,7 +883,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;
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help