]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Per-symbol visibility for DSO
authorAndrey Ignatov <rdna@fb.com>
Tue, 16 Oct 2018 05:50:34 +0000 (22:50 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 16 Oct 2018 22:16:47 +0000 (15:16 -0700)
commit27f7f160ce3e9e1ede4c87aa65c6e7e575a71774
tree024031e7d7cfd5b695d11c5e3617275b5e068e51
parentb025bd86137ebc14833db019e57663f70e3e6dcf
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>
tools/lib/bpf/Makefile
tools/lib/bpf/bpf.h
tools/lib/bpf/btf.h
tools/lib/bpf/libbpf.h