Index: vendor/compiler-rt/dist/lib/asan/tests/asan_test_utils.h =================================================================== --- vendor/compiler-rt/dist/lib/asan/tests/asan_test_utils.h (revision 318417) +++ vendor/compiler-rt/dist/lib/asan/tests/asan_test_utils.h (revision 318418) @@ -1,109 +1,109 @@ //===-- asan_test_utils.h ---------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file is a part of AddressSanitizer, an address sanity checker. // //===----------------------------------------------------------------------===// #ifndef ASAN_TEST_UTILS_H #define ASAN_TEST_UTILS_H #if !defined(SANITIZER_EXTERNAL_TEST_CONFIG) # define INCLUDED_FROM_ASAN_TEST_UTILS_H # include "asan_test_config.h" # undef INCLUDED_FROM_ASAN_TEST_UTILS_H #endif #include "sanitizer_test_utils.h" #include "sanitizer_pthread_wrappers.h" #include #include #include #include #include #include #include +#include #if !defined(_WIN32) # include # include -# include #endif #ifdef __linux__ # include # include # include # include #include #endif #if !defined(__APPLE__) && !defined(__FreeBSD__) #include #endif #if ASAN_HAS_EXCEPTIONS # define ASAN_THROW(x) throw (x) #else # define ASAN_THROW(x) #endif typedef uint8_t U1; typedef uint16_t U2; typedef uint32_t U4; typedef uint64_t U8; static const int kPageSize = 4096; // Big enough to be handled by secondary allocator and small enough to fit into // quarantine for all configurations. const size_t kLargeMalloc = 1 << 22; extern void free_aaa(void *p); extern void *malloc_aaa(size_t size); template NOINLINE void asan_write(T *a) { *a = 0; } string RightOOBErrorMessage(int oob_distance, bool is_write); string RightOOBWriteMessage(int oob_distance); string RightOOBReadMessage(int oob_distance); string LeftOOBErrorMessage(int oob_distance, bool is_write); string LeftOOBWriteMessage(int oob_distance); string LeftOOBReadMessage(int oob_distance); string LeftOOBAccessMessage(int oob_distance); char* MallocAndMemsetString(size_t size, char ch); char* MallocAndMemsetString(size_t size); extern char glob1[1]; extern char glob2[2]; extern char glob3[3]; extern char glob4[4]; extern char glob5[5]; extern char glob6[6]; extern char glob7[7]; extern char glob8[8]; extern char glob9[9]; extern char glob10[10]; extern char glob11[11]; extern char glob12[12]; extern char glob13[13]; extern char glob14[14]; extern char glob15[15]; extern char glob16[16]; extern char glob17[17]; extern char glob1000[1000]; extern char glob10000[10000]; extern char glob100000[100000]; extern int GlobalsTest(int x); #endif // ASAN_TEST_UTILS_H Index: vendor/compiler-rt/dist/lib/builtins/floatdidf.c =================================================================== --- vendor/compiler-rt/dist/lib/builtins/floatdidf.c (revision 318417) +++ vendor/compiler-rt/dist/lib/builtins/floatdidf.c (revision 318418) @@ -1,112 +1,112 @@ /*===-- floatdidf.c - Implement __floatdidf -------------------------------=== * * The LLVM Compiler Infrastructure * * This file is dual licensed under the MIT and the University of Illinois Open * Source Licenses. See LICENSE.TXT for details. * *===----------------------------------------------------------------------=== * * This file implements __floatdidf for the compiler_rt library. * *===----------------------------------------------------------------------=== */ #include "int_lib.h" /* Returns: convert a to a double, rounding toward even. */ /* Assumption: double is a IEEE 64 bit floating point type * di_int is a 64 bit integral type */ /* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */ #ifndef __SOFT_FP__ /* Support for systems that have hardware floating-point; we'll set the inexact flag * as a side-effect of this computation. */ COMPILER_RT_ABI double __floatdidf(di_int a) { static const double twop52 = 4503599627370496.0; // 0x1.0p52 static const double twop32 = 4294967296.0; // 0x1.0p32 union { int64_t x; double d; } low = { .d = twop52 }; const double high = (int32_t)(a >> 32) * twop32; low.x |= a & INT64_C(0x00000000ffffffff); const double result = (high - twop52) + low.d; return result; } #else /* Support for systems that don't have hardware floating-point; there are no flags to * set, and we don't want to code-gen to an unknown soft-float implementation. */ COMPILER_RT_ABI double __floatdidf(di_int a) { if (a == 0) return 0.0; const unsigned N = sizeof(di_int) * CHAR_BIT; const di_int s = a >> (N-1); a = (a ^ s) - s; int sd = N - __builtin_clzll(a); /* number of significant digits */ int e = sd - 1; /* exponent */ if (sd > DBL_MANT_DIG) { /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR * 12345678901234567890123456 * 1 = msb 1 bit * P = bit DBL_MANT_DIG-1 bits to the right of 1 * Q = bit DBL_MANT_DIG bits to the right of 1 * R = "or" of all bits to the right of Q */ switch (sd) { case DBL_MANT_DIG + 1: a <<= 1; break; case DBL_MANT_DIG + 2: break; default: a = ((du_int)a >> (sd - (DBL_MANT_DIG+2))) | ((a & ((du_int)(-1) >> ((N + DBL_MANT_DIG+2) - sd))) != 0); }; /* finish: */ a |= (a & 4) != 0; /* Or P into R */ ++a; /* round - this step may add a significant bit */ a >>= 2; /* dump Q and R */ /* a is now rounded to DBL_MANT_DIG or DBL_MANT_DIG+1 bits */ if (a & ((du_int)1 << DBL_MANT_DIG)) { a >>= 1; ++e; } /* a is now rounded to DBL_MANT_DIG bits */ } else { a <<= (DBL_MANT_DIG - sd); /* a is now rounded to DBL_MANT_DIG bits */ } double_bits fb; fb.u.s.high = ((su_int)s & 0x80000000) | /* sign */ ((e + 1023) << 20) | /* exponent */ ((su_int)(a >> 32) & 0x000FFFFF); /* mantissa-high */ fb.u.s.low = (su_int)a; /* mantissa-low */ return fb.f; } #endif -#if defined(__AEABI__) +#if defined(__ARM_EABI__) AEABI_RTABI double __aeabi_l2d(di_int a) { return __floatdidf(a); } #endif Index: vendor/compiler-rt/dist/lib/ubsan/CMakeLists.txt =================================================================== --- vendor/compiler-rt/dist/lib/ubsan/CMakeLists.txt (revision 318417) +++ vendor/compiler-rt/dist/lib/ubsan/CMakeLists.txt (revision 318418) @@ -1,160 +1,185 @@ # Build for the undefined behavior sanitizer runtime support library. set(UBSAN_SOURCES ubsan_diag.cc ubsan_init.cc ubsan_flags.cc ubsan_handlers.cc ubsan_value.cc ) set(UBSAN_STANDALONE_SOURCES ubsan_diag_standalone.cc ubsan_init_standalone.cc ) set(UBSAN_CXXABI_SOURCES ubsan_handlers_cxx.cc ubsan_type_hash.cc ubsan_type_hash_itanium.cc ubsan_type_hash_win.cc ) include_directories(..) set(UBSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS}) append_rtti_flag(OFF UBSAN_CFLAGS) append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CFLAGS) set(UBSAN_STANDALONE_CFLAGS ${SANITIZER_COMMON_CFLAGS}) append_rtti_flag(OFF UBSAN_STANDALONE_CFLAGS) append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_STANDALONE_CFLAGS) set(UBSAN_CXXFLAGS ${SANITIZER_COMMON_CFLAGS}) append_rtti_flag(ON UBSAN_CXXFLAGS) append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CXXFLAGS) +append_list_if(COMPILER_RT_HAS_LIBDL dl UBSAN_DYNAMIC_LIBS) +append_list_if(COMPILER_RT_HAS_LIBRT rt UBSAN_DYNAMIC_LIBS) +append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread UBSAN_DYNAMIC_LIBS) + add_compiler_rt_component(ubsan) if(APPLE) set(UBSAN_COMMON_SOURCES ${UBSAN_SOURCES}) if(SANITIZER_CAN_USE_CXXABI) list(APPEND UBSAN_COMMON_SOURCES ${UBSAN_CXXABI_SOURCES}) endif() # Common parts of UBSan runtime. add_compiler_rt_object_libraries(RTUbsan OS ${SANITIZER_COMMON_SUPPORTED_OS} ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH} SOURCES ${UBSAN_COMMON_SOURCES} CFLAGS ${UBSAN_CXXFLAGS}) if(COMPILER_RT_HAS_UBSAN) # Initializer of standalone UBSan runtime. add_compiler_rt_object_libraries(RTUbsan_standalone OS ${SANITIZER_COMMON_SUPPORTED_OS} ARCHS ${UBSAN_SUPPORTED_ARCH} SOURCES ${UBSAN_STANDALONE_SOURCES} CFLAGS ${UBSAN_STANDALONE_CFLAGS}) add_weak_symbols("ubsan" WEAK_SYMBOL_LINK_FLAGS) add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS) add_compiler_rt_runtime(clang_rt.ubsan SHARED OS ${SANITIZER_COMMON_SUPPORTED_OS} ARCHS ${UBSAN_SUPPORTED_ARCH} OBJECT_LIBS RTUbsan RTUbsan_standalone RTSanitizerCommon RTSanitizerCommonLibc LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} PARENT_TARGET ubsan) endif() else() # Common parts of UBSan runtime. add_compiler_rt_object_libraries(RTUbsan ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH} SOURCES ${UBSAN_SOURCES} CFLAGS ${UBSAN_CFLAGS}) if(SANITIZER_CAN_USE_CXXABI) # C++-specific parts of UBSan runtime. Requires a C++ ABI library. set(UBSAN_CXX_SOURCES ${UBSAN_CXXABI_SOURCES}) else() # Dummy target if we don't have C++ ABI library. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cxx_dummy.cc "") set(UBSAN_CXX_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cxx_dummy.cc) endif() add_compiler_rt_object_libraries(RTUbsan_cxx ARCHS ${UBSAN_COMMON_SUPPORTED_ARCH} SOURCES ${UBSAN_CXX_SOURCES} CFLAGS ${UBSAN_CXXFLAGS}) if (WIN32) add_compiler_rt_object_libraries(UbsanWeakInterception ${SANITIZER_COMMON_SUPPORTED_OS} ARCHS ${UBSAN_SUPPORTED_ARCH} SOURCES ubsan_win_weak_interception.cc CFLAGS ${UBSAN_CFLAGS} -DSANITIZER_DYNAMIC DEFS ${UBSAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(UbsanDllThunk ${SANITIZER_COMMON_SUPPORTED_OS} ARCHS ${UBSAN_SUPPORTED_ARCH} SOURCES ubsan_win_dll_thunk.cc CFLAGS ${UBSAN_CFLAGS} -DSANITIZER_DLL_THUNK DEFS ${UBSAN_COMMON_DEFINITIONS}) set(DYNAMIC_RUNTIME_THUNK_CFLAGS "-DSANITIZER_DYNAMIC_RUNTIME_THUNK") if(MSVC) list(APPEND DYNAMIC_RUNTIME_THUNK_CFLAGS "-Zl") elseif(CMAKE_C_COMPILER_ID MATCHES Clang) list(APPEND DYNAMIC_RUNTIME_THUNK_CFLAGS "-nodefaultlibs") endif() add_compiler_rt_object_libraries(UbsanDynamicRuntimeThunk ${SANITIZER_COMMON_SUPPORTED_OS} ARCHS ${UBSAN_SUPPORTED_ARCH} SOURCES ubsan_win_dynamic_runtime_thunk.cc CFLAGS ${UBSAN_CFLAGS} ${DYNAMIC_RUNTIME_THUNK_CFLAGS} DEFS ${UBSAN_COMMON_DEFINITIONS}) endif() if(COMPILER_RT_HAS_UBSAN) # Initializer of standalone UBSan runtime. add_compiler_rt_object_libraries(RTUbsan_standalone ARCHS ${UBSAN_SUPPORTED_ARCH} SOURCES ${UBSAN_STANDALONE_SOURCES} CFLAGS ${UBSAN_STANDALONE_CFLAGS}) # Standalone UBSan runtimes. add_compiler_rt_runtime(clang_rt.ubsan_standalone STATIC ARCHS ${UBSAN_SUPPORTED_ARCH} OBJECT_LIBS RTSanitizerCommon RTSanitizerCommonLibc RTUbsan RTUbsan_standalone CFLAGS ${UBSAN_CFLAGS} PARENT_TARGET ubsan) add_compiler_rt_runtime(clang_rt.ubsan_standalone_cxx STATIC ARCHS ${UBSAN_SUPPORTED_ARCH} OBJECT_LIBS RTUbsan_cxx CFLAGS ${UBSAN_CXXFLAGS} + PARENT_TARGET ubsan) + + add_compiler_rt_runtime(clang_rt.ubsan_standalone + SHARED + ARCHS ${UBSAN_SUPPORTED_ARCH} + OBJECT_LIBS RTSanitizerCommon + RTSanitizerCommonLibc + RTUbsan + CFLAGS ${UBSAN_CFLAGS} + LINK_LIBS ${UBSAN_DYNAMIC_LIBS} + PARENT_TARGET ubsan) + + add_compiler_rt_runtime(clang_rt.ubsan_standalone_cxx + SHARED + ARCHS ${UBSAN_SUPPORTED_ARCH} + OBJECT_LIBS RTSanitizerCommon + RTSanitizerCommonLibc + RTUbsan + RTUbsan_cxx + CFLAGS ${UBSAN_CXXFLAGS} + LINK_LIBS ${UBSAN_DYNAMIC_LIBS} PARENT_TARGET ubsan) if (UNIX) set(ARCHS_FOR_SYMBOLS ${UBSAN_SUPPORTED_ARCH}) list(REMOVE_ITEM ARCHS_FOR_SYMBOLS i386 i686) add_sanitizer_rt_symbols(clang_rt.ubsan_standalone ARCHS ${ARCHS_FOR_SYMBOLS} PARENT_TARGET ubsan EXTRA ubsan.syms.extra) add_sanitizer_rt_symbols(clang_rt.ubsan_standalone_cxx ARCHS ${ARCHS_FOR_SYMBOLS} PARENT_TARGET ubsan EXTRA ubsan.syms.extra) endif() endif() endif()