Skip to content

Commit b401efc

Browse files
jpoimboesuryasaimadhu
authored andcommitted
objtool: Fix switch table detection in .text.unlikely
If a switch jump table's indirect branch is in a ".cold" subfunction in .text.unlikely, objtool doesn't detect it, and instead prints a false warning: drivers/media/v4l2-core/v4l2-ioctl.o: warning: objtool: v4l_print_format.cold()+0xd6: sibling call from callable instruction with modified stack frame drivers/hwmon/max6650.o: warning: objtool: max6650_probe.cold()+0xa5: sibling call from callable instruction with modified stack frame drivers/media/dvb-frontends/drxk_hard.o: warning: objtool: init_drxk.cold()+0x16f: sibling call from callable instruction with modified stack frame Fix it by comparing the function, instead of the section and offset. Fixes: 1381043 ("objtool: Support GCC 8's cold subfunctions") Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/157c35d42ca9b6354bbb1604fe9ad7d1153ccb21.1585761021.git.jpoimboe@redhat.com
1 parent e81e072 commit b401efc

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tools/objtool/check.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,10 +1050,7 @@ static struct rela *find_jump_table(struct objtool_file *file,
10501050
* it.
10511051
*/
10521052
for (;
1053-
&insn->list != &file->insn_list &&
1054-
insn->sec == func->sec &&
1055-
insn->offset >= func->offset;
1056-
1053+
&insn->list != &file->insn_list && insn->func && insn->func->pfunc == func;
10571054
insn = insn->first_jump_src ?: list_prev_entry(insn, list)) {
10581055

10591056
if (insn != orig_insn && insn->type == INSN_JUMP_DYNAMIC)

0 commit comments

Comments
 (0)