build: remove symbol visibility from capture static library

The visibility of symbols was getting extracted from the .a into the
libraries that link_whole the archive. We can simply disable the visibility
from the .a with a custom config.h.meson which avoids it for the capture
library. Since we already double-compile those sources for the shared
library, the shared library visibility is not affected.

This was tested by compiling a simple library which calls
sysprof_clock_init() and ensuring that no extra symbols were found with
`nm libfoo.so | grep ' T '`.

Fixes #60
This commit is contained in:
Christian Hergert
2021-03-22 14:49:00 -07:00
parent 7353f8d950
commit 3f2b486741
2 changed files with 56 additions and 0 deletions

55
config.h.meson Normal file
View File

@ -0,0 +1,55 @@
#mesondefine API_VERSION_S
#mesondefine DEBUGDIR
#mesondefine DEVELOPMENT_BUILD
#mesondefine ENABLE_LIBUNWIND
#mesondefine ENABLE_NLS
#mesondefine GETTEXT_PACKAGE
#mesondefine HAVE_EXECINFO_H
#mesondefine HAVE_PERF_CLOCKID
#mesondefine HAVE_POLKIT
#mesondefine HAVE_POLKIT_AGENT
#mesondefine HAVE_REALLOCARRAY
#mesondefine HAVE_STDATOMIC_H
#mesondefine HAVE_STRLCPY
#mesondefine HAVE_UNW_SET_CACHE_SIZE
#mesondefine LOCALEDIR
#mesondefine PACKAGE
#mesondefine PACKAGE_BUGREPORT
#mesondefine PACKAGE_LIBDIR
#mesondefine PACKAGE_LIBEXECDIR
#mesondefine PACKAGE_LOCALE_DIR
#mesondefine PACKAGE_NAME
#mesondefine PACKAGE_STRING
#mesondefine PACKAGE_TARNAME
#mesondefine PACKAGE_VERSION
#mesondefine SYMBOLIC_VERSION
#mesondefine VERSION
#ifndef SYSPROF_CAPTURE_COMPILATION
#mesondefine _SYSPROF_EXTERN
#endif

View File

@ -201,6 +201,7 @@ subdir('help')
subdir('po')
configure_file(
input: 'config.h.meson',
output: 'config.h',
configuration: config_h
)