Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4013665rdb; Thu, 14 Sep 2023 09:12:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IErw5/SlLW14NXLJKcMGLDLbbMl3netUCAhvIELlQBxUEnoV4ZykDwqHUS8AAJdMJsj+s1Q X-Received: by 2002:a05:6a20:8e19:b0:111:a0e5:d2b7 with SMTP id y25-20020a056a208e1900b00111a0e5d2b7mr5575686pzj.4.1694707965550; Thu, 14 Sep 2023 09:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694707965; cv=none; d=google.com; s=arc-20160816; b=nT4uwnCzgNCzqoVfkG4qSatQJJmq5sAb77DvWQZ4p4RT/ROSYK8y5qyB0hHT/uBo7q UKTSijl4LfykD+kBowJVosuR0mF7bz9sRj/l04JmfXc3DBoTWw/eWE3cHagBAg43CK7A c7tV88ooMePTGak5dTB8tgaIoV7J530340169ycyBKKs70lTb5uMoFarUBTZB36K/KZi ABvkM1KepqP3O98DzMjDgy0XO++Jv3+5IWhA+wHol+WFTt3WY/jZcyHA92JKuABx+Fr7 TrVRUWeSm+yJ8DDPNaA8+VkN/OLn+Mtqu63t857qpdwt6fYqf27F44uCLLccnmL89GZE XVAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZnQP8GFmeOt4fAGWG2E1uEf85B8G+BLhhDVsFh+N1x4=; fh=wjEl6BofP0c7WzG34c/USSQ7C1FfAme8r/K9vYTfZuw=; b=sUcK3AmpxwlmtqQCz6DLlAwvqwo5vOqDBdDMSzXKpwhBadjC0Q2X7hfsoxnJEOtmTM N0KD+QjjDJuqAnQEq6+SwsMOhmBzvbcv5q7E6XGB2BB/hCgTkJeUTW+uiTlgOjB6g1+O GpehIPrJ3g0AloH4cXfBx4fY4flgKLUmWpBuj7X/mdOeAP/QhjmUrorCbGVSZxmX4I4Q 1lc97ZixagwxBQA2AfAfZtdlP44yu2Q1+INyVML4t36fQQHXDZLbTvuLNJDeHj7W4Ljh GUCQj0Y/gbAQkI2J+NcHZCXpFq+Vt6zt62AKhI4U0qOornZxrQLxKmK2afeK8M3l3OKM GhfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="AMWtA2/9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id v20-20020a056a00149400b0068fc68078easi1986335pfu.17.2023.09.14.09.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 09:12:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="AMWtA2/9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CB57E82A8562; Thu, 14 Sep 2023 06:12:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238900AbjINNMq (ORCPT + 99 others); Thu, 14 Sep 2023 09:12:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238821AbjINNMl (ORCPT ); Thu, 14 Sep 2023 09:12:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 766511BEB; Thu, 14 Sep 2023 06:12:37 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17996C433C7; Thu, 14 Sep 2023 13:12:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694697157; bh=ksHtCQ3f6WqJu168Hihgnq5gW72bRry4aHrKZsuI6oU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AMWtA2/9zKmWrRQ+C+6DLotBrdjcrS0yycwZfI4UCKzYByIf08lwLi+3PfdWgW2Y2 hZZt+l1gZLCffo+OznQ+0WmZaMTQjxMG7Is13CfMDJwcKCqsynW9qflMAsrahhOiZQ Q3TwpOoJXTQ4vLCMQU254oOOEI2ARspiMDkdQHN8DR0zGpz7VimPJxRPNz4wJ1WAzh CRII/0UuS5uE0hPbKhi4BdoEf7hfiC6NScPfyCpDJbGM9egdmnKwySTFbVJJcJMfUS MLP3I8O8c+ZmpN+v4ZWm4X0BNC5687hSohZaIAaRDBf9zAt6z3Xq6cnn1gr3ti24F4 YkNoQC9G5I6uA== From: Will Deacon To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Will Deacon , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Josh Poimboeuf , John Stultz , linux-kbuild@vger.kernel.org Subject: [PATCH v4 2/3] scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1 Date: Thu, 14 Sep 2023 14:12:24 +0100 Message-Id: <20230914131225.13415-3-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230914131225.13415-1-will@kernel.org> References: <20230914131225.13415-1-will@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:12:52 -0700 (PDT) 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. Cc: Josh Poimboeuf Cc: John Stultz Suggested-by: Masahiro Yamada Signed-off-by: Will Deacon --- 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="${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" -- 2.42.0.283.g2d96d420d3-goog