Re: [RFC][PATCH 04/16] objtool: Annotate identity_mapped()

Peter Zijlstra
2020-03-13T14:34:36Z

On Thu, Mar 12, 2020 at 02:41:11PM +0100, Peter Zijlstra wrote:

> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -416,7 +416,7 @@ static void add_ignores(struct objtool_f
>
> case STT_SECTION:
> func = find_symbol_by_offset(rela->sym->sec, rela->addend);
> - if (!func || func->type != STT_FUNC)
> + if (!func || (func->type != STT_FUNC && func->type != STT_NOTYPE))
> continue;
> break;
>
> @@ -425,7 +425,7 @@ static void add_ignores(struct objtool_f
> continue;
> }
>
> - func_for_each_insn(file, func, insn)
> + sym_for_each_insn(file, func, insn)
> insn->ignore = true;
> }
> }

This conflicts with:

7acfe5315312 ("objtool: Improve call destination function detection")

which wasn't in the tree we were working against :/

I've resolved it something like so.

---
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -406,7 +406,7 @@ static void add_ignores(struct objtool_f
{
struct instruction *insn;
struct section *sec;
- struct symbol *func;
+ struct symbol *sym;
struct rela *rela;

sec = find_section_by_name(file->elf, ".rela.discard.func_stack_frame_non_standard");
@@ -416,12 +416,12 @@ static void add_ignores(struct objtool_f
list_for_each_entry(rela, &sec->rela_list, list) {
switch (rela->sym->type) {
case STT_FUNC:
- func = rela->sym;
+ sym = rela->sym;
break;

case STT_SECTION:
- func = find_func_by_offset(rela->sym->sec, rela->addend);
- if (!func)
+ sym = find_symbol_by_offset(rela->sym->sec, rela->addend);
+ if (!sym || (sym->type != STT_FUNC || sym->type != STT_NOTYPE))
continue;
break;

@@ -430,7 +430,7 @@ static void add_ignores(struct objtool_f
continue;
}

- sym_for_each_insn(file, func, insn)
+ sym_for_each_insn(file, sym, insn)
insn->ignore = true;
}
}