From 604adce33f89762f05e5385266d7b1a7d2f344db Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Thu, 15 Jun 2017 22:39:21 -0400 Subject: [PATCH 1/2] gnome: Fix getting sanitize cflags for gir There was an API break somewhere and this wasn't kept in sync. Part of #1910 --- mesonbuild/modules/gnome.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 6ec70403c..7a7ad6799 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -456,8 +456,8 @@ class GnomeModule(ExtensionModule): cflags += state.global_args[lang] if state.project_args.get(lang): cflags += state.project_args[lang] - sanitize = compiler.get_options().get('b_sanitize') - if sanitize: + if 'b_sanitize' in compiler.base_options: + sanitize = state.environment.coredata.base_options['b_sanitize'].value cflags += compilers.sanitizer_compile_args(sanitize) if kwargs.get('symbol_prefix'): sym_prefix = kwargs.pop('symbol_prefix') From ccb253189ad970354d46f0a8e3bf381774c404af Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Thu, 15 Jun 2017 22:52:34 -0400 Subject: [PATCH 2/2] gnome.generate_gir(): Fix linking to libasan if sanitizer enabled This is a bit of a workaround linking directly to it but it is at least functional unlike before. Fixes #1910 --- mesonbuild/modules/gnome.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 7a7ad6799..6f38661ef 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -444,6 +444,7 @@ class GnomeModule(ExtensionModule): 'Gir includes must be str, GirTarget, or list of them') cflags = [] + ldflags = [] for lang, compiler in girtarget.compilers.items(): # XXX: Can you use g-i with any other language? if lang in ('c', 'cpp', 'objc', 'objcpp', 'd'): @@ -459,6 +460,11 @@ class GnomeModule(ExtensionModule): if 'b_sanitize' in compiler.base_options: sanitize = state.environment.coredata.base_options['b_sanitize'].value cflags += compilers.sanitizer_compile_args(sanitize) + if sanitize == 'address': + ldflags += ['-lasan'] + # FIXME: Linking directly to libasan is not recommended but g-ir-scanner + # does not understand -f LDFLAGS. https://bugzilla.gnome.org/show_bug.cgi?id=783892 + # ldflags += compilers.sanitizer_link_args(sanitize) if kwargs.get('symbol_prefix'): sym_prefix = kwargs.pop('symbol_prefix') if not isinstance(sym_prefix, str): @@ -521,9 +527,10 @@ class GnomeModule(ExtensionModule): # ldflags will be misinterpreted by gir scanner (showing # spurious dependencies) but building GStreamer fails if they # are not used here. - dep_cflags, ldflags, gi_includes = self._get_dependencies_flags(deps, state, depends, - use_gir_args=True) + dep_cflags, dep_ldflags, gi_includes = self._get_dependencies_flags(deps, state, depends, + use_gir_args=True) cflags += list(dep_cflags) + ldflags += list(dep_ldflags) scan_command += ['--cflags-begin'] scan_command += cflags scan_command += ['--cflags-end']