diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 9f83e85e2093..6d0ce2395554 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1305,26 +1305,24 @@ __weak bool arch_is_rethunk(struct symbol *sym) return false; } -#define NEGATIVE_RELOC ((void *)-1L) - static struct reloc *insn_reloc(struct objtool_file *file, struct instruction *insn) { - if (insn->reloc == NEGATIVE_RELOC) + struct reloc *reloc; + + if (insn->no_reloc) return NULL; - if (!insn->reloc) { - if (!file) - return NULL; + if (!file) + return NULL; - insn->reloc = find_reloc_by_dest_range(file->elf, insn->sec, - insn->offset, insn->len); - if (!insn->reloc) { - insn->reloc = NEGATIVE_RELOC; - return NULL; - } + reloc = find_reloc_by_dest_range(file->elf, insn->sec, + insn->offset, insn->len); + if (!reloc) { + insn->no_reloc = 1; + return NULL; } - return insn->reloc; + return reloc; } static void remove_insn_ops(struct instruction *insn) diff --git a/tools/objtool/include/objtool/check.h b/tools/objtool/include/objtool/check.h index a497ee7672fb..fffc8b86f9f3 100644 --- a/tools/objtool/include/objtool/check.h +++ b/tools/objtool/include/objtool/check.h @@ -55,8 +55,9 @@ struct instruction { retpoline_safe : 1, noendbr : 1, entry : 1, - visited : 4; - /* 3 bit hole */ + visited : 4, + no_reloc : 1; + /* 2 bit hole */ s8 instr; @@ -65,7 +66,6 @@ struct instruction { struct instruction *jump_dest; struct instruction *first_jump_src; struct reloc *jump_table; - struct reloc *reloc; struct alternative *alts; struct symbol *sym; struct stack_op *stack_ops;