Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1733094pxm; Thu, 24 Feb 2022 08:22:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwb0lKY4KZmNa23NMex0Y8IQeo3rTVmNNiBoXXZD8L+bzuUr0OZNlGToHLXqpFmNgnvOdej X-Received: by 2002:a17:90a:a887:b0:1bc:388a:329f with SMTP id h7-20020a17090aa88700b001bc388a329fmr3559157pjq.17.1645719775891; Thu, 24 Feb 2022 08:22:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645719775; cv=none; d=google.com; s=arc-20160816; b=Cn9JcFBu9YQSncOHuQcbfCU7vv/pEASl3VZveG1qybkTvbz2em8cIO5NnQ+hgmV/M4 eFYfsQVUfIS2C3ckB78wyUIQhdgHhWtdAZAfGdghIOWB3VGp6g88vCrevlDV8UWJZ1BR qQErK/DpJruHce3lr883E/JiJhujIs2HaBDZbzWYSl6x+pZ4ZO0YERAg8HeiUwDppnXQ nz+4IlY1IZNFJL6KJnyKzJf4t4nvB1kp4VHkbtn4rUf4jRW+d68LlJYS4uYk0eE3X4Cu T8Kv5pJ8n9IhTd/ee/663erETLsi9Axp8V+PU24qwBKw0rM4cmBPxeVKGYcztXZnPgzj Or1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=EDcZkOwfCv4RG9ZzpyPfM/cN7SvU9YhUbl7JvP6h7OQ=; b=P5IM7dCpXGMffCII5DcDkCFKaUaIWEljP/2r+7pqY60Qicb6QEzfisNML1KTA9z42b 1HG4lCg/D4w/FABwY3o6d7h0VQT2YT8Td7ENjAkiobMH27A6HCTq9gmqSCaE86mpcPVN JFDgZaRBSXMgxd9Z4X2vJpQTeFYXACzO0Ht+TXV7yYrfxvxfJ0PF/6lQjokvWrQDCSYH EbkECJ8014ob/+dtxZufqyIBaGo9cDGggPIkVVn9CW2cFcwDNCNuLA+TWy5sdesDeKbb sl5y4k8exHxabGaazLtvck95PiJAqfeB+ug6Gpfb0Ts0QklXnrVr8j0VxW6QJo3Nq+9d TRRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ZmiJDser; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k12si2546067pls.1.2022.02.24.08.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 08:22:55 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ZmiJDser; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C48D018E43A; Thu, 24 Feb 2022 08:13:03 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235990AbiBXPSg (ORCPT + 99 others); Thu, 24 Feb 2022 10:18:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235955AbiBXPS1 (ORCPT ); Thu, 24 Feb 2022 10:18:27 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1B25145635 for ; Thu, 24 Feb 2022 07:17:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=EDcZkOwfCv4RG9ZzpyPfM/cN7SvU9YhUbl7JvP6h7OQ=; b=ZmiJDsere64QUHr9s94nVcED1o Vs84iC/DQzsSfGsMziPGsyvhiLyF5zaAj4LX8RrcDSDyQp3RFM15kHGog4ZffvC8HVxdg1IjPzajz QwwAjcVg88HEiPOQ/p1DwkMpvn5TxWdJnu0sEBuKguMtszyIwYMheLFkJyhDLtP3abywboimp+m2Q TOqJeG/X5V8bxlKlbcin/lSFPz8YD6aTc5uZedLRP5SjpiXSW8BHj0AZsBv8PMI8dAmkcT9u3j+tp qA3UX2VO3BcGxgAQnKSoKqiX5IP+HIG9gUI8u6xkAp/lFxhqBFS4wymSWhv/kdJP06Gm6XVf5rbw5 NOzPKRhQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNFs2-004s1o-Js; Thu, 24 Feb 2022 15:17:30 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5E16B3000E3; Thu, 24 Feb 2022 16:17:28 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 2C3DB29E75E4F; Thu, 24 Feb 2022 16:17:28 +0100 (CET) Message-ID: <20220224151322.248747148@infradead.org> User-Agent: quilt/0.66 Date: Thu, 24 Feb 2022 15:51:42 +0100 From: Peter Zijlstra To: x86@kernel.org, joao@overdrivepizza.com, hjl.tools@gmail.com, jpoimboe@redhat.com, andrew.cooper3@citrix.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, ndesaulniers@google.com, keescook@chromium.org, samitolvanen@google.com, mark.rutland@arm.com, alyssa.milburn@intel.com, mbenes@suse.cz, rostedt@goodmis.org, mhiramat@kernel.org, alexei.starovoitov@gmail.com Subject: [PATCH v2 04/39] objtool: Add --dry-run References: <20220224145138.952963315@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a --dry-run argument to skip writing the modifications. This is convenient for debugging. Signed-off-by: Peter Zijlstra (Intel) --- tools/objtool/builtin-check.c | 3 ++- tools/objtool/elf.c | 3 +++ tools/objtool/include/objtool/builtin.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -20,7 +20,7 @@ #include bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, - validate_dup, vmlinux, mcount, noinstr, backup, sls; + validate_dup, vmlinux, mcount, noinstr, backup, sls, dryrun; static const char * const check_usage[] = { "objtool check [] file.o", @@ -46,6 +46,7 @@ const struct option check_options[] = { OPT_BOOLEAN('M', "mcount", &mcount, "generate __mcount_loc"), OPT_BOOLEAN('B', "backup", &backup, "create .orig files before modification"), OPT_BOOLEAN('S', "sls", &sls, "validate straight-line-speculation"), + OPT_BOOLEAN(0, "dry-run", &dryrun, "don't write the modifications"), OPT_END(), }; --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -1019,6 +1019,9 @@ int elf_write(struct elf *elf) struct section *sec; Elf_Scn *s; + if (dryrun) + return 0; + /* Update changed relocation sections and section headers: */ list_for_each_entry(sec, &elf->sections, list) { if (sec->changed) { --- a/tools/objtool/include/objtool/builtin.h +++ b/tools/objtool/include/objtool/builtin.h @@ -9,7 +9,7 @@ extern const struct option check_options[]; extern bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats, - validate_dup, vmlinux, mcount, noinstr, backup, sls; + validate_dup, vmlinux, mcount, noinstr, backup, sls, dryrun; extern int cmd_parse_options(int argc, const char **argv, const char * const usage[]);