From: Will Deacon <will@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: kernel-team@android.com, Will Deacon <will@kernel.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>,
Josh Poimboeuf <jpoimboe@kernel.org>,
John Stultz <jstultz@google.com>,
linux-kbuild@vger.kernel.org
Subject: [PATCH v3 1/4] scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1
Date: Fri, 28 Jul 2023 12:34:12 +0100 [thread overview]
Message-ID: <20230728113415.21067-2-will@kernel.org> (raw)
In-Reply-To: <20230728113415.21067-1-will@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 <jpoimboe@kernel.org>
Cc: John Stultz <jstultz@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
---
scripts/faddr2line | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/scripts/faddr2line b/scripts/faddr2line
index 0e73aca4f908..62a3fa6f6f59 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
next prev parent reply other threads:[~2023-07-28 11:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 11:34 [PATCH v3 0/4] Fix 'faddr2line' for LLVM arm64 builds Will Deacon
2023-07-28 11:34 ` Will Deacon [this message]
2023-07-29 20:47 ` [PATCH v3 1/4] scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1 Masahiro Yamada
2023-08-01 16:50 ` Nick Desaulniers
2023-07-28 11:34 ` [PATCH v3 2/4] scripts/mksysmap: Factor out sed ignored symbols expression into script Will Deacon
2023-07-29 18:38 ` Nicolas Schier
2023-07-28 11:34 ` [PATCH v3 3/4] scripts/faddr2line: Constrain readelf output to symbols from System.map Will Deacon
2023-08-01 16:42 ` Nick Desaulniers
2023-08-01 17:17 ` Sami Tolvanen
2023-08-02 19:54 ` Masahiro Yamada
2023-08-04 14:30 ` Will Deacon
2023-08-07 20:06 ` Masahiro Yamada
2023-07-28 11:34 ` [PATCH v3 4/4] scripts/faddr2line: Don't filter out non-function symbols from readelf Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230728113415.21067-2-will@kernel.org \
--to=will@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=jstultz@google.com \
--cc=kernel-team@android.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome