diff mbox series

[v3,2/3] perf: build: Minor improvement for linking libzstd

Message ID 20241215221223.293205-3-leo.yan@arm.com (mailing list archive)
State Handled Elsewhere
Delegated to: BPF
Headers show
Series bpftool: Fix the static linkage failure | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch
bpf/vmtest-bpf-PR fail merge-conflict

Commit Message

Leo Yan Dec. 15, 2024, 10:12 p.m. UTC
The zstd library will be automatically linked by detecting the feature
libzstd.  It is no need to explicitly link it for static builds, so
remove the redundant linkage.

It is contradictory to detect the feature libelf-zstd while the build
configuration NO_LIBZSTD is set.  Report an error for reminding users
not to set NO_LIBZSTD.

Signed-off-by: Leo Yan <leo.yan@arm.com>
Tested-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/perf/Makefile.config | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 0e4f6a860ae2..155cb9d20011 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -171,7 +171,7 @@  ifdef LIBDW_DIR
 endif
 DWARFLIBS := -ldw
 ifeq ($(findstring -static,${LDFLAGS}),-static)
-  DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd
+  DWARFLIBS += -lelf -lz -llzma -lbz2
 
   LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw).0.0
   LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
@@ -566,6 +566,12 @@  ifndef NO_LIBELF
     CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
   endif
 
+  ifeq ($(feature-libelf-zstd), 1)
+    ifdef NO_LIBZSTD
+      $(error Error: libzstd is required by libelf, please do not set NO_LIBZSTD)
+    endif
+  endif
+
   ifndef NO_LIBDEBUGINFOD
     $(call feature_check,libdebuginfod)
     ifeq ($(feature-libdebuginfod), 1)