From a4e9712d709065d9b5ca0335a230b5f1313fe092 Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Fri, 14 Aug 2020 14:38:01 -0700 Subject: [PATCH] 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 --- tools/objtool/check.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index cc85f542cc64..d82082879049 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -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) { /*