waf: add support for the macOS clang address sanitizer
This commit is contained in:
parent
0e40d1cb6b
commit
6245197204
@ -541,6 +541,13 @@ information across clean commands, so that that information is changed
|
||||
only when really necessary. Also, some tasks that don't really produce
|
||||
files persist their signature. This option avoids that behavior when
|
||||
cleaning the build.
|
||||
''')
|
||||
|
||||
g.add_option('--asan',
|
||||
action='store_true',
|
||||
help='''Build using the macOS clang Address Sanitizer. In order to run with
|
||||
Address Sanitizer support llvm-symbolizer is required to be on the PATH.
|
||||
This option is only supported on macOS versions of clang.
|
||||
''')
|
||||
|
||||
def build(bld):
|
||||
|
@ -385,6 +385,12 @@ class sitl(Board):
|
||||
'-O3',
|
||||
]
|
||||
|
||||
if 'clang++' in cfg.env.COMPILER_CXX and cfg.options.asan:
|
||||
env.CXXFLAGS += [
|
||||
'-fsanitize=address',
|
||||
'-fno-omit-frame-pointer',
|
||||
]
|
||||
|
||||
env.LIB += [
|
||||
'm',
|
||||
]
|
||||
@ -393,6 +399,10 @@ class sitl(Board):
|
||||
cfg.check_feenableexcept()
|
||||
|
||||
env.LINKFLAGS += ['-pthread',]
|
||||
|
||||
if cfg.env.DEBUG and 'clang++' in cfg.env.COMPILER_CXX and cfg.options.asan:
|
||||
env.LINKFLAGS += ['-fsanitize=address']
|
||||
|
||||
env.AP_LIBRARIES += [
|
||||
'AP_HAL_SITL',
|
||||
'SITL',
|
||||
|
Loading…
Reference in New Issue
Block a user