Index: vendor/compiler-rt/dist/cmake/Modules/BuiltinTests.cmake =================================================================== --- vendor/compiler-rt/dist/cmake/Modules/BuiltinTests.cmake (revision 304301) +++ vendor/compiler-rt/dist/cmake/Modules/BuiltinTests.cmake (revision 304302) @@ -1,62 +1,79 @@ # This function takes an OS and a list of architectures and identifies the # subset of the architectures list that the installed toolchain can target. function(try_compile_only output) + cmake_parse_arguments(ARG "" "" "SOURCE;FLAGS" ${ARGN}) + if(NOT ARG_SOURCE) + set(ARG_SOURCE "int foo(int x, int y) { return x + y; }\n") + endif() set(SIMPLE_C ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/src.c) - file(WRITE ${SIMPLE_C} "int foo(int x, int y) { return x + y; }\n") + file(WRITE ${SIMPLE_C} "${ARG_SOURCE}\n") string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions ${CMAKE_C_COMPILE_OBJECT}) - string(REPLACE ";" " " extra_flags "${ARGN}") + string(REPLACE ";" " " extra_flags "${ARG_FLAGS}") set(test_compile_command "${CMAKE_C_COMPILE_OBJECT}") foreach(substitution ${substitutions}) if(substitution STREQUAL "") string(REPLACE "" "${CMAKE_C_COMPILER}" test_compile_command ${test_compile_command}) elseif(substitution STREQUAL "") string(REPLACE "" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/test.o" test_compile_command ${test_compile_command}) elseif(substitution STREQUAL "") string(REPLACE "" "${SIMPLE_C}" test_compile_command ${test_compile_command}) elseif(substitution STREQUAL "") string(REPLACE "" "${CMAKE_C_FLAGS} ${extra_flags}" test_compile_command ${test_compile_command}) else() string(REPLACE "${substitution}" "" test_compile_command ${test_compile_command}) endif() endforeach() string(REPLACE " " ";" test_compile_command "${test_compile_command}") execute_process( COMMAND ${test_compile_command} RESULT_VARIABLE result OUTPUT_VARIABLE TEST_OUTPUT ERROR_VARIABLE TEST_ERROR ) if(result EQUAL 0) set(${output} True PARENT_SCOPE) else() file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Testing compiler for supporting " ${ARGN} ":\n" "Command: ${test_compile_command}\n" "${TEST_OUTPUT}\n${TEST_ERROR}\n${result}\n") set(${output} False PARENT_SCOPE) endif() endfunction() function(builtin_check_c_compiler_flag flag output) if(NOT DEFINED ${output}) message(STATUS "Performing Test ${output}") - try_compile_only(result ${flag}) + try_compile_only(result FLAGS ${flag}) + set(${output} ${result} CACHE INTERNAL "Compiler supports ${flag}") + if(${result}) + message(STATUS "Performing Test ${output} - Success") + else() + message(STATUS "Performing Test ${output} - Failed") + endif() + endif() +endfunction() + +function(builtin_check_c_compiler_source output source) + if(NOT DEFINED ${output}) + message(STATUS "Performing Test ${output}") + try_compile_only(result SOURCE ${source}) set(${output} ${result} CACHE INTERNAL "Compiler supports ${flag}") if(${result}) message(STATUS "Performing Test ${output} - Success") else() message(STATUS "Performing Test ${output} - Failed") endif() endif() endfunction() Index: vendor/compiler-rt/dist/cmake/builtin-config-ix.cmake =================================================================== --- vendor/compiler-rt/dist/cmake/builtin-config-ix.cmake (revision 304301) +++ vendor/compiler-rt/dist/cmake/builtin-config-ix.cmake (revision 304302) @@ -1,169 +1,179 @@ include(BuiltinTests) +include(CheckCSourceCompiles) # Make all the tests only check the compiler set(TEST_COMPILE_ONLY On) builtin_check_c_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG) builtin_check_c_compiler_flag(-fPIE COMPILER_RT_HAS_FPIE_FLAG) builtin_check_c_compiler_flag(-fno-builtin COMPILER_RT_HAS_FNO_BUILTIN_FLAG) builtin_check_c_compiler_flag(-std=c99 COMPILER_RT_HAS_STD_C99_FLAG) builtin_check_c_compiler_flag(-fvisibility=hidden COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG) builtin_check_c_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG) builtin_check_c_compiler_flag(-ffreestanding COMPILER_RT_HAS_FREESTANDING_FLAG) builtin_check_c_compiler_flag(-mfloat-abi=soft COMPILER_RT_HAS_FLOAT_ABI_SOFT_FLAG) builtin_check_c_compiler_flag(-mfloat-abi=hard COMPILER_RT_HAS_FLOAT_ABI_HARD_FLAG) builtin_check_c_compiler_flag(-static COMPILER_RT_HAS_STATIC_FLAG) + +builtin_check_c_compiler_source(COMPILER_RT_SUPPORTS_ATOMIC_KEYWORD +" +int foo(int x, int y) { + _Atomic int result = x * y; + return result; +} +") + set(ARM64 aarch64) set(ARM32 arm armhf) set(X86 i386 i686) set(X86_64 x86_64) set(MIPS32 mips mipsel) set(MIPS64 mips64 mips64el) set(PPC64 powerpc64 powerpc64le) set(WASM32 wasm32) set(WASM64 wasm64) if(APPLE) set(ARM64 arm64) set(ARM32 armv7 armv7k armv7s) set(X86_64 x86_64 x86_64h) endif() set(ALL_BUILTIN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${WASM32} ${WASM64}) include(CompilerRTUtils) include(CompilerRTDarwinUtils) if(APPLE) find_darwin_sdk_dir(DARWIN_osx_SYSROOT macosx) find_darwin_sdk_dir(DARWIN_iossim_SYSROOT iphonesimulator) find_darwin_sdk_dir(DARWIN_ios_SYSROOT iphoneos) find_darwin_sdk_dir(DARWIN_watchossim_SYSROOT watchsimulator) find_darwin_sdk_dir(DARWIN_watchos_SYSROOT watchos) find_darwin_sdk_dir(DARWIN_tvossim_SYSROOT appletvsimulator) find_darwin_sdk_dir(DARWIN_tvos_SYSROOT appletvos) set(DARWIN_EMBEDDED_PLATFORMS) set(DARWIN_osx_BUILTIN_MIN_VER 10.5) set(DARWIN_osx_BUILTIN_MIN_VER_FLAG -mmacosx-version-min=${DARWIN_osx_BUILTIN_MIN_VER}) if(COMPILER_RT_ENABLE_IOS) list(APPEND DARWIN_EMBEDDED_PLATFORMS ios) set(DARWIN_ios_MIN_VER_FLAG -miphoneos-version-min) set(DARWIN_ios_BUILTIN_MIN_VER 6.0) set(DARWIN_ios_BUILTIN_MIN_VER_FLAG ${DARWIN_ios_MIN_VER_FLAG}=${DARWIN_ios_BUILTIN_MIN_VER}) endif() if(COMPILER_RT_ENABLE_WATCHOS) list(APPEND DARWIN_EMBEDDED_PLATFORMS watchos) set(DARWIN_watchos_MIN_VER_FLAG -mwatchos-version-min) set(DARWIN_watchos_BUILTIN_MIN_VER 2.0) set(DARWIN_watchos_BUILTIN_MIN_VER_FLAG ${DARWIN_watchos_MIN_VER_FLAG}=${DARWIN_watchos_BUILTIN_MIN_VER}) endif() if(COMPILER_RT_ENABLE_TVOS) list(APPEND DARWIN_EMBEDDED_PLATFORMS tvos) set(DARWIN_tvos_MIN_VER_FLAG -mtvos-version-min) set(DARWIN_tvos_BUILTIN_MIN_VER 9.0) set(DARWIN_tvos_BUILTIN_MIN_VER_FLAG ${DARWIN_tvos_MIN_VER_FLAG}=${DARWIN_tvos_BUILTIN_MIN_VER}) endif() set(BUILTIN_SUPPORTED_OS osx) # We're setting the flag manually for each target OS set(CMAKE_OSX_DEPLOYMENT_TARGET "") if(NOT DARWIN_osx_ARCHS) set(DARWIN_osx_ARCHS i386 x86_64 x86_64h) endif() set(DARWIN_sim_ARCHS i386 x86_64) set(DARWIN_device_ARCHS armv7 armv7s armv7k arm64) message(STATUS "OSX supported arches: ${DARWIN_osx_ARCHS}") foreach(arch ${DARWIN_osx_ARCHS}) list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch}) set(CAN_TARGET_${arch} 1) endforeach() # Need to build a 10.4 compatible libclang_rt set(DARWIN_10.4_SYSROOT ${DARWIN_osx_SYSROOT}) set(DARWIN_10.4_BUILTIN_MIN_VER 10.4) set(DARWIN_10.4_BUILTIN_MIN_VER_FLAG -mmacosx-version-min=${DARWIN_10.4_BUILTIN_MIN_VER}) set(DARWIN_10.4_SKIP_CC_KEXT On) darwin_test_archs(10.4 DARWIN_10.4_ARCHS i386 x86_64) message(STATUS "OSX 10.4 supported builtin arches: ${DARWIN_10.4_ARCHS}") if(DARWIN_10.4_ARCHS) # don't include the Haswell slice in the 10.4 compatibility library list(REMOVE_ITEM DARWIN_10.4_ARCHS x86_64h) list(APPEND BUILTIN_SUPPORTED_OS 10.4) endif() foreach(platform ${DARWIN_EMBEDDED_PLATFORMS}) if(DARWIN_${platform}sim_SYSROOT) set(DARWIN_${platform}sim_BUILTIN_MIN_VER ${DARWIN_${platform}_BUILTIN_MIN_VER}) set(DARWIN_${platform}sim_BUILTIN_MIN_VER_FLAG ${DARWIN_${platform}_BUILTIN_MIN_VER_FLAG}) set(DARWIN_${platform}sim_SKIP_CC_KEXT On) set(test_arches ${DARWIN_sim_ARCHS}) if(DARWIN_${platform}sim_ARCHS) set(test_arches DARWIN_${platform}sim_ARCHS) endif() darwin_test_archs(${platform}sim DARWIN_${platform}sim_ARCHS ${test_arches}) message(STATUS "${platform} Simulator supported builtin arches: ${DARWIN_${platform}sim_ARCHS}") if(DARWIN_${platform}sim_ARCHS) list(APPEND BUILTIN_SUPPORTED_OS ${platform}sim) endif() foreach(arch ${DARWIN_${platform}sim_ARCHS}) list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch}) set(CAN_TARGET_${arch} 1) endforeach() endif() if(DARWIN_${platform}_SYSROOT) set(test_arches ${DARWIN_device_ARCHS}) if(DARWIN_${platform}_ARCHS) set(test_arches DARWIN_${platform}_ARCHS) endif() darwin_test_archs(${platform} DARWIN_${platform}_ARCHS ${test_arches}) message(STATUS "${platform} supported builtin arches: ${DARWIN_${platform}_ARCHS}") if(DARWIN_${platform}_ARCHS) list(APPEND BUILTIN_SUPPORTED_OS ${platform}) endif() foreach(arch ${DARWIN_${platform}_ARCHS}) list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch}) set(CAN_TARGET_${arch} 1) endforeach() endif() endforeach() list_intersect(BUILTIN_SUPPORTED_ARCH ALL_BUILTIN_SUPPORTED_ARCH COMPILER_RT_SUPPORTED_ARCH) else() # If we're not building the builtins standalone, just rely on the tests in # config-ix.cmake to tell us what to build. Otherwise we need to do some leg # work here... if(COMPILER_RT_BUILTINS_STANDALONE_BUILD) test_targets() endif() # Architectures supported by compiler-rt libraries. filter_available_targets(BUILTIN_SUPPORTED_ARCH ${ALL_BUILTIN_SUPPORTED_ARCH}) endif() message(STATUS "Builtin supported architectures: ${BUILTIN_SUPPORTED_ARCH}") Index: vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt =================================================================== --- vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt (revision 304301) +++ vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt (revision 304302) @@ -1,422 +1,426 @@ # This directory contains a large amount of C code which provides # generic implementations of the core runtime library along with optimized # architecture-specific code in various subdirectories. if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) cmake_minimum_required(VERSION 3.4.3) project(CompilerRTBuiltins C ASM) set(COMPILER_RT_STANDALONE_BUILD TRUE) set(COMPILER_RT_BUILTINS_STANDALONE_BUILD TRUE) list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/../../cmake" "${CMAKE_SOURCE_DIR}/../../cmake/Modules") include(base-config-ix) include(CompilerRTUtils) if(APPLE) include(CompilerRTDarwinUtils) endif() include(AddCompilerRT) endif() include(builtin-config-ix) # TODO: Need to add a mechanism for logging errors when builtin source files are # added to a sub-directory and not this CMakeLists file. set(GENERIC_SOURCES absvdi2.c absvsi2.c absvti2.c adddf3.c addsf3.c addtf3.c addvdi3.c addvsi3.c addvti3.c apple_versioning.c ashldi3.c ashlti3.c ashrdi3.c ashrti3.c - # FIXME: atomic.c may only be compiled if host compiler understands _Atomic - # atomic.c clear_cache.c clzdi2.c clzsi2.c clzti2.c cmpdi2.c cmpti2.c comparedf2.c comparesf2.c cpu_model.c ctzdi2.c ctzsi2.c ctzti2.c divdc3.c divdf3.c divdi3.c divmoddi4.c divmodsi4.c divsc3.c divsf3.c divsi3.c divtc3.c divti3.c divtf3.c divxc3.c enable_execute_stack.c eprintf.c extendsfdf2.c extendhfsf2.c ffsdi2.c ffsti2.c fixdfdi.c fixdfsi.c fixdfti.c fixsfdi.c fixsfsi.c fixsfti.c fixunsdfdi.c fixunsdfsi.c fixunsdfti.c fixunssfdi.c fixunssfsi.c fixunssfti.c fixunsxfdi.c fixunsxfsi.c fixunsxfti.c fixxfdi.c fixxfti.c floatdidf.c floatdisf.c floatdixf.c floatsidf.c floatsisf.c floattidf.c floattisf.c floattixf.c floatundidf.c floatundisf.c floatundixf.c floatunsidf.c floatunsisf.c floatuntidf.c floatuntisf.c floatuntixf.c int_util.c lshrdi3.c lshrti3.c moddi3.c modsi3.c modti3.c muldc3.c muldf3.c muldi3.c mulodi4.c mulosi4.c muloti4.c mulsc3.c mulsf3.c multi3.c multf3.c mulvdi3.c mulvsi3.c mulvti3.c mulxc3.c negdf2.c negdi2.c negsf2.c negti2.c negvdi2.c negvsi2.c negvti2.c paritydi2.c paritysi2.c parityti2.c popcountdi2.c popcountsi2.c popcountti2.c powidf2.c powisf2.c powitf2.c powixf2.c subdf3.c subsf3.c subvdi3.c subvsi3.c subvti3.c subtf3.c trampoline_setup.c truncdfhf2.c truncdfsf2.c truncsfhf2.c ucmpdi2.c ucmpti2.c udivdi3.c udivmoddi4.c udivmodsi4.c udivmodti4.c udivsi3.c udivti3.c umoddi3.c umodsi3.c umodti3.c) + +if(COMPILER_RT_SUPPORTS_ATOMIC_KEYWORD) + set(GENERIC_SOURCES + ${GENERIC_SOURCES} + atomic.c) +endif() set(MSVC_SOURCES divsc3.c divdc3.c divxc3.c mulsc3.c muldc3.c mulxc3.c) if(APPLE) set(GENERIC_SOURCES ${GENERIC_SOURCES} atomic_flag_clear.c atomic_flag_clear_explicit.c atomic_flag_test_and_set.c atomic_flag_test_and_set_explicit.c atomic_signal_fence.c atomic_thread_fence.c) endif() if(NOT WIN32 OR MINGW) set(GENERIC_SOURCES ${GENERIC_SOURCES} emutls.c) endif() if (HAVE_UNWIND_H) set(GENERIC_SOURCES ${GENERIC_SOURCES} gcc_personality_v0.c) endif () if (NOT MSVC) set(x86_64_SOURCES x86_64/chkstk.S x86_64/chkstk2.S x86_64/floatdidf.c x86_64/floatdisf.c x86_64/floatdixf.c x86_64/floatundidf.S x86_64/floatundisf.S x86_64/floatundixf.S ${GENERIC_SOURCES}) set(x86_64h_SOURCES ${x86_64_SOURCES}) if (WIN32) set(x86_64_SOURCES ${x86_64_SOURCES} x86_64/chkstk.S x86_64/chkstk2.S) endif() set(i386_SOURCES i386/ashldi3.S i386/ashrdi3.S i386/chkstk.S i386/chkstk2.S i386/divdi3.S i386/floatdidf.S i386/floatdisf.S i386/floatdixf.S i386/floatundidf.S i386/floatundisf.S i386/floatundixf.S i386/lshrdi3.S i386/moddi3.S i386/muldi3.S i386/udivdi3.S i386/umoddi3.S ${GENERIC_SOURCES}) if (WIN32) set(i386_SOURCES ${i386_SOURCES} i386/chkstk.S i386/chkstk2.S) endif() set(i686_SOURCES ${i386_SOURCES}) else () # MSVC # Use C versions of functions when building on MSVC # MSVC's assembler takes Intel syntax, not AT&T syntax. # Also use only MSVC compilable builtin implementations. set(x86_64_SOURCES x86_64/floatdidf.c x86_64/floatdisf.c x86_64/floatdixf.c ${MSVC_SOURCES}) set(x86_64h_SOURCES ${x86_64_SOURCES}) set(i386_SOURCES ${MSVC_SOURCES}) set(i686_SOURCES ${i386_SOURCES}) endif () # if (NOT MSVC) set(arm_SOURCES arm/adddf3vfp.S arm/addsf3vfp.S arm/aeabi_cdcmp.S arm/aeabi_cdcmpeq_check_nan.c arm/aeabi_cfcmp.S arm/aeabi_cfcmpeq_check_nan.c arm/aeabi_dcmp.S arm/aeabi_div0.c arm/aeabi_drsub.c arm/aeabi_fcmp.S arm/aeabi_frsub.c arm/aeabi_idivmod.S arm/aeabi_ldivmod.S arm/aeabi_memcmp.S arm/aeabi_memcpy.S arm/aeabi_memmove.S arm/aeabi_memset.S arm/aeabi_uidivmod.S arm/aeabi_uldivmod.S arm/bswapdi2.S arm/bswapsi2.S arm/clzdi2.S arm/clzsi2.S arm/comparesf2.S arm/divdf3vfp.S arm/divmodsi4.S arm/divsf3vfp.S arm/divsi3.S arm/eqdf2vfp.S arm/eqsf2vfp.S arm/extendsfdf2vfp.S arm/fixdfsivfp.S arm/fixsfsivfp.S arm/fixunsdfsivfp.S arm/fixunssfsivfp.S arm/floatsidfvfp.S arm/floatsisfvfp.S arm/floatunssidfvfp.S arm/floatunssisfvfp.S arm/gedf2vfp.S arm/gesf2vfp.S arm/gtdf2vfp.S arm/gtsf2vfp.S arm/ledf2vfp.S arm/lesf2vfp.S arm/ltdf2vfp.S arm/ltsf2vfp.S arm/modsi3.S arm/muldf3vfp.S arm/mulsf3vfp.S arm/nedf2vfp.S arm/negdf2vfp.S arm/negsf2vfp.S arm/nesf2vfp.S arm/restore_vfp_d8_d15_regs.S arm/save_vfp_d8_d15_regs.S arm/subdf3vfp.S arm/subsf3vfp.S arm/switch16.S arm/switch32.S arm/switch8.S arm/switchu8.S arm/sync_fetch_and_add_4.S arm/sync_fetch_and_add_8.S arm/sync_fetch_and_and_4.S arm/sync_fetch_and_and_8.S arm/sync_fetch_and_max_4.S arm/sync_fetch_and_max_8.S arm/sync_fetch_and_min_4.S arm/sync_fetch_and_min_8.S arm/sync_fetch_and_nand_4.S arm/sync_fetch_and_nand_8.S arm/sync_fetch_and_or_4.S arm/sync_fetch_and_or_8.S arm/sync_fetch_and_sub_4.S arm/sync_fetch_and_sub_8.S arm/sync_fetch_and_umax_4.S arm/sync_fetch_and_umax_8.S arm/sync_fetch_and_umin_4.S arm/sync_fetch_and_umin_8.S arm/sync_fetch_and_xor_4.S arm/sync_fetch_and_xor_8.S arm/sync_synchronize.S arm/truncdfsf2vfp.S arm/udivmodsi4.S arm/udivsi3.S arm/umodsi3.S arm/unorddf2vfp.S arm/unordsf2vfp.S ${GENERIC_SOURCES}) set(aarch64_SOURCES comparetf2.c extenddftf2.c extendsftf2.c fixtfdi.c fixtfsi.c fixtfti.c fixunstfdi.c fixunstfsi.c fixunstfti.c floatditf.c floatsitf.c floatunditf.c floatunsitf.c multc3.c trunctfdf2.c trunctfsf2.c ${GENERIC_SOURCES}) set(armhf_SOURCES ${arm_SOURCES}) set(armv7_SOURCES ${arm_SOURCES}) set(armv7s_SOURCES ${arm_SOURCES}) set(armv7k_SOURCES ${arm_SOURCES}) set(arm64_SOURCES ${aarch64_SOURCES}) # macho_embedded archs set(armv6m_SOURCES ${GENERIC_SOURCES}) set(armv7m_SOURCES ${arm_SOURCES}) set(armv7em_SOURCES ${arm_SOURCES}) set(mips_SOURCES ${GENERIC_SOURCES}) set(mipsel_SOURCES ${mips_SOURCES}) set(mips64_SOURCES ${mips_SOURCES}) set(mips64el_SOURCES ${mips_SOURCES}) set(wasm32_SOURCES ${GENERIC_SOURCES}) set(wasm64_SOURCES ${GENERIC_SOURCES}) add_custom_target(builtins) set_target_properties(builtins PROPERTIES FOLDER "Compiler-RT Misc") if (APPLE) add_subdirectory(Darwin-excludes) add_subdirectory(macho_embedded) darwin_add_builtin_libraries(${BUILTIN_SUPPORTED_OS}) else () append_string_if(COMPILER_RT_HAS_STD_C99_FLAG -std=gnu99 maybe_stdc99) foreach (arch ${BUILTIN_SUPPORTED_ARCH}) if (CAN_TARGET_${arch}) # Filter out generic versions of routines that are re-implemented in # architecture specific manner. This prevents multiple definitions of the # same symbols, making the symbol selection non-deterministic. foreach (_file ${${arch}_SOURCES}) if (${_file} MATCHES ${arch}/*) get_filename_component(_name ${_file} NAME) string(REPLACE ".S" ".c" _cname "${_name}") list(REMOVE_ITEM ${arch}_SOURCES ${_cname}) endif () endforeach () add_compiler_rt_runtime(clang_rt.builtins STATIC ARCHS ${arch} SOURCES ${${arch}_SOURCES} CFLAGS ${maybe_stdc99} PARENT_TARGET builtins) endif () endforeach () endif () add_dependencies(compiler-rt builtins) Index: vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_symbolizer_test.cc =================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_symbolizer_test.cc (revision 304301) +++ vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_symbolizer_test.cc (revision 304302) @@ -1,70 +1,72 @@ //===-- sanitizer_symbolizer_test.cc --------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // Tests for sanitizer_symbolizer.h and sanitizer_symbolizer_internal.h // //===----------------------------------------------------------------------===// #include "sanitizer_common/sanitizer_allocator_internal.h" #include "sanitizer_common/sanitizer_symbolizer_internal.h" #include "gtest/gtest.h" namespace __sanitizer { TEST(Symbolizer, ExtractToken) { char *token; const char *rest; rest = ExtractToken("a;b;c", ";", &token); EXPECT_STREQ("a", token); EXPECT_STREQ("b;c", rest); InternalFree(token); rest = ExtractToken("aaa-bbb.ccc", ";.-*", &token); EXPECT_STREQ("aaa", token); EXPECT_STREQ("bbb.ccc", rest); InternalFree(token); } TEST(Symbolizer, ExtractInt) { int token; const char *rest = ExtractInt("123,456;789", ";,", &token); EXPECT_EQ(123, token); EXPECT_STREQ("456;789", rest); } TEST(Symbolizer, ExtractUptr) { uptr token; const char *rest = ExtractUptr("123,456;789", ";,", &token); EXPECT_EQ(123U, token); EXPECT_STREQ("456;789", rest); } TEST(Symbolizer, ExtractTokenUpToDelimiter) { char *token; const char *rest = ExtractTokenUpToDelimiter("aaa-+-bbb-+-ccc", "-+-", &token); EXPECT_STREQ("aaa", token); EXPECT_STREQ("bbb-+-ccc", rest); InternalFree(token); } #if !SANITIZER_WINDOWS TEST(Symbolizer, DemangleSwiftAndCXX) { // Swift names are not demangled in default llvm build because Swift // runtime is not linked in. EXPECT_STREQ("_TtSd", DemangleSwiftAndCXX("_TtSd")); // Check that the rest demangles properly. EXPECT_STREQ("f1(char*, int)", DemangleSwiftAndCXX("_Z2f1Pci")); +#if !SANITIZER_FREEBSD // QoI issue with libcxxrt on FreeBSD EXPECT_STREQ("foo", DemangleSwiftAndCXX("foo")); +#endif EXPECT_STREQ("", DemangleSwiftAndCXX("")); } #endif } // namespace __sanitizer Index: vendor/compiler-rt/dist/test/asan/TestCases/Darwin/dead-strip.c =================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Darwin/dead-strip.c (revision 304301) +++ vendor/compiler-rt/dist/test/asan/TestCases/Darwin/dead-strip.c (nonexistent) @@ -1,22 +0,0 @@ -// Test that AddressSanitizer does not re-animate dead globals when dead -// stripping is turned on. -// -// This test verifies that an out-of-bounds access on a global variable is -// detected after dead stripping has been performed. This proves that the -// runtime is able to register globals in the __DATA,__asan_globals section. - -// REQUIRES: osx-ld64-live_support -// RUN: %clang_asan -mllvm -asan-globals-live-support -Xlinker -dead_strip -o %t %s -// RUN: llvm-nm -format=posix %t | FileCheck --check-prefix NM-CHECK %s -// RUN: not %run %t 2>&1 | FileCheck --check-prefix ASAN-CHECK %s - -int alive[1] = {}; -int dead[1] = {}; -// NM-CHECK: {{^_alive }} -// NM-CHECK-NOT: {{^_dead }} - -int main(int argc, char *argv[]) { - alive[argc] = 0; - // ASAN-CHECK: {{0x.* is located 0 bytes to the right of global variable}} - return 0; -} Property changes on: vendor/compiler-rt/dist/test/asan/TestCases/Darwin/dead-strip.c ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/compiler-rt/dist/test/asan/TestCases/alloca_constant_size.cc =================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/alloca_constant_size.cc (revision 304301) +++ vendor/compiler-rt/dist/test/asan/TestCases/alloca_constant_size.cc (revision 304302) @@ -1,51 +1,53 @@ // Regression test for https://github.com/google/sanitizers/issues/691 // RUN: %clangxx_asan -O0 %s -o %t -fstack-protector // RUN: %run %t 1 2>&1 | FileCheck %s // RUN: %run %t 2 2>&1 | FileCheck %s #include #include // MSVC provides _alloca instead of alloca. #if defined(_MSC_VER) && !defined(alloca) # define alloca _alloca +#elif defined(__FreeBSD__) +#include #else #include #endif void f1_alloca() { char *dynamic_buffer = (char *)alloca(200); fprintf(stderr, "dynamic_buffer = %p\n", dynamic_buffer); memset(dynamic_buffer, 'y', 200); return; } static const int kDynamicArraySize = 200; void f1_vla() { char dynamic_buffer[kDynamicArraySize]; fprintf(stderr, "dynamic_buffer = %p\n", dynamic_buffer); memset(dynamic_buffer, 'y', kDynamicArraySize); return; } void f2() { char buf[1024]; memset(buf, 'x', 1024); } int main(int argc, const char *argv[]) { if (!strcmp(argv[1], "1")) { f1_alloca(); } else if (!strcmp(argv[1], "2")) { f1_vla(); } f2(); fprintf(stderr, "Done.\n"); return 0; } // CHECK-NOT: ERROR: AddressSanitizer // CHECK: Done.