forked from OSchip/llvm-project
56 lines
1.6 KiB
Python
56 lines
1.6 KiB
Python
# -*- Python -*-
|
|
|
|
import os
|
|
|
|
# Setup config name.
|
|
config.name = 'Scudo' + config.name_suffix
|
|
|
|
# Setup source root.
|
|
config.test_source_root = os.path.dirname(__file__)
|
|
|
|
# Path to the static library
|
|
base_lib = os.path.join(config.compiler_rt_libdir,
|
|
"libclang_rt.scudo-%s.a" % config.target_arch)
|
|
whole_archive = "-Wl,-whole-archive %s -Wl,-no-whole-archive " % base_lib
|
|
|
|
# Test suffixes.
|
|
config.suffixes = ['.c', '.cc', '.cpp']
|
|
|
|
# C flags.
|
|
c_flags = ([config.target_cflags] +
|
|
["-std=c++11",
|
|
"-pthread",
|
|
"-fPIE",
|
|
"-pie",
|
|
"-O0",
|
|
"-UNDEBUG",
|
|
"-ldl",
|
|
"-Wl,--gc-sections"])
|
|
|
|
# Android doesn't want -lrt.
|
|
if not config.android:
|
|
c_flags += ["-lrt"]
|
|
|
|
def build_invocation(compile_flags):
|
|
return " " + " ".join([config.compile_wrapper, config.clang] + compile_flags) + " "
|
|
|
|
# Add clang substitutions.
|
|
config.substitutions.append(("%clang_scudo ",
|
|
build_invocation(c_flags) + whole_archive))
|
|
|
|
# Platform-specific default SCUDO_OPTIONS for lit tests.
|
|
default_scudo_opts = ''
|
|
if config.android:
|
|
# Android defaults to abort_on_error=1, which doesn't work for us.
|
|
default_scudo_opts = 'abort_on_error=0'
|
|
|
|
if default_scudo_opts:
|
|
config.environment['SCUDO_OPTIONS'] = default_scudo_opts
|
|
default_scudo_opts += ':'
|
|
config.substitutions.append(('%env_scudo_opts=',
|
|
'env SCUDO_OPTIONS=' + default_scudo_opts))
|
|
|
|
# Hardened Allocator tests are currently supported on Linux only.
|
|
if config.host_os not in ['Linux']:
|
|
config.unsupported = True
|