From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B68FFC43334 for ; Sat, 16 Jul 2022 23:18:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233069AbiGPXR7 (ORCPT ); Sat, 16 Jul 2022 19:17:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232725AbiGPXRk (ORCPT ); Sat, 16 Jul 2022 19:17:40 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBF7922BE7 for ; Sat, 16 Jul 2022 16:17:28 -0700 (PDT) Message-ID: <20220716230953.265188514@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1658013446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=3supOg+sDQQOfSp9ifUSIygdjymw6D8ncsEppKfmHZA=; b=lprSnZOrYsVcKhla+weKD3GW8WaOjVFwhF5vQ7tqfZr7swIkUCxUaWUEmFfVrlVmf+P2Dl iBkimFBI6lVycjhXXYg3zoBkiocSn1AIOAl04A00I7oaarB1ExIr15g8LFG+UhXvxi4h60 rQzpNxoqDS0lQpA1mFgMXsjoWdSiFEnp07CX2uG3ezJJkdx1slb0RDpC7VG1YnfmnlIyZ1 VrtL2GWlu2Z6PDWQklZL5fkTL0O6djafREywpx18Ligr1JBEWofhHDTkEQ9I56OANqWhxD Fo4Dij2OfRM9xFAFjFUgOeVOApqT9CKKcKI6uyH5hsTcuKnTrK9lKSesZPi6kA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1658013446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=3supOg+sDQQOfSp9ifUSIygdjymw6D8ncsEppKfmHZA=; b=NYy2oXk2xptMAHSOgKlFJOeSqUAAOCZIiYPMmqpSGFiXoEU6nWjlfbJ1ADNlu0rCgNzxiL 0zGgfqqGJDYk+SBg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Linus Torvalds , Tim Chen , Josh Poimboeuf , Andrew Cooper , Pawan Gupta , Johannes Wikner , Alyssa Milburn , Jann Horn , "H.J. Lu" , Joao Moreira , Joseph Nuzman , Steven Rostedt , "Peter Zijlstra (Intel)" Subject: [patch 10/38] objtool: Add --hacks=skylake References: <20220716230344.239749011@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Sun, 17 Jul 2022 01:17:25 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra Make the call/func sections selectable via the --hacks option. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Thomas Gleixner --- scripts/Makefile.lib | 3 ++- tools/objtool/builtin-check.c | 7 ++++++- tools/objtool/check.c | 18 ++++++++++-------- tools/objtool/include/objtool/builtin.h | 1 + 4 files changed, 19 insertions(+), 10 deletions(-) --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -231,7 +231,8 @@ objtool := $(objtree)/tools/objtool/objt objtool_args = \ $(if $(CONFIG_HAVE_JUMP_LABEL_HACK), --hacks=jump_label) \ - $(if $(CONFIG_HAVE_NOINSTR_HACK), --hacks=noinstr) \ + $(if $(CONFIG_HAVE_NOINSTR_HACK), --hacks=noinstr) \ + $(if $(CONFIG_CALL_DEPTH_TRACKING), --hacks=skylake) \ $(if $(CONFIG_X86_KERNEL_IBT), --ibt) \ $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) \ $(if $(CONFIG_UNWINDER_ORC), --orc) \ --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -57,12 +57,17 @@ static int parse_hacks(const struct opti found = true; } + if (!str || strstr(str, "skylake")) { + opts.hack_skylake = true; + found = true; + } + return found ? 0 : -1; } const struct option check_options[] = { OPT_GROUP("Actions:"), - OPT_CALLBACK_OPTARG('h', "hacks", NULL, NULL, "jump_label,noinstr", "patch toolchain bugs/limitations", parse_hacks), + OPT_CALLBACK_OPTARG('h', "hacks", NULL, NULL, "jump_label,noinstr,skylake", "patch toolchain bugs/limitations", parse_hacks), 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 @@ -4372,15 +4372,17 @@ int check(struct objtool_file *file) goto out; warnings += ret; - ret = create_direct_call_sections(file); - if (ret < 0) - goto out; - warnings += ret; + if (opts.hack_skylake) { + ret = create_direct_call_sections(file); + if (ret < 0) + goto out; + warnings += ret; - ret = create_sym_thunk_sections(file); - if (ret < 0) - goto out; - warnings += ret; + ret = create_sym_thunk_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 @@ -14,6 +14,7 @@ struct opts { bool dump_orc; bool hack_jump_label; bool hack_noinstr; + bool hack_skylake; bool ibt; bool mcount; bool noinstr;