]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
objtool: Fix standalone --hacks=jump_label
authorDylan Hatch <dylanbhatch@google.com>
Tue, 23 Sep 2025 00:49:41 +0000 (00:49 +0000)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 14 Oct 2025 21:45:21 +0000 (14:45 -0700)
The objtool command line 'objtool --hacks=jump_label foo.o' on its own
should be expected to rewrite jump labels to NOPs. This means the
add_special_section_alts() code path needs to run when only this option
is provided.

This is mainly relevant in certain debugging situations, but could
potentially also fix kernel builds in which objtool is run with
--hacks=jump_label but without --orc, --stackval, --uaccess, or
--hacks=noinstr.

Fixes: de6fbcedf5ab ("objtool: Read special sections with alts only when specific options are selected")
Signed-off-by: Dylan Hatch <dylanbhatch@google.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
tools/objtool/check.c

index a5770570b106f3ba96d2f1c715c67e07d3e74e4f..b0e6479154eec6ce8ddd495f441e62d038502d6d 100644 (file)
@@ -2563,7 +2563,8 @@ static int decode_sections(struct objtool_file *file)
         * Must be before add_jump_destinations(), which depends on 'func'
         * being set for alternatives, to enable proper sibling call detection.
         */
-       if (opts.stackval || opts.orc || opts.uaccess || opts.noinstr) {
+       if (opts.stackval || opts.orc || opts.uaccess || opts.noinstr ||
+           opts.hack_jump_label) {
                ret = add_special_section_alts(file);
                if (ret)
                        return ret;