objtool: Make static call annotation optional
As part of making objtool more modular, put the existing static call code behind a new '--static-call' option. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Link: https://lkml.kernel.org/r/d59ac57ef3d6d8380cdce20322314c9e2e556750.1650300597.git.jpoimboe@redhat.com
This commit is contained in:
parent
7206447496
commit
26e176896a
|
@ -233,6 +233,7 @@ objtool_args = \
|
||||||
$(if $(CONFIG_RETPOLINE), --retpoline) \
|
$(if $(CONFIG_RETPOLINE), --retpoline) \
|
||||||
$(if $(CONFIG_SLS), --sls) \
|
$(if $(CONFIG_SLS), --sls) \
|
||||||
$(if $(CONFIG_STACK_VALIDATION), --stackval) \
|
$(if $(CONFIG_STACK_VALIDATION), --stackval) \
|
||||||
|
$(if $(CONFIG_HAVE_STATIC_CALL_INLINE), --static-call) \
|
||||||
$(if $(CONFIG_X86_SMAP), --uaccess) \
|
$(if $(CONFIG_X86_SMAP), --uaccess) \
|
||||||
$(if $(part-of-module), --module) \
|
$(if $(part-of-module), --module) \
|
||||||
$(if $(CONFIG_GCOV_KERNEL), --no-unreachable)
|
$(if $(CONFIG_GCOV_KERNEL), --no-unreachable)
|
||||||
|
|
|
@ -141,11 +141,14 @@ objtool_link()
|
||||||
objtoolopt="${objtoolopt} --stackval"
|
objtoolopt="${objtoolopt} --stackval"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if is_enabled CONFIG_HAVE_STATIC_CALL_INLINE; then
|
||||||
|
objtoolopt="${objtoolopt} --static-call"
|
||||||
|
fi
|
||||||
|
|
||||||
if is_enabled CONFIG_X86_SMAP; then
|
if is_enabled CONFIG_X86_SMAP; then
|
||||||
objtoolopt="${objtoolopt} --uaccess"
|
objtoolopt="${objtoolopt} --uaccess"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
objtoolopt="${objtoolopt} --lto"
|
objtoolopt="${objtoolopt} --lto"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ const struct option check_options[] = {
|
||||||
OPT_BOOLEAN('r', "retpoline", &opts.retpoline, "validate and annotate retpoline usage"),
|
OPT_BOOLEAN('r', "retpoline", &opts.retpoline, "validate and annotate retpoline usage"),
|
||||||
OPT_BOOLEAN('l', "sls", &opts.sls, "validate straight-line-speculation mitigations"),
|
OPT_BOOLEAN('l', "sls", &opts.sls, "validate straight-line-speculation mitigations"),
|
||||||
OPT_BOOLEAN('s', "stackval", &opts.stackval, "validate frame pointer rules"),
|
OPT_BOOLEAN('s', "stackval", &opts.stackval, "validate frame pointer rules"),
|
||||||
|
OPT_BOOLEAN('t', "static-call", &opts.static_call, "annotate static calls"),
|
||||||
OPT_BOOLEAN('u', "uaccess", &opts.uaccess, "validate uaccess rules for SMAP"),
|
OPT_BOOLEAN('u', "uaccess", &opts.uaccess, "validate uaccess rules for SMAP"),
|
||||||
OPT_CALLBACK_OPTARG(0, "dump", NULL, NULL, "orc", "dump metadata", parse_dump),
|
OPT_CALLBACK_OPTARG(0, "dump", NULL, NULL, "orc", "dump metadata", parse_dump),
|
||||||
|
|
||||||
|
@ -93,6 +94,7 @@ static bool opts_valid(void)
|
||||||
opts.retpoline ||
|
opts.retpoline ||
|
||||||
opts.sls ||
|
opts.sls ||
|
||||||
opts.stackval ||
|
opts.stackval ||
|
||||||
|
opts.static_call ||
|
||||||
opts.uaccess) {
|
opts.uaccess) {
|
||||||
if (opts.dump_orc) {
|
if (opts.dump_orc) {
|
||||||
fprintf(stderr, "--dump can't be combined with other options\n");
|
fprintf(stderr, "--dump can't be combined with other options\n");
|
||||||
|
|
|
@ -3969,10 +3969,12 @@ int check(struct objtool_file *file)
|
||||||
warnings += ret;
|
warnings += ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = create_static_call_sections(file);
|
if (opts.static_call) {
|
||||||
if (ret < 0)
|
ret = create_static_call_sections(file);
|
||||||
goto out;
|
if (ret < 0)
|
||||||
warnings += ret;
|
goto out;
|
||||||
|
warnings += ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (opts.retpoline) {
|
if (opts.retpoline) {
|
||||||
ret = create_retpoline_sites_sections(file);
|
ret = create_retpoline_sites_sections(file);
|
||||||
|
|
|
@ -19,6 +19,7 @@ struct opts {
|
||||||
bool retpoline;
|
bool retpoline;
|
||||||
bool sls;
|
bool sls;
|
||||||
bool stackval;
|
bool stackval;
|
||||||
|
bool static_call;
|
||||||
bool uaccess;
|
bool uaccess;
|
||||||
|
|
||||||
/* options: */
|
/* options: */
|
||||||
|
|
Loading…
Reference in New Issue