[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211122170805.211049036@infradead.org>
Date: Mon, 22 Nov 2021 18:03:05 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: x86@...nel.org, joao@...rdrivepizza.com, hjl.tools@...il.com,
jpoimboe@...hat.com, andrew.cooper3@...rix.com
Cc: linux-kernel@...r.kernel.org, peterz@...radead.org,
ndesaulniers@...gle.com, keescook@...omium.org,
samitolvanen@...gle.com
Subject: [RFC][PATCH 4/6] objtool: Read the _THIS_IP_ hints
Read the new _THIS_IP_ annotation. While there, attempt to not bloat
struct instruction.
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
tools/objtool/check.c | 27 +++++++++++++++++++++++++++
tools/objtool/include/objtool/check.h | 13 ++++++++++---
2 files changed, 37 insertions(+), 3 deletions(-)
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1854,6 +1854,29 @@ static int read_unwind_hints(struct objt
return 0;
}
+static int read_this_ip_hints(struct objtool_file *file)
+{
+ struct section *sec;
+ struct instruction *insn;
+ struct reloc *reloc;
+
+ sec = find_section_by_name(file->elf, ".rela.discard.this_ip");
+ 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.this_ip entry");
+ return -1;
+ }
+
+ insn->this_ip = 1;
+ }
+
+ return 0;
+}
+
static int read_retpoline_hints(struct objtool_file *file)
{
struct section *sec;
@@ -2066,6 +2089,10 @@ static int decode_sections(struct objtoo
if (ret)
return ret;
+ ret = read_this_ip_hints(file);
+ if (ret)
+ return ret;
+
/*
* Must be before add_{jump_call}_destination.
*/
--- a/tools/objtool/include/objtool/check.h
+++ b/tools/objtool/include/objtool/check.h
@@ -45,11 +45,18 @@ struct instruction {
unsigned int len;
enum insn_type type;
unsigned long immediate;
- bool dead_end, ignore, ignore_alts;
- bool hint;
- bool retpoline_safe;
+
+ u8 dead_end : 1,
+ ignore : 1,
+ ignore_alts : 1,
+ hint : 1,
+ retpoline_safe : 1,
+ this_ip : 1;
+ /* 2 bit hole */
s8 instr;
u8 visited;
+ /* u8 hole */
+
struct alt_group *alt_group;
struct symbol *call_dest;
struct instruction *jump_dest;
Powered by blists - more mailing lists