ANDROID: objtool: Find a destination for jumps beyond the section end

With -ffunction-sections, Clang can generate a jump beyond the end of a
section when the section ends in an unreachable instruction. If the
offset matches the section length, use the last instruction as the jump
destination.

Bug: 145210207
Change-Id: I422b805fe0e857915f0726404d14f62c01629849
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
Sami Tolvanen
2020-08-14 14:38:01 -07:00
committed by Alistair Delva
parent 66d2edaa08
commit a4e9712d70

View File

@@ -908,6 +908,10 @@ static int add_jump_destinations(struct objtool_file *file)
}
insn->jump_dest = find_insn(file, dest_sec, dest_off);
if (!insn->jump_dest && dest_sec->len == dest_off)
insn->jump_dest = find_last_insn(file, dest_sec);
if (!insn->jump_dest) {
/*