[libvirt PATCH v2 2/7] meson: Allow undefined symbols when sanitizers are enabled

Tim Wiederhake posted 7 patches 4 years, 9 months ago
[libvirt PATCH v2 2/7] meson: Allow undefined symbols when sanitizers are enabled
Posted by Tim Wiederhake 4 years, 9 months ago
When enabling sanitizers, clang adds some function symbols when
instrumenting the code. The exact names of those functions are an
implementation detail and should therefore not be added to any
syms file. This patch prevents build failures due to those symbols
not present in the syms file when building with sanitizers enabled.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 meson.build | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index 997a23f1b0..02feb0e43d 100644
--- a/meson.build
+++ b/meson.build
@@ -491,9 +491,12 @@ libvirt_nodelete = cc.get_supported_link_arguments([
   '-Wl,-z,nodelete',
 ])
 
-libvirt_no_undefined = cc.get_supported_link_arguments([
-  '-Wl,-z,defs',
-])
+libvirt_no_undefined = []
+if get_option('b_sanitize') == 'none'
+  libvirt_no_undefined += cc.get_supported_link_arguments([
+    '-Wl,-z,defs',
+  ])
+endif
 
 libvirt_no_indirect = cc.get_supported_link_arguments([
   '-Wl,--no-copy-dt-needed-entries',
-- 
2.26.3

Re: [libvirt PATCH v2 2/7] meson: Allow undefined symbols when sanitizers are enabled
Posted by Pavel Hrdina 4 years, 9 months ago
On Thu, May 06, 2021 at 05:08:33PM +0200, Tim Wiederhake wrote:
> When enabling sanitizers, clang adds some function symbols when
> instrumenting the code. The exact names of those functions are an
> implementation detail and should therefore not be added to any
> syms file. This patch prevents build failures due to those symbols
> not present in the syms file when building with sanitizers enabled.
> 
> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
> ---
>  meson.build | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>