hwasan: Enable -hwasan-allow-ifunc by default.
[lldb.git] / compiler-rt / test / hwasan / lit.cfg
1 # -*- Python -*-
2
3 import os
4
5 # Setup config name.
6 config.name = 'HWAddressSanitizer' + getattr(config, 'name_suffix', 'default')
7
8 # Setup source root.
9 config.test_source_root = os.path.dirname(__file__)
10
11 # Setup default compiler flags used with -fsanitize=memory option.
12 clang_cflags = [config.target_cflags] + config.debug_info_flags
13 clang_cxxflags = config.cxx_mode_flags + clang_cflags
14 clang_hwasan_cflags = ["-fsanitize=hwaddress", "-mllvm", "-hwasan-generate-tags-with-calls"] + clang_cflags
15 clang_hwasan_cxxflags = config.cxx_mode_flags + clang_hwasan_cflags
16
17 def build_invocation(compile_flags):
18   return " " + " ".join([config.clang] + compile_flags) + " "
19
20 config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
21 config.substitutions.append( ("%clang_hwasan ", build_invocation(clang_hwasan_cflags)) )
22 config.substitutions.append( ("%clangxx_hwasan ", build_invocation(clang_hwasan_cxxflags)) )
23 config.substitutions.append( ("%compiler_rt_libdir", config.compiler_rt_libdir) )
24
25 default_hwasan_opts_str = ':'.join(['disable_allocator_tagging=1', 'random_tags=0'] + config.default_sanitizer_opts)
26 if default_hwasan_opts_str:
27   config.environment['HWASAN_OPTIONS'] = default_hwasan_opts_str
28   default_hwasan_opts_str += ':'
29 config.substitutions.append(('%env_hwasan_opts=',
30                              'env HWASAN_OPTIONS=' + default_hwasan_opts_str))
31
32 # Default test suffixes.
33 config.suffixes = ['.c', '.cc', '.cpp']
34
35 if config.host_os not in ['Linux', 'Android']:
36   config.unsupported = True