Skip to content

Commit 26e1768

Browse files
jpoimboePeter Zijlstra
authored andcommitted
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Link: https://lkml.kernel.org/r/d59ac57ef3d6d8380cdce20322314c9e2e556750.1650300597.git.jpoimboe@redhat.com
1 parent 7206447 commit 26e1768

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

scripts/Makefile.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ objtool_args = \
233233
$(if $(CONFIG_RETPOLINE), --retpoline) \
234234
$(if $(CONFIG_SLS), --sls) \
235235
$(if $(CONFIG_STACK_VALIDATION), --stackval) \
236+
$(if $(CONFIG_HAVE_STATIC_CALL_INLINE), --static-call) \
236237
$(if $(CONFIG_X86_SMAP), --uaccess) \
237238
$(if $(part-of-module), --module) \
238239
$(if $(CONFIG_GCOV_KERNEL), --no-unreachable)

scripts/link-vmlinux.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,14 @@ objtool_link()
141141
objtoolopt="${objtoolopt} --stackval"
142142
fi
143143

144+
if is_enabled CONFIG_HAVE_STATIC_CALL_INLINE; then
145+
objtoolopt="${objtoolopt} --static-call"
146+
fi
147+
144148
if is_enabled CONFIG_X86_SMAP; then
145149
objtoolopt="${objtoolopt} --uaccess"
146150
fi
147151

148-
149152
objtoolopt="${objtoolopt} --lto"
150153
fi
151154

tools/objtool/builtin-check.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const struct option check_options[] = {
4040
OPT_BOOLEAN('r', "retpoline", &opts.retpoline, "validate and annotate retpoline usage"),
4141
OPT_BOOLEAN('l', "sls", &opts.sls, "validate straight-line-speculation mitigations"),
4242
OPT_BOOLEAN('s', "stackval", &opts.stackval, "validate frame pointer rules"),
43+
OPT_BOOLEAN('t', "static-call", &opts.static_call, "annotate static calls"),
4344
OPT_BOOLEAN('u', "uaccess", &opts.uaccess, "validate uaccess rules for SMAP"),
4445
OPT_CALLBACK_OPTARG(0, "dump", NULL, NULL, "orc", "dump metadata", parse_dump),
4546

@@ -93,6 +94,7 @@ static bool opts_valid(void)
9394
opts.retpoline ||
9495
opts.sls ||
9596
opts.stackval ||
97+
opts.static_call ||
9698
opts.uaccess) {
9799
if (opts.dump_orc) {
98100
fprintf(stderr, "--dump can't be combined with other options\n");

tools/objtool/check.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3969,10 +3969,12 @@ int check(struct objtool_file *file)
39693969
warnings += ret;
39703970
}
39713971

3972-
ret = create_static_call_sections(file);
3973-
if (ret < 0)
3974-
goto out;
3975-
warnings += ret;
3972+
if (opts.static_call) {
3973+
ret = create_static_call_sections(file);
3974+
if (ret < 0)
3975+
goto out;
3976+
warnings += ret;
3977+
}
39763978

39773979
if (opts.retpoline) {
39783980
ret = create_retpoline_sites_sections(file);

tools/objtool/include/objtool/builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct opts {
1919
bool retpoline;
2020
bool sls;
2121
bool stackval;
22+
bool static_call;
2223
bool uaccess;
2324

2425
/* options: */

0 commit comments

Comments
 (0)