From 36b47ffed9d699906dfa77ea0cb438432571d17b Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Fri, 15 Jan 2021 22:35:09 +0100 Subject: [PATCH] meson: Fix build with -Dtest_coverage=true As can be seen in commit 8a62a1592ae00eab4eb153c02661e56b9d8d9032 (from autoconf era), the coverage flags have to be used also when linking objects. However, this was not reflected when we switched to meson. Without this patch linking fails with undefined references to various __gcov_* symbols. Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- tests/meson.build | 8 ++++---- tools/nss/meson.build | 2 ++ tools/wireshark/src/meson.build | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/meson.build b/tests/meson.build index f1d91ca50d..23255dd62a 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -26,7 +26,10 @@ tests_dep = declare_dependency( top_inc_dir, util_inc_dir, ], - link_args: libvirt_export_dynamic, + link_args: ( + libvirt_export_dynamic + + coverage_flags + ), ) tests_env = [ @@ -228,9 +231,6 @@ executable( dependencies: [ tests_dep, ], - link_args: [ - coverage_flags, - ], ) diff --git a/tools/nss/meson.build b/tools/nss/meson.build index cf3eec9b24..198936f3d4 100644 --- a/tools/nss/meson.build +++ b/tools/nss/meson.build @@ -66,6 +66,7 @@ nss_libvirt_lib = shared_module( link_args: [ nss_libvirt_syms, libvirt_export_dynamic, + coverage_flags, ], link_whole: [ nss_libvirt_impl, @@ -81,6 +82,7 @@ nss_libvirt_guest_lib = shared_library( link_args: [ nss_libvirt_guest_syms, libvirt_export_dynamic, + coverage_flags, ], link_whole: [ nss_libvirt_guest_impl, diff --git a/tools/wireshark/src/meson.build b/tools/wireshark/src/meson.build index 49ccc9bb86..9b452dc5ca 100644 --- a/tools/wireshark/src/meson.build +++ b/tools/wireshark/src/meson.build @@ -12,6 +12,9 @@ shared_library( xdr_dep, tools_dep, ], + link_args: [ + coverage_flags + ], install: true, install_dir: wireshark_plugindir, )