From patchwork Tue Oct 24 08:52:43 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: 157308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1805593vqx; Tue, 24 Oct 2023 01:53:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtXxIz1IH9py3uU4HNEKFYMFwE+BxAmXJg/OTK/XiA6KifsGkCxpe7tpWOQU/fYukdTzrV X-Received: by 2002:a17:902:e844:b0:1c6:25c3:13d3 with SMTP id t4-20020a170902e84400b001c625c313d3mr12475795plg.6.1698137611447; Tue, 24 Oct 2023 01:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698137611; cv=none; d=google.com; s=arc-20160816; b=UOuxWeH6BHn7RMpGK8+84F/Koigledu1a+ly3QTZ80ad0xSgsroTJt3hqpPEjtBxbi LECovf5bPylBpSoQR+6hbkrMBv9+nTn/+rxnz4UrF9zB14/57i6kpTGZOkm7VbRwERPi vT+GN2daQfZlIdajcpxtMm7cTGOIfYRKHDj5YBzRMd12Kycso3mWM+F7qrgUcUCazb6B 1XxK7oyIYTRVG/K4PiPE0Mw2zs+CikqxGJIrteIa26RnIf4JksYNN8mED28CJjnCv72o RV6iYXy1XJnqMW5FdhuWFcmQ55HHXlG7r+EoR4E326zG82W4gj9Q6t45y6htBmGQIM26 ljIA== 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=q6DNQlv21ZTBidvA/QYgU9WUU2cKXO4898OI1eWG1zA=; fh=U6xOoS4yrKwokS92UnWWBZ6Bz5Mf5FIxoc6GYbAL22U=; b=PwP2QztKv8kks0T25ql9wd15+q/hP1qBl1XAvlUjA6Flut5OjiDzQEx6PfYGMygWNM N5D5qQH+O1whxxddN1dOc0tR+RZ59bvnQAcY5nX92hRa+uKkOkYry3PTHtBgyba/yLFV Ab2kyJ774FQYgUElg+4Me3kagh2onGgYVFmi6R2N1Ay1jNSpopbK3uvcQmTds5CaxNMH qKJs4wdPDw4JRKSTCDgq6ZXyfh5SbizeDVNNZqc4yC4zrYoJITSmRNHJ4E2UhegL4mLA p2W7NjnHNmDVarmOZ+3UHsFSy5SUA1YtxRwUG2taRILrh+JU8Afzauz0uet6V/0bdvDN zupw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=28Z87DFz; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=4Qd9j9rf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m5-20020a170902db8500b001b025aba9f2si7583342pld.22.2023.10.24.01.53.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 01:53:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=28Z87DFz; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=4Qd9j9rf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8B58D8030B58; Tue, 24 Oct 2023 01:53:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234061AbjJXIxV (ORCPT + 26 others); Tue, 24 Oct 2023 04:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234044AbjJXIxE (ORCPT ); Tue, 24 Oct 2023 04:53:04 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EB4F172A; Tue, 24 Oct 2023 01:52:46 -0700 (PDT) Date: Tue, 24 Oct 2023 08:52:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1698137564; 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=q6DNQlv21ZTBidvA/QYgU9WUU2cKXO4898OI1eWG1zA=; b=28Z87DFzxWilQQa8qKx7kVVRRXJFhUtjGyxM7ISHF/de62wuPPYmGfl8ZPCtCRTsaglFCH A4xmDoj3Obs4/FBcYCULeULhj0bqJQfiwqRNJB/jccEPZAW3uUujBnpOIzN69Xtyw5DyA4 NTWVh0H9QvlbGJsNjQPibimKcu3i2EwpuoRjlnB2u3mcwco+f8ptzAdHKode/uvcW7h1qX cY8zGiSYbvSizpNhOx9CB8J2hZYVW3SR1yPXTUb22Mey9nwFY8YS0iQYfrmVZwHroBcDrB COaxMqqAzBoxgwc8uGt9z3YFo54v6qm68PNMncTRC3oAbWbL5Q92uB4oc7lNpQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1698137564; 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=q6DNQlv21ZTBidvA/QYgU9WUU2cKXO4898OI1eWG1zA=; b=4Qd9j9rfnmM0xUaCJjd4wrIJy31dn9R2J+NKereIX2+ImvlaAW7mZ52mlGcPjYoc4s5Et2 pZFfGFWV5doA/8BQ== From: "tip-bot2 for Will Deacon" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1 Cc: Masahiro Yamada , Will Deacon , Nick Desaulniers , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231002165750.1661-3-will@kernel.org> References: <20231002165750.1661-3-will@kernel.org> MIME-Version: 1.0 Message-ID: <169813756376.3135.14752334773537866641.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 01:53:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778664347431975128 X-GMAIL-MSGID: 1780626344249990280 The following commit has been merged into the objtool/core branch of tip: Commit-ID: 86bf86e19d308a1dba41e5f1f7e8cc105a5efa49 Gitweb: https://git.kernel.org/tip/86bf86e19d308a1dba41e5f1f7e8cc105a5efa49 Author: Will Deacon AuthorDate: Mon, 02 Oct 2023 17:57:48 +01:00 Committer: Josh Poimboeuf CommitterDate: Mon, 23 Oct 2023 08:36:33 -07:00 scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1 GNU utilities cannot necessarily parse objects built by LLVM, which can result in confusing errors when using 'faddr2line': $ CROSS_COMPILE=aarch64-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=-", it's cleaner to follow the same syntax as the top-level Makefile and accept LLVM= as an indication to use the llvm- tools, optionally specifying their location or specific version number. Suggested-by: Masahiro Yamada Signed-off-by: Will Deacon Reviewed-by: Nick Desaulniers Link: https://lore.kernel.org/r/20231002165750.1661-3-will@kernel.org Signed-off-by: Josh Poimboeuf --- scripts/faddr2line | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/faddr2line b/scripts/faddr2line index a35a420..6b82068 100755 --- a/scripts/faddr2line +++ b/scripts/faddr2line @@ -58,8 +58,21 @@ die() { exit 1 } -READELF="${CROSS_COMPILE:-}readelf" -ADDR2LINE="${CROSS_COMPILE:-}addr2line" +UTIL_SUFFIX="" +if [[ "${LLVM:-}" == "" ]]; then + UTIL_PREFIX=${CROSS_COMPILE:-} +else + UTIL_PREFIX=llvm- + + if [[ "${LLVM}" == *"/" ]]; then + UTIL_PREFIX=${LLVM}${UTIL_PREFIX} + elif [[ "${LLVM}" == "-"* ]]; then + UTIL_SUFFIX=${LLVM} + fi +fi + +READELF="${UTIL_PREFIX}readelf${UTIL_SUFFIX}" +ADDR2LINE="${UTIL_PREFIX}addr2line${UTIL_SUFFIX}" AWK="awk" GREP="grep"