In order to use the .call_sites and .tail_call_sites sections beyond the
call-depth-tracking skylake thing, give it a more generic name.
Specifically it will be used to 'relink' all direct calls to avoid ENDBR.
A compiler could only hope to do this using an LTO pass, and even then the
dynamic linker would need to get involved.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
scripts/Makefile.lib | 2 +-
tools/objtool/builtin-check.c | 8 ++------
tools/objtool/check.c | 18 +++++++++---------
tools/objtool/include/objtool/builtin.h | 2 +-
4 files changed, 13 insertions(+), 17 deletions(-)
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -267,7 +267,7 @@ objtool := $(objtree)/tools/objtool/objt
objtool-args-$(CONFIG_HAVE_JUMP_LABEL_HACK) += --hacks=jump_label
objtool-args-$(CONFIG_HAVE_NOINSTR_HACK) += --hacks=noinstr
-objtool-args-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) += --hacks=skylake
+objtool-args-$(CONFIG_MITIGATION_CALL_DEPTH_TRACKING) += --direct-call
objtool-args-$(CONFIG_X86_KERNEL_IBT) += --ibt
objtool-args-$(CONFIG_FINEIBT) += --cfi
objtool-args-$(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL) += --mcount
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -57,17 +57,13 @@ static int parse_hacks(const struct opti
found = true;
}
- if (!str || strstr(str, "skylake")) {
- opts.hack_skylake = true;
- found = true;
- }
-
return found ? 0 : -1;
}
static const struct option check_options[] = {
OPT_GROUP("Actions:"),
- OPT_CALLBACK_OPTARG('h', "hacks", NULL, NULL, "jump_label,noinstr,skylake", "patch toolchain bugs/limitations", parse_hacks),
+ OPT_CALLBACK_OPTARG('h', "hacks", NULL, NULL, "jump_label,noinstr", "patch toolchain bugs/limitations", parse_hacks),
+ OPT_BOOLEAN(0, "direct-call", &opts.direct_call, "annotate direct calls"),
OPT_BOOLEAN('i', "ibt", &opts.ibt, "validate and annotate IBT"),
OPT_BOOLEAN('m', "mcount", &opts.mcount, "annotate mcount/fentry calls for ftrace"),
OPT_BOOLEAN('n', "noinstr", &opts.noinstr, "validate noinstr rules"),
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -4838,16 +4838,16 @@ int check(struct objtool_file *file)
if (ret < 0)
goto out;
warnings += ret;
+ }
- if (opts.hack_skylake) {
- ret = create_direct_call_sections(file);
- if (ret < 0)
- goto out;
- ret = create_direct_tail_call_sections(file);
- if (ret < 0)
- goto out;
- warnings += ret;
- }
+ if (opts.direct_call) {
+ ret = create_direct_call_sections(file);
+ if (ret < 0)
+ goto out;
+ ret = create_direct_tail_call_sections(file);
+ if (ret < 0)
+ goto out;
+ warnings += ret;
}
if (opts.mcount) {
--- a/tools/objtool/include/objtool/builtin.h
+++ b/tools/objtool/include/objtool/builtin.h
@@ -12,7 +12,7 @@ struct opts {
bool dump_orc;
bool hack_jump_label;
bool hack_noinstr;
- bool hack_skylake;
+ bool direct_call;
bool ibt;
bool mcount;
bool noinstr;