[pacman-dev] [PATCH v2 1/3] meson: pacman-conf add missing libcommon link
Currently, we are erroneously exporting all the symbols via the libalpm.so. As such, the libcommon dependency is resolved. The libalpm.so exports are about to be resolved shortly, yet that exposed that pacman-conf is missing a link against libcommon. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 264c6501..740ad717 100644 --- a/meson.build +++ b/meson.build @@ -347,7 +347,7 @@ executable( 'pacman-conf', pacman_conf_sources, include_directories : includes, - link_with : [libalpm], + link_with : [libalpm, libcommon], dependencies : [libarchive], install : true, ) -- 2.30.0
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. v2: Enumerate various points why hidden was chosen. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> --- meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson.build b/meson.build index 740ad717..11b602aa 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( -- 2.30.0
The macro hasn't been used since 2007 with commit 7f7da2b5fc01f46d28236384540c7ecfdac16a63. Although it was still copied over into alpm_list.c an year or so later with commit ca1a1871 ("More cleanup to alpm_list") Just remove all instances of it. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> --- doc/Doxyfile.in | 1 - lib/libalpm/alpm_list.c | 1 - lib/libalpm/util.h | 1 - 3 files changed, 3 deletions(-) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 6744e765..3b9c7c22 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -287,7 +287,6 @@ SEARCH_INCLUDES = YES INCLUDE_PATH = ../.. INCLUDE_FILE_PATTERNS = *.h PREDEFINED = HAVE_CONFIG_H= \ - SYMHIDDEN= \ SYMEXPORT= \ HAVE_LIBARCHIVE \ HAVE_LIBCURL \ diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c index 2ecc8e0b..e92573a1 100644 --- a/lib/libalpm/alpm_list.c +++ b/lib/libalpm/alpm_list.c @@ -30,7 +30,6 @@ /* check exported library symbols with: nm -C -D <lib> */ #define SYMEXPORT __attribute__((visibility("default"))) -#define SYMHIDDEN __attribute__((visibility("internal"))) /* Allocation */ diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index 03c8ed44..ca61a804 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -163,7 +163,6 @@ char *strsep(char **, const char *); /* check exported library symbols with: nm -C -D <lib> */ #define SYMEXPORT __attribute__((visibility("default"))) -#define SYMHIDDEN __attribute__((visibility("internal"))) #define UNUSED __attribute__((unused)) -- 2.30.0
participants (1)
-
Emil Velikov