From 7bcd1b2acf965b3170d8340a7eced0eabe438ccf Mon Sep 17 00:00:00 2001 From: Daniel Playfair Cal Date: Mon, 4 May 2020 16:44:27 +1000 Subject: tests: factor out abicheck from gsettings This will allow it to be used for other binaries --- gsettings/abicheck.sh | 26 -------------------------- gsettings/meson.build | 14 -------------- gsettings/symbols.txt | 3 +++ tests/abicheck.sh | 33 +++++++++++++++++++++++++++++++++ tests/meson.build | 16 ++++++++++++++++ 5 files changed, 52 insertions(+), 40 deletions(-) delete mode 100755 gsettings/abicheck.sh create mode 100644 gsettings/symbols.txt create mode 100755 tests/abicheck.sh diff --git a/gsettings/abicheck.sh b/gsettings/abicheck.sh deleted file mode 100755 index 1dca6ea..0000000 --- a/gsettings/abicheck.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# The following checks that gsettings/libdconfsettings.so only has -# dconf_* symbols. -# -# We also make sure to ignore gcov symbols included when building with -# --coverage, which usually means the following: -# -# __gcov_error_file -# __gcov_master -# __gcov_sort_n_vals -# __gcov_var -# -# And starting with gcc-9, also this one: -# -# mangle_path - -${NM:-nm} --dynamic --defined-only $GSETTINGS_LIB > public-abi - -test "`\ - cat public-abi | \ - cut -f 3 -d ' ' | \ - grep -v ^_ | \ - grep -v ^mangle_path | \ - grep -v ^g_io_module | \ - wc -l`" -eq 0 && rm public-abi diff --git a/gsettings/meson.build b/gsettings/meson.build index a28892d..ee0f723 100644 --- a/gsettings/meson.build +++ b/gsettings/meson.build @@ -16,17 +16,3 @@ libdconf_settings = shared_library( install: true, install_dir: gio_module_dir, ) - -envs = test_env + [ - 'G_TEST_SRCDIR=' + meson.current_source_dir(), - 'G_TEST_BUILDDIR=' + meson.current_build_dir(), - 'GSETTINGS_LIB=' + libdconf_settings.full_path(), -] - -unit_test = 'abicheck' - -test( - unit_test, - find_program(unit_test + '.sh'), - env: envs, -) diff --git a/gsettings/symbols.txt b/gsettings/symbols.txt new file mode 100644 index 0000000..0ac9e5e --- /dev/null +++ b/gsettings/symbols.txt @@ -0,0 +1,3 @@ +g_io_module_load +g_io_module_query +g_io_module_unload diff --git a/tests/abicheck.sh b/tests/abicheck.sh new file mode 100755 index 0000000..49291bd --- /dev/null +++ b/tests/abicheck.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# The following checks that a given binary only defines the symbols +# specified +# +# We also make sure to ignore gcov symbols included when building with +# --coverage, which usually means the following: +# +# __gcov_error_file +# __gcov_master +# __gcov_sort_n_vals +# __gcov_var +# +# And starting with gcc-9, also this one: +# +# mangle_path + +set -x + +if test $# != 2; then + echo " Usage: $0 " + echo " symbol_file is a file where each line is the name of an exported symbol" + exit 1 +fi + +BINARY="$1" +SYMBOL_FILE="$2" + +${NM:-nm} --dynamic --defined-only "$BINARY" | \ + cut -f 3 -d ' ' | \ + grep -v ^_ | \ + grep -v ^mangle_path | \ + diff "$SYMBOL_FILE" - diff --git a/tests/meson.build b/tests/meson.build index 0d4260f..0992435 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -48,6 +48,22 @@ foreach unit_test: unit_tests test(unit_test[0], exe, is_parallel: false, env: envs) endforeach +symbol_test = find_program('abicheck.sh') + +abi_tests = [ + ['gsettings', libdconf_settings, files('../gsettings/symbols.txt')[0]] +] + +foreach abi_test: abi_tests + test( + abi_test[0], + symbol_test, + env: envs, + args: [abi_test[1].full_path(), abi_test[2]], + ) +endforeach + + python3 = find_program('python3', required: false) dbus_daemon = find_program('dbus-daemon', required: false) -- cgit v1.2.1 From b6ee1a176fef18715d9c783915c5f41831e92f57 Mon Sep 17 00:00:00 2001 From: Daniel Playfair Cal Date: Mon, 4 May 2020 16:49:55 +1000 Subject: client: add abicheck --- client/symbols.txt | 40 ++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 3 ++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 client/symbols.txt diff --git a/client/symbols.txt b/client/symbols.txt new file mode 100644 index 0000000..d22c22f --- /dev/null +++ b/client/symbols.txt @@ -0,0 +1,40 @@ +dconf_changeset_all +dconf_changeset_change +dconf_changeset_describe +dconf_changeset_deserialise +dconf_changeset_diff +dconf_changeset_filter_changes +dconf_changeset_get +dconf_changeset_is_empty +dconf_changeset_is_similar_to +dconf_changeset_new +dconf_changeset_new_database +dconf_changeset_new_write +dconf_changeset_ref +dconf_changeset_seal +dconf_changeset_serialise +dconf_changeset_set +dconf_changeset_unref +dconf_client_change_fast +dconf_client_change_sync +dconf_client_get_type +dconf_client_is_writable +dconf_client_list +dconf_client_list_locks +dconf_client_new +dconf_client_read +dconf_client_read_full +dconf_client_sync +dconf_client_unwatch_fast +dconf_client_unwatch_sync +dconf_client_watch_fast +dconf_client_watch_sync +dconf_client_write_fast +dconf_client_write_sync +dconf_error_quark +dconf_is_dir +dconf_is_key +dconf_is_path +dconf_is_rel_dir +dconf_is_rel_key +dconf_is_rel_path diff --git a/tests/meson.build b/tests/meson.build index 0992435..19f693a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -51,7 +51,8 @@ endforeach symbol_test = find_program('abicheck.sh') abi_tests = [ - ['gsettings', libdconf_settings, files('../gsettings/symbols.txt')[0]] + ['gsettings', libdconf_settings, files('../gsettings/symbols.txt')[0]], + ['libdconf', libdconf, files('../client/symbols.txt')[0]], ] foreach abi_test: abi_tests -- cgit v1.2.1 From f441731684fefd91186955587bc4210191cba665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Sun, 12 Aug 2018 11:54:14 +0200 Subject: build: Improve libdconf visible symbols One of the changes in c50f3758d3e5da4f8b244227b211c3c3f454275c that was part of the GNOME/dconf!11 merge request, removed the list of libraries `libdconf` linked with. This was overlooked because meson build files used the same `deps` variable in several files and this make `libdconf` library function to use dependencies from `gsettings` library. Due to this, only `dconf_client_*` symbols where visible in `libdconf`. The set of libraries to link with in `libdconf` has been restored so now all the necessary symbols are visible again. The `link_whole` parameter in both `libdconf_client_dep` and `libdconf_common_dep` has been changed back to `link_with`. --- client/meson.build | 13 +++++++------ common/meson.build | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/meson.build b/client/meson.build index de6387e..e9672b8 100644 --- a/client/meson.build +++ b/client/meson.build @@ -12,11 +12,6 @@ install_headers( sources = files('dconf-client.c') -deps = [ - libdconf_common_hidden_dep, - libdconf_gdbus_thread_dep, -] - libdconf_client = static_library( 'dconf-client', sources: sources, @@ -31,13 +26,19 @@ libdconf_client_dep = declare_dependency( link_with: libdconf_client, ) +client_deps = [ + libdconf_common_dep, + libdconf_engine_dep, + libdconf_gdbus_thread_dep, +] + libdconf = shared_library( 'dconf', sources: sources, version: libversion, soversion: soversion, include_directories: top_inc, - dependencies: deps, + dependencies: client_deps, c_args: dconf_c_args, install: true, ) diff --git a/common/meson.build b/common/meson.build index 58e0fa8..61af2f9 100644 --- a/common/meson.build +++ b/common/meson.build @@ -28,7 +28,7 @@ libdconf_common = static_library( libdconf_common_dep = declare_dependency( dependencies: glib_dep, - link_whole: libdconf_common, + link_with: libdconf_common, ) libdconf_common_hidden = static_library( -- cgit v1.2.1 From 7526617ab25d314f646c5ae874197b8846de2a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Mon, 13 Aug 2018 23:52:05 +0200 Subject: build: Remove libdconf-common-hidden `libdconf-common-hidden` is built to hide symbols not necessary in the `gsettings` gio module that only needs to expose `g_io_module_[load|query|unload]` symbols. To achieve this a symbol map along with `version-script` linker flag is used. Thanks to this only the necessary symbols are exposed, building `libdconf-common-hidden` static library is not necessary anymore and the existing dependencies can be used. --- common/meson.build | 14 -------------- gsettings/meson.build | 15 ++++++++------- gsettings/symbol.map | 8 ++++++++ 3 files changed, 16 insertions(+), 21 deletions(-) create mode 100644 gsettings/symbol.map diff --git a/common/meson.build b/common/meson.build index 61af2f9..befa9bc 100644 --- a/common/meson.build +++ b/common/meson.build @@ -30,17 +30,3 @@ libdconf_common_dep = declare_dependency( dependencies: glib_dep, link_with: libdconf_common, ) - -libdconf_common_hidden = static_library( - 'dconf-common-hidden', - sources: sources, - include_directories: top_inc, - dependencies: glib_dep, - c_args: dconf_c_args + cc.get_supported_arguments('-fvisibility=hidden'), - pic: true, -) - -libdconf_common_hidden_dep = declare_dependency( - dependencies: glib_dep, - link_with: libdconf_common_hidden, -) diff --git a/gsettings/meson.build b/gsettings/meson.build index ee0f723..9463453 100644 --- a/gsettings/meson.build +++ b/gsettings/meson.build @@ -1,18 +1,19 @@ -# We use the libraries directly, as the dependency objects use -# link_whole; this avoids the gsettings backend module exposing -# symbols other than g_io_module_* backend_deps = [ - libdconf_common_hidden, - libdconf_gdbus_thread, + libdconf_common_dep, + libdconf_gdbus_thread_dep, ] +symbol_map = join_paths(meson.current_source_dir(), 'symbol.map') +ldflags = cc.get_supported_link_arguments('-Wl,--version-script,@0@'.format(symbol_map)) + libdconf_settings = shared_library( 'dconfsettings', sources: 'dconfsettingsbackend.c', include_directories: top_inc, - link_with: backend_deps, - dependencies: gio_dep, + dependencies: backend_deps, c_args: dconf_c_args, + link_args: ldflags, + link_depends: symbol_map, install: true, install_dir: gio_module_dir, ) diff --git a/gsettings/symbol.map b/gsettings/symbol.map new file mode 100644 index 0000000..43ed5a7 --- /dev/null +++ b/gsettings/symbol.map @@ -0,0 +1,8 @@ +{ +global: + g_io_module_load; + g_io_module_unload; + g_io_module_query; +local: + *; +}; -- cgit v1.2.1 From 72fbd6f7442a7e3dbc227068e58d082bbbefa2dc Mon Sep 17 00:00:00 2001 From: Daniel Playfair Cal Date: Sat, 30 May 2020 13:01:52 +1000 Subject: include symbols needed by GNU BFD ld in map On FreeBSD using the default GNU BFD linker, the use of --version-script fails unless the symbols `__progname` and `environ` are included. This change includes them in the symbol map, which should allow the build to succeed on FreeBSD. --- gsettings/symbol.map | 2 ++ tests/abicheck.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/gsettings/symbol.map b/gsettings/symbol.map index 43ed5a7..ad1719c 100644 --- a/gsettings/symbol.map +++ b/gsettings/symbol.map @@ -3,6 +3,8 @@ global: g_io_module_load; g_io_module_unload; g_io_module_query; + environ; + __progname; local: *; }; diff --git a/tests/abicheck.sh b/tests/abicheck.sh index 49291bd..7d90c17 100755 --- a/tests/abicheck.sh +++ b/tests/abicheck.sh @@ -29,5 +29,7 @@ SYMBOL_FILE="$2" ${NM:-nm} --dynamic --defined-only "$BINARY" | \ cut -f 3 -d ' ' | \ grep -v ^_ | \ + grep -v ^environ | \ + grep -v __progname | \ grep -v ^mangle_path | \ diff "$SYMBOL_FILE" - -- cgit v1.2.1