diff mbox series

[bpf-next,3/3] libbpf: compile in PIC mode only for shared library case

Message ID 20200929220604.833631-3-andriin@fb.com (mailing list archive)
State Accepted
Commit b0efc216f577997bf563d76d51673ed79c3d5f71
Headers show
Series [bpf-next,1/3] libbpf: fix uninitialized variable in btf_parse_type_sec | expand

Commit Message

Andrii Nakryiko Sept. 29, 2020, 10:06 p.m. UTC
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>
---
 tools/lib/bpf/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Martin KaFai Lau Sept. 30, 2020, 12:04 a.m. UTC | #1
On Tue, Sep 29, 2020 at 03:06:04PM -0700, Andrii Nakryiko wrote:
> 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.
Acked-by: Martin KaFai Lau <kafai@fb.com>
diff mbox series

Patch

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 70cb44efe8cb..5f9abed3e226 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -104,13 +104,12 @@  endif
 # Append required CFLAGS
 override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum
 override CFLAGS += -Werror -Wall
-override CFLAGS += -fPIC
 override CFLAGS += $(INCLUDES)
 override CFLAGS += -fvisibility=hidden
 override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 
 # flags specific for shared library
-SHLIB_FLAGS := -DSHARED
+SHLIB_FLAGS := -DSHARED -fPIC
 
 ifeq ($(VERBOSE),1)
   Q =