mirror of https://github.com/ArduPilot/ardupilot
waf: added --ubsan and --ubsan-abort options
This commit is contained in:
parent
3385d3ae62
commit
acf56204f2
|
@ -582,6 +582,14 @@ Address Sanitizer support llvm-symbolizer is required to be on the PATH.
|
|||
This option is only supported on macOS versions of clang.
|
||||
''')
|
||||
|
||||
g.add_option('--ubsan',
|
||||
action='store_true',
|
||||
help='''Build using the gcc undefined behaviour sanitizer''')
|
||||
|
||||
g.add_option('--ubsan-abort',
|
||||
action='store_true',
|
||||
help='''Build using the gcc undefined behaviour sanitizer and abort on error''')
|
||||
|
||||
def build(bld):
|
||||
bld.add_pre_fun(_process_build_command)
|
||||
bld.add_pre_fun(_select_programs_from_group)
|
||||
|
|
|
@ -557,6 +557,21 @@ class sitl(Board):
|
|||
'-Werror=float-equal'
|
||||
]
|
||||
|
||||
if cfg.options.ubsan or cfg.options.ubsan_abort:
|
||||
env.CXXFLAGS += [
|
||||
"-fsanitize=undefined",
|
||||
"-fsanitize=float-cast-overflow",
|
||||
]
|
||||
env.LINKFLAGS += [
|
||||
"-fsanitize=undefined",
|
||||
"-lubsan",
|
||||
]
|
||||
|
||||
if cfg.options.ubsan_abort:
|
||||
env.CXXFLAGS += [
|
||||
"-fno-sanitize-recover"
|
||||
]
|
||||
|
||||
if not cfg.env.DEBUG:
|
||||
env.CXXFLAGS += [
|
||||
'-O3',
|
||||
|
|
Loading…
Reference in New Issue