objtool: Read the NOENDBR annotation
Read the new NOENDBR annotation. While there, attempt to not bloat struct instruction. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lore.kernel.org/r/20220308154319.586815435@infradead.org
This commit is contained in:
parent
3515899bef
commit
96db4a988d
@ -1866,6 +1866,29 @@ static int read_unwind_hints(struct objtool_file *file)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int read_noendbr_hints(struct objtool_file *file)
|
||||||
|
{
|
||||||
|
struct section *sec;
|
||||||
|
struct instruction *insn;
|
||||||
|
struct reloc *reloc;
|
||||||
|
|
||||||
|
sec = find_section_by_name(file->elf, ".rela.discard.noendbr");
|
||||||
|
if (!sec)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
list_for_each_entry(reloc, &sec->reloc_list, list) {
|
||||||
|
insn = find_insn(file, reloc->sym->sec, reloc->sym->offset + reloc->addend);
|
||||||
|
if (!insn) {
|
||||||
|
WARN("bad .discard.noendbr entry");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
insn->noendbr = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int read_retpoline_hints(struct objtool_file *file)
|
static int read_retpoline_hints(struct objtool_file *file)
|
||||||
{
|
{
|
||||||
struct section *sec;
|
struct section *sec;
|
||||||
@ -2099,6 +2122,10 @@ static int decode_sections(struct objtool_file *file)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
ret = read_noendbr_hints(file);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be before add_{jump_call}_destination.
|
* Must be before add_{jump_call}_destination.
|
||||||
*/
|
*/
|
||||||
|
@ -45,11 +45,18 @@ struct instruction {
|
|||||||
unsigned int len;
|
unsigned int len;
|
||||||
enum insn_type type;
|
enum insn_type type;
|
||||||
unsigned long immediate;
|
unsigned long immediate;
|
||||||
bool dead_end, ignore, ignore_alts;
|
|
||||||
bool hint;
|
u8 dead_end : 1,
|
||||||
bool retpoline_safe;
|
ignore : 1,
|
||||||
|
ignore_alts : 1,
|
||||||
|
hint : 1,
|
||||||
|
retpoline_safe : 1,
|
||||||
|
noendbr : 1;
|
||||||
|
/* 2 bit hole */
|
||||||
s8 instr;
|
s8 instr;
|
||||||
u8 visited;
|
u8 visited;
|
||||||
|
/* u8 hole */
|
||||||
|
|
||||||
struct alt_group *alt_group;
|
struct alt_group *alt_group;
|
||||||
struct symbol *call_dest;
|
struct symbol *call_dest;
|
||||||
struct instruction *jump_dest;
|
struct instruction *jump_dest;
|
||||||
|
Loading…
Reference in New Issue
Block a user