From patchwork Wed Jun 21 15:20:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 111145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4471258vqr; Wed, 21 Jun 2023 09:03:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4p4e2/U75DuI+ji9h0mU+/1IpsVVsQ8v8F7EgaTn4SVUBBXfIz5eZwaW63ZpzDRPrgdS7W X-Received: by 2002:a05:6a00:14c1:b0:668:8493:2552 with SMTP id w1-20020a056a0014c100b0066884932552mr9552633pfu.18.1687363389915; Wed, 21 Jun 2023 09:03:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687363389; cv=none; d=google.com; s=arc-20160816; b=Rh8raBmy4hGbUuFsOiYBaedVIyI6mtuH8loAwQf1yiglKDiNba5A692GvnF2kk3lKX xwkj/MzKEcMmA4wjOPOFQH0XFseliBKLFYT2pIhSugOWu/h3rif+u0PxzH3LvBknR5xt BzTJxQs4GTyruJSYdEM6Z2MYixZXejIJkF/BWluUio/GQvjnYmEyf8WhoZwugP6ue781 c2SPDUU4xxxKtMK7OGfWZuI9bzDPx7H7LB5FUoKzgUvnZhfKlxswFLYfTpmupK4Lvo1f 2Z3J3L4SuMtKuCOtZSw5dLz0/QD7Cn68bOfPDeE/56y8MNXlKjRQY59hTBPpGGJHLRQc oW5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=4f+mcooyDvaZTWnXHhSUB7Xqh2JCpivVsAirCOtHWSU=; b=u2+MMnP6ll/x6WNXeG/m1k0Txx8SayIXKsHJkG0j+wxYL7JwUSeECXm7RAZNo1DEy3 A2u2mMXj0gMncnnYO/8Do3f4p/c2nwJ7yGBjZoWmQsNjoa/uKUMPSCgUbqOAB0wlSxc1 +V73kMu83g0IxsDsegrI86f9MN5LnS0G+9q8svybRzKn36rWKTScSSGPA8Zo4abUCxDi LRaWJfWeF0DMP/357BmNBb4J8OH5o8fIvlqeJuyKib+YRdU/L3/DZ7B6yabkGlFVbxCM 2W0Tu1CJZ4DmIO1q5Q72OzH9cymMd85V8++KWSx6Nku1/ftKd3dMYlghibKyXcSYvg1C 2FVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=csgroup.eu Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b190-20020a621bc7000000b0065fe77bf291si1677791pfb.276.2023.06.21.09.02.56; Wed, 21 Jun 2023 09:03:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=csgroup.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231751AbjFUPW5 (ORCPT + 99 others); Wed, 21 Jun 2023 11:22:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbjFUPWe (ORCPT ); Wed, 21 Jun 2023 11:22:34 -0400 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 439EE2D7F for ; Wed, 21 Jun 2023 08:20:45 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4QmRz004c7z9sJj; Wed, 21 Jun 2023 17:20:44 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pCGSmOT-fKYY; Wed, 21 Jun 2023 17:20:43 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4QmRyx2PMJz9sJs; Wed, 21 Jun 2023 17:20:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4EE338B779; Wed, 21 Jun 2023 17:20:41 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id dIDcK9DBKVGZ; Wed, 21 Jun 2023 17:20:41 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [172.25.230.108]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 24B988B763; Wed, 21 Jun 2023 17:20:41 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 35LFKbuK2124260 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 21 Jun 2023 17:20:37 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 35LFKbQZ2124256; Wed, 21 Jun 2023 17:20:37 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Josh Poimboeuf , Peter Zijlstra Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] objtool: Make 'sec-address' always on Date: Wed, 21 Jun 2023 17:20:31 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687360830; l=2749; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=cug9KrnhkD0tWNRN91NqNAgvx0YYURd13fBg+W5IvHQ=; b=MSMupOM8tiZHXuHmbGUr+49tsvsHOoMqLJJr6dQ9WAhib0c9wQaeZlV1OoHElkm//dypb0DWq 8Ers3uhG87CCZKBc1aSQNebBr5BBhwJHfoFpOCSe2UDbQpXq9wSto2C X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, T_SCC_BODY_TEXT_LINE,T_SPF_HELO_TEMPERROR,T_SPF_TEMPERROR 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769328753895163048?= X-GMAIL-MSGID: =?utf-8?q?1769328753895163048?= Most of the time objtool warnings are useless without the absolute address within the section. Today there is --sec-address option to get it printed, but that option is nowhere used and requires a change in Makefile to use it. Having the address inside the section at all time in addition to the address within the object doesn't hurt and will help. Remove the --sec-address option and print it at all time. Signed-off-by: Christophe Leroy --- tools/objtool/builtin-check.c | 1 - tools/objtool/include/objtool/builtin.h | 1 - tools/objtool/include/objtool/warn.h | 6 ++---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 7c175198d09f..d5024a95467a 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -91,7 +91,6 @@ static const struct option check_options[] = { OPT_BOOLEAN(0, "module", &opts.module, "object is part of a kernel module"), OPT_BOOLEAN(0, "mnop", &opts.mnop, "nop out mcount call sites"), OPT_BOOLEAN(0, "no-unreachable", &opts.no_unreachable, "skip 'unreachable instruction' warnings"), - OPT_BOOLEAN(0, "sec-address", &opts.sec_address, "print section addresses in warnings"), OPT_BOOLEAN(0, "stats", &opts.stats, "print statistics"), OPT_END(), diff --git a/tools/objtool/include/objtool/builtin.h b/tools/objtool/include/objtool/builtin.h index 2a108e648b7a..af79618cf6ab 100644 --- a/tools/objtool/include/objtool/builtin.h +++ b/tools/objtool/include/objtool/builtin.h @@ -35,7 +35,6 @@ struct opts { bool mnop; bool module; bool no_unreachable; - bool sec_address; bool stats; }; diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/objtool/warn.h index b1c920dc9516..2db9717d0558 100644 --- a/tools/objtool/include/objtool/warn.h +++ b/tools/objtool/include/objtool/warn.h @@ -21,7 +21,6 @@ static inline char *offstr(struct section *sec, unsigned long offset) bool is_text = (sec->sh.sh_flags & SHF_EXECINSTR); struct symbol *sym = NULL; char *str; - int len; if (is_text) sym = find_func_containing(sec, offset); @@ -30,9 +29,8 @@ static inline char *offstr(struct section *sec, unsigned long offset) if (sym) { str = malloc(strlen(sym->name) + strlen(sec->name) + 40); - len = sprintf(str, "%s+0x%lx", sym->name, offset - sym->offset); - if (opts.sec_address) - sprintf(str+len, " (%s+0x%lx)", sec->name, offset); + sprintf(str, "%s+0x%lx (%s+0x%lx)", sym->name, + offset - sym->offset, sec->name, offset); } else { str = malloc(strlen(sec->name) + 20); sprintf(str, "%s+0x%lx", sec->name, offset);