Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1574656rdb; Mon, 2 Oct 2023 14:06:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5MWnrTdCVG/3sM9FgOLhN6Oz+Dc1qYrZAV5P4EXokCGudlFjBIrAVesH1O8/lGW4hCVSp X-Received: by 2002:a17:90b:230f:b0:262:f449:4497 with SMTP id mt15-20020a17090b230f00b00262f4494497mr12121784pjb.2.1696280759596; Mon, 02 Oct 2023 14:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696280759; cv=none; d=google.com; s=arc-20160816; b=j4BgnteseUWuQ4JbIjYSdaotA98YXwrNYVEl1w/ZyE6/OJMHoys8zGFURAwpx1mG0Q VFue+Qudutr+4KS9D/6umTMaYleQ1AHHvzB35CPpLLsrnAdsO3xJUdFmgcu6ystaaxkS KpcsfMSxxonCV7xOIRN1YeGl0Ol0VqaI6HsXJkspFLzWNHQrwKm++WdGO7CdTRahQrUd LHdbg3QO3bzwVdEGrbPGyLXPKXCfor6acIti05TwL3O2NnR3/k7pBZLM3OFfAq+FoRja dWcDNJ6/++FgoHWOX4rVWpQOsziVJ6v1khnKDLyysk86U1rlayXK8IN/ckfEUGjmcYgv 4DGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=sFxH3mz3Qf6YBaOU+lSTvjLYPdlcIgrB/P0nDs/0tp8=; fh=scilAdHnzANmInNSp/ngESS8QzLXo4k1m5+MMoKuvtc=; b=C1nKiRS6GKjoo0UY80Hzs1giYYF7drobRu5Zvwm2FuncCzyn1iBYX8DjJi5x2upkn4 2ouWF+UPCE68L3UG81qdrHYctDRhkKe0i2jpXCbXlJ3MU9n+9PZ96DerFctQlYDpNhto nEI7Nv/JMpGG3mA1LcdSdDQeikuSQ8iKDTsHjLsiq7e9Mw9J7qryoLv5HZYCiiYUwYLN OXQpk3WZDV6c8AlZLxxj7t7P1MBTHFduvkcZXK7+KUhdkicETfdA3nRCaK+lzuFSWtkG 4GS+YJlrPaZ29LZASrOAwHy9sXmC4fgnZ6mQK//iq8hISstF90pYPJfMrPWytSz8MOxg Tq9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=GZ98C3j2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k15-20020a170902c40f00b001b895572179si30088823plk.184.2023.10.02.14.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 14:05:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=GZ98C3j2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 84F6E806BE1B; Mon, 2 Oct 2023 10:01:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238552AbjJBRBP (ORCPT + 99 others); Mon, 2 Oct 2023 13:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238397AbjJBRBO (ORCPT ); Mon, 2 Oct 2023 13:01:14 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28ED7B3 for ; Mon, 2 Oct 2023 10:01:11 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4054496bde3so150684435e9.1 for ; Mon, 02 Oct 2023 10:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696266069; x=1696870869; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sFxH3mz3Qf6YBaOU+lSTvjLYPdlcIgrB/P0nDs/0tp8=; b=GZ98C3j2p+DUFlhPOPvxSwdXRxDOniArrC3e0JClvlS6KmkmeXx5mnUuv9IoLylHBG pSNKGGW5Wr1j8H8vUx430JAmyTSTSzS1SYwgm3uX2AsmDdxZZ3GVGORG7+ScdLFvaqCC Cjszx6dNJxbzBxKkn+MeM5mYb1AvjXm/G2O3BErFTSHmNdwli6DWffUBaVcnLgdrGSqO iD98vfe/L5I3WmO2rceR3ybQvfTW/tjUe7zIeb44NPdeVaNyM+i2L5TZtvqmfoE/J8ck dqeQ97ZgwunXAC7uFBlTJB0pWei1pvq5G7P0cuBzP2hQpAnlWa3REjcV6aQ7atBQaqxm hYuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696266069; x=1696870869; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sFxH3mz3Qf6YBaOU+lSTvjLYPdlcIgrB/P0nDs/0tp8=; b=Hs1KkA1ZcUq2pC/nY/5yryJfl8pPwaplcTPOdv6cbgmIgtnA2rKTberv40IP2lhI/O oYWbuDdc3g1/6pAwexLxxWjZ/rfMMRIVPZGFyoI1m0bR1KFziRPGE2JJaVQE1nTcS+A+ YYUye3JpmqNa61BnEKm7/mCN8QrR3PhWEtQhx/PGQgq/xyIyjC38nxtNOdmigWdvPv61 jx/Mt9yRCxputLomWbLJ3kRfl1J3dgVNPlMWczFd53bVE0UB+J9TH4T+akPzlMaVIMky BABGUB0k1ye9RWlAZGcambnp0lyTCcFyMFIljAd53Yfu9J5O48deZxUnD4ReqrEvrvKn fwZQ== X-Gm-Message-State: AOJu0YybVwmWUTNUq7VYRKEp3W2BRfCPgOl/wpx/NK3XBTTKnu9bhP8v BcdVyRT3mCbQZCVwdDUyBK3H+cH6qW2/KtKcS4+oRQ== X-Received: by 2002:a7b:c394:0:b0:403:31a:77b9 with SMTP id s20-20020a7bc394000000b00403031a77b9mr10499157wmj.37.1696266069361; Mon, 02 Oct 2023 10:01:09 -0700 (PDT) MIME-Version: 1.0 References: <20231002165750.1661-1-will@kernel.org> <20231002165750.1661-3-will@kernel.org> In-Reply-To: <20231002165750.1661-3-will@kernel.org> From: Nick Desaulniers Date: Mon, 2 Oct 2023 10:00:58 -0700 Message-ID: Subject: Re: [PATCH v5 2/3] scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1 To: Will Deacon Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Josh Poimboeuf , John Stultz , linux-kbuild@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 02 Oct 2023 10:01:48 -0700 (PDT) On Mon, Oct 2, 2023 at 9:58=E2=80=AFAM Will Deacon wrote: > > GNU utilities cannot necessarily parse objects built by LLVM, which can > result in confusing errors when using 'faddr2line': > > $ CROSS_COMPILE=3Daarch64-linux-gnu- ./scripts/faddr2line vmlinux do_one_= initcall+0xf4/0x260 > aarch64-linux-gnu-addr2line: vmlinux: unknown type [0x13] section `.relr.= dyn' > aarch64-linux-gnu-addr2line: DWARF error: invalid or unhandled FORM value= : 0x25 > do_one_initcall+0xf4/0x260: > aarch64-linux-gnu-addr2line: vmlinux: unknown type [0x13] section `.relr.= dyn' > aarch64-linux-gnu-addr2line: DWARF error: invalid or unhandled FORM value= : 0x25 > $x.73 at main.c:? > > Although this can be worked around by setting CROSS_COMPILE to "llvm=3D-"= , > it's cleaner to follow the same syntax as the top-level Makefile and > accept LLVM=3D as an indication to use the llvm- tools, optionally > specifying their location or specific version number. > > Cc: Josh Poimboeuf > Cc: John Stultz > Suggested-by: Masahiro Yamada > Signed-off-by: Will Deacon Thanks for the patch! Reviewed-by: Nick Desaulniers > --- > scripts/faddr2line | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/scripts/faddr2line b/scripts/faddr2line > index a35a420d0f26..6b8206802157 100755 > --- a/scripts/faddr2line > +++ b/scripts/faddr2line > @@ -58,8 +58,21 @@ die() { > exit 1 > } > > -READELF=3D"${CROSS_COMPILE:-}readelf" > -ADDR2LINE=3D"${CROSS_COMPILE:-}addr2line" > +UTIL_SUFFIX=3D"" > +if [[ "${LLVM:-}" =3D=3D "" ]]; then > + UTIL_PREFIX=3D${CROSS_COMPILE:-} > +else > + UTIL_PREFIX=3Dllvm- > + > + if [[ "${LLVM}" =3D=3D *"/" ]]; then > + UTIL_PREFIX=3D${LLVM}${UTIL_PREFIX} > + elif [[ "${LLVM}" =3D=3D "-"* ]]; then > + UTIL_SUFFIX=3D${LLVM} > + fi > +fi > + > +READELF=3D"${UTIL_PREFIX}readelf${UTIL_SUFFIX}" > +ADDR2LINE=3D"${UTIL_PREFIX}addr2line${UTIL_SUFFIX}" > AWK=3D"awk" > GREP=3D"grep" > > -- > 2.42.0.582.g8ccd20d70d-goog > --=20 Thanks, ~Nick Desaulniers