From nobody Thu May 7 21:41:43 2026 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 5E70CC433EF for ; Tue, 17 May 2022 22:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230436AbiEQWWK (ORCPT ); Tue, 17 May 2022 18:22:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230426AbiEQWWA (ORCPT ); Tue, 17 May 2022 18:22:00 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 742B52A70E; Tue, 17 May 2022 15:21:59 -0700 (PDT) Date: Tue, 17 May 2022 22:21:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1652826117; 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=arzPXTtG/tZ+5GyS91SjFMeM3hEfP+ttmTLbHmJzI8Q=; b=iWgaW+a2IUWJlgfoVTrhJCFq88+UnLtYxDKfBE4KF7vaJ24etgnpVPyze2dtMPWscFqoN9 U80fG8hNmqs0xYF63V5K9p32ABXX/OVXFr/CthOnlC6CU4j52z+SG8boM79UK0O2LPww4Q IrG++yxkt7JBi7i7g3elNLTKZIncWSuk9tMwVCOUwwV2pIFZJT7lDnbCeeNO6h/u1rZ9p4 1fVHtfm5E4sdtQioF0OjZLvomBf/sZOsabIe0KNeyX6VWAcMJWRgIIGpGFWAzq6QmxaMcO iJQqwFHIM94433vavVNXEYssBO1a/C7tCIpIatf1FX0Lpiyblkm6CIw8rrWvWw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1652826117; 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=arzPXTtG/tZ+5GyS91SjFMeM3hEfP+ttmTLbHmJzI8Q=; b=JLPaFuxZk7hfHCcT/XWOBoMFHNOZaVhHzLaBXCJTzzO2pFZ8C2st9hTuDMgO+51zd2Wg97 uymy28BKzj4vV1DQ== 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: Create objdump-func helper script Cc: Peter Zijlstra , Borislav Petkov , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <3eb3f091fd6bd9caba50392ceab98ce756804f3b.1650578171.git.jpoimboe@redhat.com> References: <3eb3f091fd6bd9caba50392ceab98ce756804f3b.1650578171.git.jpoimboe@redhat.com> MIME-Version: 1.0 Message-ID: <165282611567.4207.330892093136670864.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: 21e350233b07619dbfc3ce606ff1fc468fce2d82 Gitweb: https://git.kernel.org/tip/21e350233b07619dbfc3ce606ff1fc468= fce2d82 Author: Josh Poimboeuf AuthorDate: Thu, 21 Apr 2022 14:56:55 -07:00 Committer: Josh Poimboeuf CommitterDate: Thu, 12 May 2022 10:08:43 -07:00 scripts: Create objdump-func helper script Add a simple script which disassembles a single function from an object file. Comes in handy for objtool warnings and kernel stack traces. Originally-by: Peter Zijlstra Acked-by: Borislav Petkov Signed-off-by: Josh Poimboeuf Link: https://lore.kernel.org/r/3eb3f091fd6bd9caba50392ceab98ce756804f3b.16= 50578171.git.jpoimboe@redhat.com --- scripts/objdump-func | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 scripts/objdump-func diff --git a/scripts/objdump-func b/scripts/objdump-func new file mode 100755 index 0000000..4eb463d --- /dev/null +++ b/scripts/objdump-func @@ -0,0 +1,29 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# Disassemble a single function. +# +# usage: objdump-func + +set -o errexit +set -o nounset + +OBJDUMP=3D"${CROSS_COMPILE:-}objdump" + +command -v gawk >/dev/null 2>&1 || die "gawk isn't installed" + +usage() { + echo "usage: objdump-func " >&2 + exit 1 +} + +[[ $# -lt 2 ]] && usage + +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; } }'