Index: compiler-rt/trunk/cmake/config-ix.cmake =================================================================== --- compiler-rt/trunk/cmake/config-ix.cmake +++ compiler-rt/trunk/cmake/config-ix.cmake @@ -192,7 +192,7 @@ set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${PPC64} ${S390X}) set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64}) -set(ALL_FUZZER_SUPPORTED_ARCH x86_64) +set(ALL_FUZZER_SUPPORTED_ARCH ${X86_64} ${ARM64}) if(APPLE) set(ALL_LSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${MIPS64} ${ARM64}) Index: compiler-rt/trunk/lib/fuzzer/CMakeLists.txt =================================================================== --- compiler-rt/trunk/lib/fuzzer/CMakeLists.txt +++ compiler-rt/trunk/lib/fuzzer/CMakeLists.txt @@ -50,9 +50,7 @@ list(APPEND LIBFUZZER_CFLAGS -Dthread_local=__thread) endif() -if(APPLE) - set(FUZZER_SUPPORTED_OS osx) -endif() +set(FUZZER_SUPPORTED_OS ${SANITIZER_COMMON_SUPPORTED_OS}) add_compiler_rt_object_libraries(RTfuzzer OS ${FUZZER_SUPPORTED_OS} Index: compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt =================================================================== --- compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt +++ compiler-rt/trunk/lib/fuzzer/tests/CMakeLists.txt @@ -6,6 +6,10 @@ -Werror -O2) +if (APPLE) + set(FUZZER_SUPPORTED_OS osx) +endif() + add_custom_target(FuzzerUnitTests) set_target_properties(FuzzerUnitTests PROPERTIES FOLDER "Compiler-RT Tests") Index: compiler-rt/trunk/test/fuzzer/CMakeLists.txt =================================================================== --- compiler-rt/trunk/test/fuzzer/CMakeLists.txt +++ compiler-rt/trunk/test/fuzzer/CMakeLists.txt @@ -10,6 +10,8 @@ set(EXCLUDE_FROM_ALL ON) add_custom_target(check-fuzzer) +set(LIBFUZZER_TEST_IOS "0") +pythonize_bool(LIBFUZZER_TEST_IOS) if(COMPILER_RT_INCLUDE_TESTS) # libFuzzer unit tests. @@ -71,3 +73,27 @@ test_fuzzer("static-libc++" DEPS cxx_static) endif() endif() + +if (APPLE) + set(EXCLUDE_FROM_ALL ON) + + foreach(arch ${DARWIN_ios_ARCHS}) + set(LIBFUZZER_TEST_IOS "1") + pythonize_bool(LIBFUZZER_TEST_IOS) + set(LIBFUZZER_TEST_TARGET_ARCH ${arch}) + set(LIBFUZZER_TEST_FLAGS "-arch ${arch} -isysroot ${DARWIN_ios_SYSROOT} ${COMPILER_RT_TEST_COMPILER_CFLAGS}") + set(LIBFUZZER_TEST_CONFIG_SUFFIX "-${arch}-ios") + string(TOUPPER ${arch} ARCH_UPPER_CASE) + set(CONFIG_NAME "IOS${ARCH_UPPER_CASE}Config") + configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg + ) + add_lit_testsuite(check-fuzzer-ios-${arch} "libFuzzer iOS ${arch} tests" + ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/ + DEPENDS ${LIBFUZZER_TEST_DEPS}) + + endforeach() + + set(EXCLUDE_FROM_ALL OFF) +endif() Index: compiler-rt/trunk/test/fuzzer/lit.cfg =================================================================== --- compiler-rt/trunk/test/fuzzer/lit.cfg +++ compiler-rt/trunk/test/fuzzer/lit.cfg @@ -2,7 +2,7 @@ import sys import os -config.name = "LLVMFuzzer" +config.name = "libFuzzer" + config.name_suffix config.test_format = lit.formats.ShTest(True) config.suffixes = ['.test'] config.test_source_root = os.path.dirname(__file__) @@ -51,6 +51,7 @@ def generate_compiler_cmd(is_cpp=True, fuzzer_enabled=True): compiler_cmd = config.clang + extra_cmd = config.target_flags if config.clang and config.stdlib == 'libc++': link_cmd = '-stdlib=libc++ -Wl,-rpath=%s' % config.llvm_library_dir elif config.clang and config.stdlib == 'static-libc++': @@ -66,18 +67,14 @@ if fuzzer_enabled: sanitizers.append('fuzzer') sanitizers_cmd = ('-fsanitize=%s' % ','.join(sanitizers)) - if config.osx_sysroot_flag: - isysroot_cmd = config.osx_sysroot_flag - else: - isysroot_cmd = '' return " ".join([ compiler_cmd, std_cmd, link_cmd, "-O2 -gline-tables-only", - isysroot_cmd, sanitizers_cmd, - "-I%s" % libfuzzer_src_root + "-I%s" % libfuzzer_src_root, + extra_cmd ]) config.substitutions.append(('%cpp_compiler', @@ -95,3 +92,9 @@ config.substitutions.append(('%no_fuzzer_c_compiler', generate_compiler_cmd(is_cpp=False, fuzzer_enabled=False) )) + +if config.host_os == 'Darwin': + if config.target_arch in ["x86_64", "x86_64h"]: + config.parallelism_group = "darwin-64bit-sanitizer" + elif config.ios and not config.iossim: + config.parallelism_group = "darwin-ios-device-sanitizer" Index: compiler-rt/trunk/test/fuzzer/lit.site.cfg.in =================================================================== --- compiler-rt/trunk/test/fuzzer/lit.site.cfg.in +++ compiler-rt/trunk/test/fuzzer/lit.site.cfg.in @@ -6,6 +6,8 @@ config.target_flags = "@LIBFUZZER_TEST_FLAGS@" config.c_compiler = "@LIBFUZZER_TEST_COMPILER@" config.stdlib = "@LIBFUZZER_TEST_STDLIB@" +config.ios = @LIBFUZZER_TEST_IOS_PYBOOL@ +config.name_suffix = "@LIBFUZZER_TEST_CONFIG_SUFFIX@" config.osx_sysroot_flag = "@OSX_SYSROOT_FLAG@" config.cmake_binary_dir = "@CMAKE_BINARY_DIR@"