lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241204213059.2792453-1-leo.yan@arm.com>
Date: Wed,  4 Dec 2024 21:30:59 +0000
From: Leo Yan <leo.yan@....com>
To: Quentin Monnet <qmo@...nel.org>,
	Alexei Starovoitov <ast@...nel.org>,
	Daniel Borkmann <daniel@...earbox.net>,
	Andrii Nakryiko <andrii@...nel.org>,
	Martin KaFai Lau <martin.lau@...ux.dev>,
	Eduard Zingerman <eddyz87@...il.com>,
	Song Liu <song@...nel.org>,
	Yonghong Song <yonghong.song@...ux.dev>,
	John Fastabend <john.fastabend@...il.com>,
	KP Singh <kpsingh@...nel.org>,
	Stanislav Fomichev <sdf@...ichev.me>,
	Hao Luo <haoluo@...gle.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Nick Terrell <terrelln@...com>,
	bpf@...r.kernel.org,
	linux-perf-users@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: Leo Yan <leo.yan@....com>
Subject: [PATCH] bpftool: Fix failure with static linkage

When building perf with static linkage:

  make O=/build LDFLAGS="-static" -C tools/perf VF=1 DEBUG=1
  ...
  LINK    /build/util/bpf_skel/.tmp/bootstrap/bpftool
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_compress':
  (.text+0x113): undefined reference to `ZSTD_createCCtx'
  /usr/bin/ld: (.text+0x2a9): undefined reference to `ZSTD_compressStream2'
  /usr/bin/ld: (.text+0x2b4): undefined reference to `ZSTD_isError'
  /usr/bin/ld: (.text+0x2db): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: (.text+0x5a0): undefined reference to `ZSTD_compressStream2'
  /usr/bin/ld: (.text+0x5ab): undefined reference to `ZSTD_isError'
  /usr/bin/ld: (.text+0x6b9): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: (.text+0x835): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: (.text+0x86f): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: (.text+0x91b): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: (.text+0xa12): undefined reference to `ZSTD_freeCCtx'
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress':
  (.text+0xbfc): undefined reference to `ZSTD_decompress'
  /usr/bin/ld: (.text+0xc04): undefined reference to `ZSTD_isError'
  /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress_elf':
  (.text+0xd45): undefined reference to `ZSTD_decompress'
  /usr/bin/ld: (.text+0xd4d): undefined reference to `ZSTD_isError'
  collect2: error: ld returned 1 exit status

Building bpftool with static linkage also fails with the same errors:

  make O=/build -C tools/bpf/bpftool/ V=1

To fix the issue, explicitly link libzstd.

Signed-off-by: Leo Yan <leo.yan@....com>
---
 tools/bpf/bpftool/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index a4263dfb5e03..65b2671941e0 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -130,8 +130,8 @@ include $(FEATURES_DUMP)
 endif
 endif
 
-LIBS = $(LIBBPF) -lelf -lz
-LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
+LIBS = $(LIBBPF) -lelf -lz -lzstd
+LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz -lzstd
 ifeq ($(feature-libcap), 1)
 CFLAGS += -DUSE_LIBCAP
 LIBS += -lcap
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ