From nobody Thu Dec 18 07:51:17 2025 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 99FCFC77B72 for ; Fri, 14 Apr 2023 14:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230205AbjDNOsP (ORCPT ); Fri, 14 Apr 2023 10:48:15 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the objtool/core branch of tip: Commit-ID: 27d000d635ce48b579988e9b3240352a2a0306e0 Gitweb: https://git.kernel.org/tip/27d000d635ce48b579988e9b3240352a2= a0306e0 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.16= 81325924.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 [ ...] =20 set -o errexit set -o nounset @@ -13,17 +13,33 @@ OBJDUMP=3D"${CROSS_COMPILE:-}objdump" command -v gawk >/dev/null 2>&1 || die "gawk isn't installed" =20 usage() { - echo "usage: objdump-func " >&2 + echo "usage: objdump-func [ ...]" >&2 exit 1 } =20 [[ $# -lt 2 ]] && usage =20 OBJ=3D$1; shift -FUNC=3D$1; shift - -# Secret feature to allow adding extra objdump args at the end -EXTRA_ARGS=3D$@ - -# Note this also matches compiler-added suffixes like ".cold", etc -${OBJDUMP} -wdr $EXTRA_ARGS $OBJ | gawk -M -v f=3D$FUNC '/^$/ { P=3D0; } $= 0 ~ "<" f "(\\..*)?>:" { P=3D1; O=3Dstrtonum("0x" $1); } { if (P) { o=3Dstr= tonum("0x" $1); printf("%04x ", o-O); print $0; } }' +FUNCS=3D("$@") + +${OBJDUMP} -wdr $OBJ | gawk -M -v _funcs=3D"${FUNCS[*]}" ' + BEGIN { split(_funcs, funcs); } + /^$/ { func_match=3D0; } + /<.*>:/ { + f =3D gensub(/.*<(.*)>:/, "\\1", 1); + for (i in funcs) { + # match compiler-added suffixes like ".cold", etc + if (f ~ "^" funcs[i] "(\\..*)?") { + func_match =3D 1; + base =3D strtonum("0x" $1); + break; + } + } + } + { + if (func_match) { + addr =3D strtonum("0x" $1); + printf("%04x ", addr - base); + print; + } + }'