Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -90,6 +90,11 @@ option(SANITIZER_CAN_USE_CXXABI "Sanitizers can use cxxabi" ${use_cxxabi_default}) pythonize_bool(SANITIZER_CAN_USE_CXXABI) +option(SANITIZER_USE_SOFTWARE_MEMORY_MANAGER + "Experimental: Use software memory manager instead of mmap() in sanitizers." OFF) +mark_as_advanced(SANITIZER_USE_SOFTWARE_MEMORY_MANAGER) +pythonize_bool(SANITIZER_USE_SOFTWARE_MEMORY_MANAGER) + #================================ # Setup Compiler Flags #================================ Index: lib/asan/tests/CMakeLists.txt =================================================================== --- lib/asan/tests/CMakeLists.txt +++ lib/asan/tests/CMakeLists.txt @@ -328,7 +328,10 @@ darwin_filter_host_archs(ASAN_SUPPORTED_ARCH ASAN_TEST_ARCH) endif() foreach(arch ${ASAN_TEST_ARCH}) - add_asan_tests_for_arch_and_kind(${arch} "-inline") + # The software memory manager requires out-of-line instrumentation. + if(NOT SANITIZER_USE_SOFTWARE_MEMORY_MANAGER) + add_asan_tests_for_arch_and_kind(${arch} "-inline") + endif() add_asan_tests_for_arch_and_kind(${arch} "-with-calls" -mllvm -asan-instrumentation-with-call-threshold=0) endforeach() Index: test/asan/lit.cfg =================================================================== --- test/asan/lit.cfg +++ test/asan/lit.cfg @@ -81,6 +81,10 @@ config.debug_info_flags + target_cflags) if config.target_arch == 's390x': clang_asan_static_cflags.append("-mbackchain") + +if config.use_software_memory_manager: + clang_asan_static_cflags.extend( + ["-mllvm", "-asan-instrumentation-with-call-threshold=0"]) clang_asan_static_cxxflags = config.cxx_mode_flags + clang_asan_static_cflags asan_dynamic_flags = [] Index: test/lit.common.configured.in =================================================================== --- test/lit.common.configured.in +++ test/lit.common.configured.in @@ -28,6 +28,8 @@ set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@) set_default("has_lld", @COMPILER_RT_HAS_LLD_PYBOOL@) set_default("can_symbolize", @CAN_SYMBOLIZE@) +set_default("use_software_memory_manager", + "@SANITIZER_USE_SOFTWARE_MEMORY_MANAGER_PYBOOL@") config.available_features.add('target-is-%s' % config.target_arch) # LLVM tools dir can be passed in lit parameters, so try to