From 67a42b9549b3d0bc5a6c1f774e965553b304c1cf Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Tue, 5 Jan 2021 00:48:12 +0000 Subject: meson: use hidden symbol visiblity by default All the required public API is annotated with SYMEXPORT, so we can just add the meson notation, to hide all the symbols by default. Thus we no longer spill all the internal API into the global namespace. This is effectively a regression from the autotools build, which used hidden and internal for DARWIN and others respectively. The use of hidden is considered sufficient, considering: - internal was introduced with commit 920b0d20 ("Update usage of gcc __attribute__ flags"), referencing the GCC manual and potential optimisations, although - the details about the optimisations or respective benefits are close to non-existent, - the code/data size of the binaries is identical across hidden and internal. While the latter produces slightly larger overall binaries. - Internal is not widely supported - missing on Darwin, the CMake build system lacks a wrapper (unlike for hidden) - Internal is not widely used in projects. Signed-off-by: Emil Velikov Signed-off-by: Allan McRae --- meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson.build b/meson.build index 71a3b54e..ea9bd2f7 100644 --- a/meson.build +++ b/meson.build @@ -303,6 +303,7 @@ libcommon = static_library( 'common', libcommon_sources, include_directories : includes, + gnu_symbol_visibility : 'hidden', install : false) alpm_deps = [crypto_provider, libarchive, libcurl, libintl, gpgme] @@ -313,6 +314,7 @@ libalpm_a = static_library( # https://github.com/mesonbuild/meson/issues/3937 objects : libcommon.extract_all_objects(), include_directories : includes, + gnu_symbol_visibility : 'hidden', dependencies : alpm_deps) libalpm = library( -- cgit v1.2.3-54-g00ecf