From cf68c1accb50f4d8449e993c630559a3d3e9dd36 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 26 Jan 2015 16:16:15 +0100 Subject: [PATCH] waf: Add address sanitizer configure option. Signed-off-by: Andreas Schneider Reviewed-by: Stefan Metzmacher --- buildtools/wafsamba/samba_autoconf.py | 5 +++++ buildtools/wafsamba/wscript | 3 +++ 2 files changed, 8 insertions(+) diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index 8d84a5e4069..c13bfe76527 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -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. diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript index c81a7b3b098..86224d4b4a6 100755 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript @@ -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"), -- 2.34.1