diff options
author | Vincent Belliard <vincent.belliard@arm.com> | 2018-04-03 13:34:44 -0700 |
---|---|---|
committer | Vincent Belliard <vincent.belliard@arm.com> | 2018-04-13 17:58:10 +0000 |
commit | 4e52d4db0b9629aa57ecd354afb31bc814eef5b7 (patch) | |
tree | 7fe9d730305310f637b3c277b8edc6be0ca1ab83 /SConstruct | |
parent | b57e362cb586c1aee238aeec0123f462498cb338 (diff) |
Add ubsan option for compilation and fix ubsan errors.
Change-Id: I80e40b804cc1d4389f098de834e13ce6a042fc06
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -110,6 +110,10 @@ options = { }, 'code_buffer_allocator:malloc' : { 'CCFLAGS' : ['-DVIXL_CODE_BUFFER_MALLOC'] + }, + 'ubsan:on' : { + 'CCFLAGS': ['-fsanitize=undefined'], + 'LINKFLAGS': ['-fsanitize=undefined'] } } @@ -235,6 +239,8 @@ vars.AddVariables( 'aarch64' : ['a64'], 'a64' : ['a64']}), EnumVariable('mode', 'Build mode', 'release', allowed_values=config.build_options_modes), + EnumVariable('ubsan', 'Enable undefined behavior checks', + 'off', allowed_values=['on', 'off']), EnumVariable('negative_testing', 'Enable negative testing (needs exceptions)', 'off', allowed_values=['on', 'off']), @@ -364,6 +370,9 @@ def ConfigureEnvironmentForCompiler(env): if compiler != 'clang-3.4': env.Append(CPPFLAGS = ['-Wunreachable-code']) + if env['ubsan'] == 'on': + env.Append(LINKFLAGS = ['-fuse-ld=lld']) + # GCC 4.8 has a bug which produces a warning saying that an anonymous Operand # object might be used uninitialized: # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57045 |