Skip to content

Commit 41425eb

Browse files
samitolvanenkees
authored andcommitted
objtool: Split noinstr validation from --vmlinux
This change adds a --noinstr flag to objtool to allow us to specify that we're processing vmlinux.o without also enabling noinstr validation. This is needed to avoid false positives with LTO when we run objtool on vmlinux.o without CONFIG_DEBUG_ENTRY. Signed-off-by: Sami Tolvanen <[email protected]>
1 parent 6dafca9 commit 41425eb

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

scripts/link-vmlinux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ objtool_link()
106106
local objtoolopt;
107107

108108
if [ -n "${CONFIG_VMLINUX_VALIDATION}" ]; then
109-
objtoolopt="check --vmlinux"
109+
objtoolopt="check --vmlinux --noinstr"
110110
if [ -z "${CONFIG_FRAME_POINTER}" ]; then
111111
objtoolopt="${objtoolopt} --no-fp"
112112
fi

tools/objtool/builtin-check.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "builtin.h"
1919
#include "objtool.h"
2020

21-
bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, validate_dup, vmlinux, mcount;
21+
bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, validate_dup, vmlinux, mcount, noinstr;
2222

2323
static const char * const check_usage[] = {
2424
"objtool check [<options>] file.o",
@@ -34,6 +34,7 @@ const struct option check_options[] = {
3434
OPT_BOOLEAN('a', "uaccess", &uaccess, "enable uaccess checking"),
3535
OPT_BOOLEAN('s', "stats", &stats, "print statistics"),
3636
OPT_BOOLEAN('d', "duplicate", &validate_dup, "duplicate validation for vmlinux.o"),
37+
OPT_BOOLEAN('n', "noinstr", &noinstr, "noinstr validation for vmlinux.o"),
3738
OPT_BOOLEAN('l', "vmlinux", &vmlinux, "vmlinux.o validation"),
3839
OPT_BOOLEAN('M', "mcount", &mcount, "generate __mcount_loc"),
3940
OPT_END(),

tools/objtool/builtin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <subcmd/parse-options.h>
99

1010
extern const struct option check_options[];
11-
extern bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, validate_dup, vmlinux, mcount;
11+
extern bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, validate_dup, vmlinux, mcount, noinstr;
1212

1313
extern int cmd_check(int argc, const char **argv);
1414
extern int cmd_orc(int argc, const char **argv);

tools/objtool/check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static void init_insn_state(struct insn_state *state, struct section *sec)
244244
* not correctly determine insn->call_dest->sec (external symbols do
245245
* not have a section).
246246
*/
247-
if (vmlinux && sec)
247+
if (vmlinux && noinstr && sec)
248248
state->noinstr = sec->noinstr;
249249
}
250250

0 commit comments

Comments
 (0)