objtool: Rework instruction -> symbol mapping
authorPeter Zijlstra <peterz@infradead.org>
Thu, 22 Sep 2022 20:03:50 +0000 (22:03 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 17 Oct 2022 14:41:08 +0000 (16:41 +0200)
commitdbcdbdfdf137b49144204571f1a5e5dc01b8aaad
treef5742bcb8b527eb18ddca99a96e77c5540aba472
parent08ef8c40112b8cd157515cd532f65cb82c934a76
objtool: Rework instruction -> symbol mapping

Currently insn->func contains a instruction -> symbol link for
STT_FUNC symbols. A NULL value is assumed to mean STT_NOTYPE.
However, there are also instructions not covered by any symbol at all.
This can happen due to __weak symbols for example.

Since the current scheme cannot differentiate between no symbol and
STT_NOTYPE symbol, change things around. Make insn->sym point to any
symbol type such that !insn->sym means no symbol and add a helper
insn_func() that check the sym->type to retain the old functionality.

This then prepares the way to add code that depends on the distinction
between STT_NOTYPE and no symbol at all.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
tools/objtool/check.c
tools/objtool/include/objtool/check.h