objtool: Ignore unreachable fake jumps
authorJulien Thierry <jthierry@redhat.com>
Tue, 15 Sep 2020 07:53:17 +0000 (08:53 +0100)
committerJosh Poimboeuf <jpoimboe@redhat.com>
Fri, 18 Sep 2020 17:04:00 +0000 (12:04 -0500)
It is possible for alternative code to unconditionally jump out of the
alternative region. In such a case, if a fake jump is added at the end
of the alternative instructions, the fake jump will never be reached.
Since the fake jump is just a mean to make sure code validation does not
go beyond the set of alternatives, reaching it is not a requirement.

Signed-off-by: Julien Thierry <jthierry@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
tools/objtool/check.c

index fd2edab8e6728398b3f7db77e74ebee8d4e38c32..cd7c6698d31692bf0b103e4ba9859366e5fdb610 100644 (file)
@@ -2648,6 +2648,9 @@ static bool ignore_unreachable_insn(struct instruction *insn)
            !strcmp(insn->sec->name, ".altinstr_aux"))
                return true;
 
+       if (insn->type == INSN_JUMP_UNCONDITIONAL && insn->offset == FAKE_JUMP_OFFSET)
+               return true;
+
        if (!insn->func)
                return false;