Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3474406rwo; Mon, 24 Jul 2023 11:32:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlEkRDAonnScxAXJGxXW7zFSVMtGbtNrEgMREiYYaZfjtUX9KUWyzjI8q6QcNvorU+A4D0zu X-Received: by 2002:a05:6808:144d:b0:3a3:6d2a:5c4a with SMTP id x13-20020a056808144d00b003a36d2a5c4amr14078212oiv.35.1690223562687; Mon, 24 Jul 2023 11:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690223562; cv=none; d=google.com; s=arc-20160816; b=sxtYO3NktuGPxTwUlIbxtQ5jaVbGH6Hl8LjxIAV6wRBbrKiUWSifFkIz4KMOIDR+Lc FA79QhgzLPLk3oK6CgZNTGFa33kGKkjLsIi/jEMbExPSIghdg3cEZpvmXW2/tdIV0esR gtO6XJV990uAueqxFmA5gtP1PeQI5lkHHFNhdd7oeg9H6v9wLoqVO9XeQVrAbRRuJpiR L+3aoKMBsPSMit3yFiQKJ0+WinViu9UrdsQD/LX7g5UaLp7CPD0TSy4sQS9j1V41yMCu kTiOJwxzXzPs5oBABylZ/zS84YQRr/MPBoTkUshFsSBqnQHz32C5eeRKoF5jkgkKuUQ8 go8Q== 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=aWGQ6OEsQr6fM6/N6JGlbuDAQxRyVCSHX10efr7rxME=; fh=FSu9atl9DWIe1aov4mIRT4R72uuRBdCpyNQUle5ZVW8=; b=efEuEFUa/TW/MdPqvedXGw/qJNJZM73sqwILStrAVAnWWOXDjzVokVT7Segh2IUPnr FC3rdHZEQIgL8CgYRXKo3qFcEPYDo1K4BYC0NeprFHZu0mDDguGRvFrTiYXykbPW+Thc ySg2Ck+mvghh0FC+jx8kCIHwO77Tfky8hN/pElKL4WRQNOuEhjZ3jqPycoXSpP3tJudm umbmcYyecXuwYX2lq6TZccNfpzRo5N82KMuDPCvw3wQzeUIwbthijhF+VRzWWqBNRmLy SJoJpxaZph5qDoMqxOD7ynYic8TJhlQJ7/RjcZtaxwnNN+ueSs4T+AJZz4be/ChEUwTF c/lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="giw/2Q3x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a17090a7b8400b00268067839c9si4422049pjc.106.2023.07.24.11.32.29; Mon, 24 Jul 2023 11:32:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="giw/2Q3x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231747AbjGXRtH (ORCPT + 99 others); Mon, 24 Jul 2023 13:49:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231869AbjGXRsc (ORCPT ); Mon, 24 Jul 2023 13:48:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2145D4203 for ; Mon, 24 Jul 2023 10:45:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDE4F61312 for ; Mon, 24 Jul 2023 17:45:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04EDAC433C7; Mon, 24 Jul 2023 17:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690220725; bh=i/3ARKu2v/GvD5MJ/ESSUDjGzezlHuJEXEcQosWyGxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=giw/2Q3xI3BJd+qXlnT5waP43ZXAgYm5VhgjSj8yRAByRpbbHrtlZsqiolfmNQk0i 9HJLQz5NPiV08MPYrJ6x7nH2ect7N6NvRMGZghRrPOgaRLIrlqOZf5EJOYlc9RzX/4 5ngKvNYTRf4aUYODIPD7qPFn7Y4ZiMkWyCYXtnWpN3tqYtZtSn0epwmlsWWRxu5lAo kjX90gJ3/G07/dWqJg69QhS8+ZXaP3V7B4jfPrg/32i814sfzCN5TmHSsTTxhaqp/O obRFovv3/hPnlQlKKgkUK8vWusSRcFQ6PvhrSzwDXAMRjFCIhMGBKd7xf9v391UjHE d8CHYroZ1sJNg== From: Will Deacon To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, Will Deacon , Josh Poimboeuf , John Stultz Subject: [PATCH 2/2] scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1 Date: Mon, 24 Jul 2023 18:45:17 +0100 Message-Id: <20230724174517.15736-3-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230724174517.15736-1-will@kernel.org> References: <20230724174517.15736-1-will@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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=1 as an indication to use the llvm- tools. Cc: Josh Poimboeuf Cc: John Stultz Signed-off-by: Will Deacon --- scripts/faddr2line | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/faddr2line b/scripts/faddr2line index 60368a1cdaed..24845267efb2 100755 --- a/scripts/faddr2line +++ b/scripts/faddr2line @@ -58,8 +58,14 @@ die() { exit 1 } -READELF="${CROSS_COMPILE:-}readelf" -ADDR2LINE="${CROSS_COMPILE:-}addr2line" +if [ "${LLVM:-}" == "1" ]; then + UTIL_PREFIX=llvm- +else + UTIL_PREFIX=${CROSS_COMPILE:-} +fi + +READELF="${UTIL_PREFIX}readelf" +ADDR2LINE="${UTIL_PREFIX}addr2line" AWK="awk" GREP="grep" -- 2.41.0.487.g6d72f3e995-goog