summaryrefslogtreecommitdiffstats
path: root/tools/objtool/check.c
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@kernel.org>2023-05-30 19:21:07 +0200
committerJosh Poimboeuf <jpoimboe@kernel.org>2023-06-07 19:03:22 +0200
commitfcee899d2794319c9dbeb7b877b0c4ac92f5dd16 (patch)
treed5878b621427d0613909257645ded8d0d4efc6f0 /tools/objtool/check.c
parentobjtool: Get rid of reloc->offset (diff)
downloadlinux-fcee899d2794319c9dbeb7b877b0c4ac92f5dd16.tar.xz
linux-fcee899d2794319c9dbeb7b877b0c4ac92f5dd16.zip
objtool: Get rid of reloc->type
Get the type from the embedded GElf_Rel[a] struct. Link: https://lore.kernel.org/r/d1c1f8da31e4f052a2478aea585fcf355cacc53a.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/check.c')
-rw-r--r--tools/objtool/check.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index e06ffad5a93c..04b4152be206 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -958,7 +958,7 @@ static int create_mcount_loc_sections(struct objtool_file *file)
if (!reloc)
return -1;
- reloc->type = addr_size == 8 ? R_ABS64 : R_ABS32;
+ set_reloc_type(reloc, addr_size == 8 ? R_ABS64 : R_ABS32);
idx++;
}
@@ -1354,7 +1354,7 @@ static void annotate_call_site(struct objtool_file *file,
*/
if (opts.hack_noinstr && insn->sec->noinstr && sym->profiling_func) {
if (reloc) {
- reloc->type = R_NONE;
+ set_reloc_type(reloc, R_NONE);
elf_write_reloc(file->elf, reloc);
}
@@ -1383,7 +1383,7 @@ static void annotate_call_site(struct objtool_file *file,
WARN_INSN(insn, "tail call to __fentry__ !?!?");
if (opts.mnop) {
if (reloc) {
- reloc->type = R_NONE;
+ set_reloc_type(reloc, R_NONE);
elf_write_reloc(file->elf, reloc);
}
@@ -1865,7 +1865,7 @@ static int handle_jump_alt(struct objtool_file *file,
struct reloc *reloc = insn_reloc(file, orig_insn);
if (reloc) {
- reloc->type = R_NONE;
+ set_reloc_type(reloc, R_NONE);
elf_write_reloc(file->elf, reloc);
}
elf_write_insn(file->elf, orig_insn->sec,
@@ -4277,7 +4277,8 @@ static int validate_ibt_insn(struct objtool_file *file, struct instruction *insn
continue;
off = reloc->sym->offset;
- if (reloc->type == R_X86_64_PC32 || reloc->type == R_X86_64_PLT32)
+ if (reloc_type(reloc) == R_X86_64_PC32 ||
+ reloc_type(reloc) == R_X86_64_PLT32)
off += arch_dest_reloc_offset(reloc->addend);
else
off += reloc->addend;