[RFC v2 2/6] objtool: ignore instructions
From: Nadav Amit
Date: Mon Dec 31 2018 - 02:21:04 EST
In certain cases there is a need to suppress objtool warnings on
specific instructions. Provide an interface to achieve this goal.
Signed-off-by: Nadav Amit <namit@xxxxxxxxxx>
---
tools/objtool/check.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 0414a0d52262..c890d714fb73 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -431,10 +431,11 @@ static int add_dead_ends(struct objtool_file *file)
/*
* Warnings shouldn't be reported for ignored functions.
*/
-static void add_ignores(struct objtool_file *file)
+static int add_ignores(struct objtool_file *file)
{
struct instruction *insn;
struct section *sec;
+ struct rela *rela;
struct symbol *func;
for_each_sec(file, sec) {
@@ -449,6 +450,20 @@ static void add_ignores(struct objtool_file *file)
insn->ignore = true;
}
}
+
+ sec = find_section_by_name(file->elf, ".rela.discard.ignore");
+ if (!sec)
+ return 0;
+
+ list_for_each_entry(rela, &sec->rela_list, list) {
+ insn = find_insn(file, rela->sym->sec, rela->addend);
+ if (!insn) {
+ WARN("bad .discard.ignore entry");
+ return -1;
+ }
+ insn->ignore = true;
+ }
+ return 0;
}
/*
@@ -1237,7 +1252,9 @@ static int decode_sections(struct objtool_file *file)
if (ret)
return ret;
- add_ignores(file);
+ ret = add_ignores(file);
+ if (ret)
+ return ret;
ret = add_nospec_ignores(file);
if (ret)
--
2.17.1