From patchwork Fri Apr 14 14:47:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 83475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3046:b0:115:7a1d:dabb with SMTP id p6csp390212rwl; Fri, 14 Apr 2023 08:09:56 -0700 (PDT) X-Google-Smtp-Source: AKy350Yc9uIsDD19KkQ+BxgICIpyVzOKBYNrV3MIR2TX/qbN2mxhaz8cX7xK4avUsVHic922UwhC X-Received: by 2002:a6b:ef01:0:b0:753:1842:62dd with SMTP id k1-20020a6bef01000000b00753184262ddmr3367669ioh.16.1681484995830; Fri, 14 Apr 2023 08:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681484995; cv=none; d=google.com; s=arc-20160816; b=wVl417b6dkqhMXSYo2BQNeR9FpSWwVxtXU+e+y7go+RKLkrSY3OLJBd4mZRrrhL/nf 2CqxvQKR98nR1b5CWcNpfTunlRoknkf36/J0E6cPPOHAXlwaC4KoiR3Np7oqFT4nbQlO jLpfNfzoq6v/lMeAcxrPhofumKJ2n6SqAZk++LSsYOy9OekbxE0paCZDkyLueblWoEKM CiK9Z1sj0cBKdaZOcS/wqO6pV42dgimcFscz8gZyAhjBt9Rvf9XCd1WqKjLBKIWdXAPR pJ0K1lCe/QMTCiBqG3ppCsu6JY4wSC7b8NcS6Zg0KgRvluA3esucZm/CfMRhATIawBq+ 01uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=VG7mVoFKYJwmwqxRMylTOAMatqSty9eoz3docMXo/MU=; b=WVmKwY5lo1rZxEelFnuUZjqc5h1UVfeIXkJxd5NOH19a3ZwQpy8/if+ocK/1Ah59vK GbxTpx8XTqoFaxPAinsZwxVEG7NQgLEvQ7AwaZ/USdIyCsCaG8Ytru0GEDyOR1/WoMWT Gt2R3pML4k91T9dsiJJbH3aPeAFN0TBnaJJMtFIIybUNXYjQJEVVUgX67UpJiar82kyn XDz0jYxYaWJAHFlHLdOkX+DUdU7zIfoxOwq7wt6/6fuY3yQtz6Iq7cTQPV1R14osUVBE lyDlzzjpk/0giHScBBVkmG2lmAGjUSJ0AEHklYUUfrfpkMk762pGiG7G1H3P03f7eXmZ T7yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KhHOg4Np; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=9CQhggiH; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z21-20020a6b0a15000000b00743eda98b9fsi4112019ioi.40.2023.04.14.08.09.41; Fri, 14 Apr 2023 08:09:55 -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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KhHOg4Np; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=9CQhggiH; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230324AbjDNOsO (ORCPT + 99 others); Fri, 14 Apr 2023 10:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231232AbjDNOsB (ORCPT ); Fri, 14 Apr 2023 10:48:01 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F364D2683; Fri, 14 Apr 2023 07:47:59 -0700 (PDT) Date: Fri, 14 Apr 2023 14:47:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681483676; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VG7mVoFKYJwmwqxRMylTOAMatqSty9eoz3docMXo/MU=; b=KhHOg4Np0RzmeZheBAzN25mby3+J0Tj+KPi7oPBIeUn0caSJISkWVVGl/RIog75l9uhmEv 3MJ1uDg2PNMr35GqEznpk9ctqsLDfeFGuM6dayzyvtC/5DAd443AC5oD/5vMGHvg0aKcs0 0mSZ/WIUqWU3I/H//F4x3jLM3ccBMExa5jvefbCgcMhSCfIg91CiN0I3xpcqcg3vgCsLRF yCE4WjYHU9OqX7Xo0iz3eeWzXu6xQqDiNcto8NOwH3ObolXjbw4paMn2UFuvq7YIz8Dut/ +1i0kpPozq4nU3oOxYx6CoqBKSqAKRLobFUQAo4nysJounfbPx3+ZtkDscvfvQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681483676; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VG7mVoFKYJwmwqxRMylTOAMatqSty9eoz3docMXo/MU=; b=9CQhggiHaAR+7kCI/kv9YcxO6XIuHqjZ1wfqyIiS/IoNPRFsPqRhx6XEZ/ck9aSZqQxbew Icj8CNZXV252UnCQ== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] scripts/objdump-func: Support multiple functions Cc: Josh Poimboeuf , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <0bf5f4f5978660985037b24c6db49b114374eb4d.1681325924.git.jpoimboe@kernel.org> References: <0bf5f4f5978660985037b24c6db49b114374eb4d.1681325924.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <168148367595.404.1640232172140364396.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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?1763000664506418083?= X-GMAIL-MSGID: =?utf-8?q?1763164811103644475?= The following commit has been merged into the objtool/core branch of tip: Commit-ID: 27d000d635ce48b579988e9b3240352a2a0306e0 Gitweb: https://git.kernel.org/tip/27d000d635ce48b579988e9b3240352a2a0306e0 Author: Josh Poimboeuf AuthorDate: Wed, 12 Apr 2023 12:03:16 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 14 Apr 2023 16:08:28 +02:00 scripts/objdump-func: Support multiple functions Allow specifying multiple functions on the cmdline. Note this removes the secret EXTRA_ARGS feature. While at it, spread out the awk to make it more readable. Signed-off-by: Josh Poimboeuf Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/0bf5f4f5978660985037b24c6db49b114374eb4d.1681325924.git.jpoimboe@kernel.org --- scripts/objdump-func | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/scripts/objdump-func b/scripts/objdump-func index 4eb463d..7b15b87 100755 --- a/scripts/objdump-func +++ b/scripts/objdump-func @@ -3,7 +3,7 @@ # # Disassemble a single function. # -# usage: objdump-func +# usage: objdump-func [ ...] set -o errexit set -o nounset @@ -13,17 +13,33 @@ OBJDUMP="${CROSS_COMPILE:-}objdump" command -v gawk >/dev/null 2>&1 || die "gawk isn't installed" usage() { - echo "usage: objdump-func " >&2 + echo "usage: objdump-func [ ...]" >&2 exit 1 } [[ $# -lt 2 ]] && usage OBJ=$1; shift -FUNC=$1; shift - -# Secret feature to allow adding extra objdump args at the end -EXTRA_ARGS=$@ - -# Note this also matches compiler-added suffixes like ".cold", etc -${OBJDUMP} -wdr $EXTRA_ARGS $OBJ | gawk -M -v f=$FUNC '/^$/ { P=0; } $0 ~ "<" f "(\\..*)?>:" { P=1; O=strtonum("0x" $1); } { if (P) { o=strtonum("0x" $1); printf("%04x ", o-O); print $0; } }' +FUNCS=("$@") + +${OBJDUMP} -wdr $OBJ | gawk -M -v _funcs="${FUNCS[*]}" ' + BEGIN { split(_funcs, funcs); } + /^$/ { func_match=0; } + /<.*>:/ { + f = gensub(/.*<(.*)>:/, "\\1", 1); + for (i in funcs) { + # match compiler-added suffixes like ".cold", etc + if (f ~ "^" funcs[i] "(\\..*)?") { + func_match = 1; + base = strtonum("0x" $1); + break; + } + } + } + { + if (func_match) { + addr = strtonum("0x" $1); + printf("%04x ", addr - base); + print; + } + }'