tools/zstd: enable position independent code compilation
authorBryan Roessler <bryanroessler@gmail.com>
Wed, 24 Apr 2024 01:37:25 +0000 (21:37 -0400)
committerRobert Marko <robimarko@gmail.com>
Wed, 24 Apr 2024 10:16:48 +0000 (12:16 +0200)
Currently, trying to compile LLVM-BPF will fail with:
[2225/3517] Linking CXX shared library lib/libLLVM-15.so
FAILED: lib/libLLVM-15.so
/usr/bin/ld: staging_dir/host/lib/libzstd.a(zstd_common.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status

So, to fix it enable PIC for the host ZSTD.

Fixes: #15247
Signed-off-by: Bryan Roessler <bryanroessler@gmail.com>
tools/zstd/Makefile

index f962809f82aa6cb203b4bd1331a9ddf40444455b..e1d36c59cfbe87a2ddf7af4a037875ef0117f5be 100644 (file)
@@ -17,6 +17,8 @@ include $(INCLUDE_DIR)/host-build.mk
 
 HOSTCC:= $(HOSTCC_NOCACHE)
 
+HOST_CFLAGS += $(HOST_FPIC)
+
 HOST_MAKE_FLAGS += \
        BACKTRACE=0 \
        HAVE_THREAD=1 \