All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Will Deacon <will@kernel.org>
Cc: linux-kernel@vger.kernel.org, kernel-team@android.com,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nicolas@fjasle.eu>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	John Stultz <jstultz@google.com>,
	linux-kbuild@vger.kernel.org
Subject: Re: [PATCH v4 2/3] scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1
Date: Thu, 14 Sep 2023 08:55:03 -0700	[thread overview]
Message-ID: <CAKwvOd=z5pjr2Y=jxYU=Y10EKniWd4w8YV_yhZRvVBoon8TRLQ@mail.gmail.com> (raw)
In-Reply-To: <20230914131225.13415-3-will@kernel.org>

On Thu, Sep 14, 2023 at 6:12 AM Will Deacon <will@kernel.org> wrote:
>
> 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 <jpoimboe@kernel.org>
> Cc: John Stultz <jstultz@google.com>
> Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
> Signed-off-by: Will Deacon <will@kernel.org>

Thanks for the patch series!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  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
>


-- 
Thanks,
~Nick Desaulniers

  reply	other threads:[~2023-09-14 15:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14 13:12 [PATCH v4 0/3] Fix 'faddr2line' for LLVM arm64 builds Will Deacon
2023-09-14 13:12 ` [PATCH v4 1/3] scripts/faddr2line: Don't filter out non-function symbols from readelf Will Deacon
2023-09-18 15:51   ` Nick Desaulniers
2023-09-14 13:12 ` [PATCH v4 2/3] scripts/faddr2line: Use LLVM addr2line and readelf if LLVM=1 Will Deacon
2023-09-14 15:55   ` Nick Desaulniers [this message]
2023-09-14 13:12 ` [PATCH v4 3/3] scripts/faddr2line: Skip over mapping symbols in output from readelf Will Deacon
2023-09-18 15:46   ` Nick Desaulniers
2023-10-02 15:26     ` Will Deacon
2023-09-25 16:50   ` Masahiro Yamada
2023-09-29 14:15     ` 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='CAKwvOd=z5pjr2Y=jxYU=Y10EKniWd4w8YV_yhZRvVBoon8TRLQ@mail.gmail.com' \
    --to=ndesaulniers@google.com \
    --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=nicolas@fjasle.eu \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.