Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: bpf@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 1/7] tools build: Add feature check for elfutils libasm
Date: Tue, 09 Jun 2026 18:46:19 +0000	[thread overview]
Message-ID: <20260609184620.104641F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260609182108.975586-2-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] ASMLIBS is missing the -ldl dependency for static builds.
- [Medium] Passing NULL to an integer/boolean argument in disasm_begin triggers implicit pointer-to-integer conversion errors.
--

commit 9ca40464008d6c950047c60bdb1b0966c47a038d
Author: Ian Rogers <irogers@google.com>

tools build: Add feature check for elfutils libasm

This commit introduces a build-time feature test for the elfutils libasm
library in the shared tools/build system. It adds the test program and
updates the Makefiles to attempt building it to detect support.

> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 62909a9c799d3..f0f39a2ab2035 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile

[ ... ]

> @@ -184,6 +185,11 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
>    DWARFLIBS += -ldl
>  endif
>  
> +ASMLIBS := -lasm -ldw -lelf
> +ifeq ($(findstring -static,${LDFLAGS}),-static)
> +  ASMLIBS += -lz -llzma -lbz2 -lzstd
> +endif

[Severity: Medium]
Will this fail to link during static builds?  Since libdw dynamically
loads backend modules via dlopen, it requires libdl.  DWARFLIBS above
correctly adds -ldl for static builds, but ASMLIBS omits it, which might
cause the feature test to fail and spuriously report libasm as unsupported.

> +
>  $(OUTPUT)test-libdw.bin:
>  	$(BUILD) $(DWLIBS)
>  

[ ... ]

> diff --git a/tools/build/feature/test-libasm.c b/tools/build/feature/test-libasm.c
> new file mode 100644
> index 0000000000000..928fc46ecc755
> --- /dev/null
> +++ b/tools/build/feature/test-libasm.c

[ ... ]

> @@ -0,0 +1,20 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <stddef.h>
> +#include <elfutils/libasm.h>
> +#include <gelf.h>
> +
> +struct ebl;
> +extern struct ebl *ebl_openbackend(Elf *elf);
> +extern void ebl_closebackend(struct ebl *ebl);
> +
> +int main(void)
> +{
> +	Elf *elf = elf_begin(0, ELF_C_READ, NULL);
> +	struct ebl *ebl = ebl_openbackend(elf);
> +	DisasmCtx_t *ctx = disasm_begin(ebl, elf, NULL);

[Severity: Medium]
Will this fail to build on modern compilers?  The third argument to
disasm_begin() is typically a boolean or integer type (like show_bytes or
fd), but NULL is passed here.  This causes a -Wint-conversion warning,
which compilers like GCC 14 elevate to a hard error by default.  This
could cause the feature test to unconditionally fail.

> +
> +	disasm_end(ctx);
> +	ebl_closebackend(ebl);
> +	elf_end(elf);
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260609182108.975586-1-irogers@google.com?part=1

  reply	other threads:[~2026-06-09 18:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  7:07 [PATCH v2 0/7] perf annotate: Add elfutils libasm disassembler support Ian Rogers
2026-06-09  7:07 ` [PATCH v2 1/7] tools build: Add feature check for elfutils libasm Ian Rogers
2026-06-09  7:21   ` sashiko-bot
2026-06-09  7:07 ` [PATCH v2 2/7] perf build: Add build support and capability " Ian Rogers
2026-06-09  7:19   ` sashiko-bot
2026-06-09  7:07 ` [PATCH v2 3/7] perf annotate: Implement elfutils libasm disassembler backend Ian Rogers
2026-06-09  7:07 ` [PATCH v2 4/7] perf annotate: Add --disassembler command-line option Ian Rogers
2026-06-09  7:07 ` [PATCH v2 5/7] perf test: Enhance annotate test coverage and isolate config Ian Rogers
2026-06-09  7:15   ` sashiko-bot
2026-06-09  7:07 ` [PATCH v2 6/7] perf annotate: Support BPF JIT disassembly via genelf Ian Rogers
2026-06-09  7:22   ` sashiko-bot
2026-06-09  7:07 ` [PATCH v2 7/7] perf test: Add BPF JIT annotation test coverage for all disassemblers Ian Rogers
2026-06-09  7:18   ` sashiko-bot
2026-06-09 18:21 ` [PATCH v3 0/7] perf annotate: Add elfutils libasm disassembler and BPF JIT disassembly support Ian Rogers
2026-06-09 18:21   ` [PATCH v3 1/7] tools build: Add feature check for elfutils libasm Ian Rogers
2026-06-09 18:46     ` sashiko-bot [this message]
2026-06-09 18:21   ` [PATCH v3 2/7] perf build: Add build support and capability " Ian Rogers
2026-06-09 18:21   ` [PATCH v3 3/7] perf annotate: Implement elfutils libasm disassembler backend Ian Rogers
2026-06-09 18:52     ` sashiko-bot
2026-06-09 18:21   ` [PATCH v3 4/7] perf annotate: Add --disassembler command-line option Ian Rogers
2026-06-09 18:21   ` [PATCH v3 5/7] perf test: Enhance annotate test coverage and isolate config Ian Rogers
2026-06-09 18:46     ` sashiko-bot
2026-06-09 18:21   ` [PATCH v3 6/7] perf annotate: Support BPF JIT disassembly via genelf Ian Rogers
2026-06-09 18:49     ` sashiko-bot
2026-06-09 18:21   ` [PATCH v3 7/7] perf test: Add BPF JIT annotation test coverage for all disassemblers Ian Rogers

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=20260609184620.104641F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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