From e5d80878b8dd26c9d59029d9fa24cbdea61a0211 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 23 Jan 2025 10:11:20 +0300 Subject: [PATCH] scripts: waifulib: add asan-only build type --- scripts/waifulib/compiler_optimizations.py | 13 ++++++++++++- utils/run-fuzzer/wscript | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/waifulib/compiler_optimizations.py b/scripts/waifulib/compiler_optimizations.py index f700f3a1..d2075cd1 100644 --- a/scripts/waifulib/compiler_optimizations.py +++ b/scripts/waifulib/compiler_optimizations.py @@ -30,7 +30,7 @@ compiler_optimizations.CFLAGS['gottagofast'] = { } ''' -VALID_BUILD_TYPES = ['fastnative', 'fast', 'humanrights', 'debug', 'sanitize', 'msan', 'none'] +VALID_BUILD_TYPES = ['fastnative', 'fast', 'humanrights', 'debug', 'sanitize', 'msan', 'asan', 'none'] LINKFLAGS = { 'common': { @@ -42,6 +42,11 @@ LINKFLAGS = { 'clang': ['-fsanitize=memory', '-pthread'], 'default': ['NO_MSAN_HERE'] }, + 'asan': { + 'clang': ['-fsanitize=address', '-pthread'], + 'gcc': ['-fsanitize=address', '-pthread'], + 'msvc': ['/SAFESEH:NO'] + }, 'sanitize': { 'clang': ['-fsanitize=undefined', '-fsanitize=address', '-pthread'], 'gcc': ['-fsanitize=undefined', '-fsanitize=address', '-pthread'], @@ -95,6 +100,12 @@ CFLAGS = { 'clang': ['-O2', '-g', '-fno-omit-frame-pointer', '-fsanitize=memory', '-pthread'], 'default': ['NO_MSAN_HERE'] }, + 'asan': { + 'msvc': ['/Od', '/RTC1', '/Zi', '/fsanitize=address'], + 'gcc': ['-Og', '-fsanitize=address', '-pthread'], + 'clang': ['-Og', '-fsanitize=address', '-pthread'], + 'default': ['-O0'] + }, 'sanitize': { 'msvc': ['/Od', '/RTC1', '/Zi', '/fsanitize=address'], 'gcc': ['-O0', '-fsanitize=undefined', '-fsanitize=address', '-pthread'], diff --git a/utils/run-fuzzer/wscript b/utils/run-fuzzer/wscript index 124f528a..5d798a88 100644 --- a/utils/run-fuzzer/wscript +++ b/utils/run-fuzzer/wscript @@ -6,7 +6,7 @@ def options(opt): pass def configure(conf): - if conf.options.BUILD_TYPE != 'sanitize': + if conf.options.BUILD_TYPE not in ['sanitize', 'asan']: conf.fatal('useless without -T sanitize') if conf.env.COMPILER_CC != 'clang':