From: Ian Rogers <irogers@google.com>
To: irogers@google.com, acme@kernel.org, namhyung@kernel.org
Cc: 9erthalion6@gmail.com, adrian.hunter@intel.com,
alexandre.chartre@oracle.com, blakejones@google.com,
bpf@vger.kernel.org, costa.shul@redhat.com, dsterba@suse.com,
james.clark@linaro.org, jolsa@kernel.org, leo.yan@arm.com,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
mark@klomp.org, mingo@redhat.com, mjeanson@efficios.com,
nathan@kernel.org, peterz@infradead.org, rong.bao@csmantle.top,
serhei@serhei.io, terrelln@fb.com, tglozar@redhat.com,
tianyou.li@intel.com, yuzhuo@google.com, zecheng@google.com
Subject: [PATCH v3 1/7] tools build: Add feature check for elfutils libasm
Date: Tue, 9 Jun 2026 11:21:02 -0700 [thread overview]
Message-ID: <20260609182108.975586-2-irogers@google.com> (raw)
In-Reply-To: <20260609182108.975586-1-irogers@google.com>
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.
Note on static linking: pkg-config for libdw/libelf on modern systems
does not list -lebl as a dependency. Older versions of elfutils that
require explicitly linking -lebl statically are unsupported by this
feature check.
Assisted-by: Antigravity:Google Gemini 3.5-flash
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/build/Makefile.feature | 2 ++
tools/build/feature/Makefile | 9 +++++++++
tools/build/feature/test-libasm.c | 20 ++++++++++++++++++++
3 files changed, 31 insertions(+)
create mode 100644 tools/build/feature/test-libasm.c
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index ed1374af31c1..422329dbc20a 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -118,6 +118,7 @@ FEATURE_TESTS_EXTRA := \
hello \
babeltrace2-ctf-writer \
libcapstone \
+ libasm \
libcheck \
libbfd-liberty \
libbfd-liberty-z \
@@ -150,6 +151,7 @@ FEATURE_DISPLAY ?= \
numa_num_possible_cpus \
libpython \
libcapstone \
+ libasm \
llvm-perf \
zlib \
lzma \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 62909a9c799d..f0f39a2ab203 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -47,6 +47,7 @@ FILES= \
test-timerfd.bin \
test-babeltrace2-ctf-writer.bin \
test-libcapstone.bin \
+ test-libasm.bin \
test-libcheck.bin \
test-compile-32.bin \
test-compile-x32.bin \
@@ -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
+
$(OUTPUT)test-libdw.bin:
$(BUILD) $(DWLIBS)
@@ -311,6 +317,9 @@ $(OUTPUT)test-babeltrace2-ctf-writer.bin:
$(OUTPUT)test-libcapstone.bin:
$(BUILD) # -lcapstone provided by $(FEATURE_CHECK_LDFLAGS-libcapstone)
+$(OUTPUT)test-libasm.bin:
+ $(BUILD) $(ASMLIBS)
+
$(OUTPUT)test-libcheck.bin:
$(BUILD) # -lcheck is provided by $(FEATURE_CHECK_LDFLAGS-libcheck)
diff --git a/tools/build/feature/test-libasm.c b/tools/build/feature/test-libasm.c
new file mode 100644
index 000000000000..928fc46ecc75
--- /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);
+
+ disasm_end(ctx);
+ ebl_closebackend(ebl);
+ elf_end(elf);
+ return 0;
+}
--
2.54.0.1099.g489fc7bff1-goog
next prev parent reply other threads:[~2026-06-09 18:21 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 ` Ian Rogers [this message]
2026-06-09 18:46 ` [PATCH v3 1/7] tools build: Add feature check for elfutils libasm sashiko-bot
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=20260609182108.975586-2-irogers@google.com \
--to=irogers@google.com \
--cc=9erthalion6@gmail.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexandre.chartre@oracle.com \
--cc=blakejones@google.com \
--cc=bpf@vger.kernel.org \
--cc=costa.shul@redhat.com \
--cc=dsterba@suse.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark@klomp.org \
--cc=mingo@redhat.com \
--cc=mjeanson@efficios.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=peterz@infradead.org \
--cc=rong.bao@csmantle.top \
--cc=serhei@serhei.io \
--cc=terrelln@fb.com \
--cc=tglozar@redhat.com \
--cc=tianyou.li@intel.com \
--cc=yuzhuo@google.com \
--cc=zecheng@google.com \
/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