summaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/Makefile
diff options
context:
space:
mode:
authorAndrey Ignatov <rdna@fb.com>2018-10-15 22:50:34 -0700
committerAlexei Starovoitov <ast@kernel.org>2018-10-16 15:16:47 -0700
commitab9e084821221b2eda57a512535fe35b49e672d8 (patch)
tree024031e7d7cfd5b695d11c5e3617275b5e068e51 /tools/lib/bpf/Makefile
parent421f4292f46e871cdcf8bdc3e6fdfcefe2e81a9d (diff)
downloadlinux-ab9e084821221b2eda57a512535fe35b49e672d8.tar.gz
linux-ab9e084821221b2eda57a512535fe35b49e672d8.tar.bz2
linux-ab9e084821221b2eda57a512535fe35b49e672d8.zip
libbpf: Per-symbol visibility for DSO
Make global symbols in libbpf DSO hidden by default with -fvisibility=hidden and export symbols that are part of ABI explicitly with __attribute__((visibility("default"))). This is common practice that should prevent from accidentally exporting a symbol, that is not supposed to be a part of ABI what, in turn, improves both libbpf developer- and user-experiences. See [1] for more details. Export control becomes more important since more and more projects use libbpf. The patch doesn't export a bunch of netlink related functions since as agreed in [2] they'll be reworked. That doesn't break bpftool since bpftool links libbpf statically. [1] https://www.akkadia.org/drepper/dsohowto.pdf (2.2 Export Control) [2] https://www.mail-archive.com/netdev@vger.kernel.org/msg251434.html Signed-off-by: Andrey Ignatov <rdna@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf/Makefile')
-rw-r--r--tools/lib/bpf/Makefile1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 79d84413ddf2..425b480bda75 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -125,6 +125,7 @@ override CFLAGS += $(EXTRA_WARNINGS)
override CFLAGS += -Werror -Wall
override CFLAGS += -fPIC
override CFLAGS += $(INCLUDES)
+override CFLAGS += -fvisibility=hidden
ifeq ($(VERBOSE),1)
Q =