Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libbpf: Compile in PIC mode only for shared library case

Libbpf compiles .o's for static and shared library modes separately, so no
need to specify -fPIC for both. Keep it only for shared library mode.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200929220604.833631-3-andriin@fb.com

authored by

Andrii Nakryiko and committed by
Alexei Starovoitov
b0efc216 0a62291d

+1 -2
+1 -2
tools/lib/bpf/Makefile
··· 104 104 # Append required CFLAGS 105 105 override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum 106 106 override CFLAGS += -Werror -Wall 107 - override CFLAGS += -fPIC 108 107 override CFLAGS += $(INCLUDES) 109 108 override CFLAGS += -fvisibility=hidden 110 109 override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 111 110 112 111 # flags specific for shared library 113 - SHLIB_FLAGS := -DSHARED 112 + SHLIB_FLAGS := -DSHARED -fPIC 114 113 115 114 ifeq ($(VERBOSE),1) 116 115 Q =