waf: Add address sanitizer configure option.
authorAndreas Schneider <asn@samba.org>
Mon, 26 Jan 2015 15:16:15 +0000 (16:16 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 28 Jan 2015 16:17:07 +0000 (17:17 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
buildtools/wafsamba/samba_autoconf.py
buildtools/wafsamba/wscript

index 8d84a5e406995e264562fb90da4c02e72e27918d..c13bfe7652791580aaa4051f9985ee8d77ba545f 100644 (file)
@@ -703,6 +703,11 @@ int main(void) {
     if Options.options.pedantic:
         conf.ADD_CFLAGS('-W', testflags=True)
 
+    if Options.options.address_sanitizer:
+        conf.ADD_CFLAGS('-fno-omit-frame-pointer -O1 -fsanitize=address', testflags=True)
+        conf.ADD_LDFLAGS('-fsanitize=address', testflags=True)
+        conf.env['ADDRESS_SANITIZER'] = True
+
 
     # Let people pass an additional ADDITIONAL_{CFLAGS,LDFLAGS}
     # environment variables which are only used the for final build.
index c81a7b3b098adb031fd4f4f32a2b3a50bf493065..86224d4b4a6b3c798e3522566df5cdd251503a15 100755 (executable)
@@ -117,6 +117,9 @@ def set_options(opt):
     gr.add_option('--git-local-changes',
                   help=("mark version with + if local git changes"),
                   action='store_true', dest='GIT_LOCAL_CHANGES', default=False)
+    gr.add_option('--address-sanitizer',
+                   help=("Enable address sanitizer compile and liker flags"),
+                   action="store_true", dest='address_sanitizer', default=False)
 
     gr.add_option('--abi-check',
                   help=("Check ABI signatures for libraries"),