objtool: Fix sibling call detection in alternatives
authorJosh Poimboeuf <jpoimboe@redhat.com>
Mon, 11 Apr 2022 23:10:31 +0000 (16:10 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 19 Apr 2022 19:58:53 +0000 (21:58 +0200)
commit34c861e806478ac2ea4032721defbf1d6967df08
tree269a298da66a4fb2d61878b7f6b5217d9234867e
parent26ff604102c98df79c3fe2614d1b9bb068d4c28c
objtool: Fix sibling call detection in alternatives

In add_jump_destinations(), sibling call detection requires 'insn->func'
to be valid.  But alternative instructions get their 'func' set in
handle_group_alt(), which runs *after* add_jump_destinations().  So
sibling calls in alternatives code don't get properly detected.

Fix that by changing the initialization order: call
add_special_section_alts() *before* add_jump_destinations().

This also means the special case for a missing 'jump_dest' in
add_jump_destinations() can be removed, as it has already been dealt
with.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/c02e0a0a2a4286b5f848d17c77fdcb7e0caf709c.1649718562.git.jpoimboe@redhat.com
tools/objtool/check.c