Skip to content

Commit b0efc21

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
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
1 parent 0a62291 commit b0efc21

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎tools/lib/bpf/Makefile‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,12 @@ endif
104104
# Append required CFLAGS
105105
override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum
106106
override CFLAGS += -Werror -Wall
107-
override CFLAGS += -fPIC
108107
override CFLAGS += $(INCLUDES)
109108
override CFLAGS += -fvisibility=hidden
110109
override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
111110

112111
# flags specific for shared library
113-
SHLIB_FLAGS := -DSHARED
112+
SHLIB_FLAGS := -DSHARED -fPIC
114113

115114
ifeq ($(VERBOSE),1)
116115
Q =

0 commit comments

Comments
 (0)