Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 2016 20:02:04 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r293842 - in vendor/compiler-rt/dist: cmake cmake/Modules include/sanitizer lib/asan lib/builtins lib/cfi lib/profile lib/sanitizer_common lib/tsan/rtl test/cfi test/msan test/profile t...
Message-ID:  <201601132002.u0DK24Tw087605@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Jan 13 20:02:03 2016
New Revision: 293842
URL: https://svnweb.freebsd.org/changeset/base/293842

Log:
  Vendor import of compiler-rt trunk r257626:
  https://llvm.org/svn/llvm-project/compiler-rt/trunk@257626

Added:
  vendor/compiler-rt/dist/test/profile/Linux/
  vendor/compiler-rt/dist/test/profile/Linux/instrprof-basic.c   (contents, props changed)
  vendor/compiler-rt/dist/test/profile/Linux/instrprof-dlopen.test
  vendor/compiler-rt/dist/test/profile/Linux/instrprof-dynamic-one-shared.test
  vendor/compiler-rt/dist/test/profile/Linux/instrprof-dynamic-two-shared.test
  vendor/compiler-rt/dist/test/profile/Linux/lit.local.cfg
  vendor/compiler-rt/dist/test/profile/instrprof-version-mismatch.c   (contents, props changed)
  vendor/compiler-rt/dist/test/sanitizer_common/TestCases/Linux/closedir.c   (contents, props changed)
Modified:
  vendor/compiler-rt/dist/cmake/Modules/CompilerRTDarwinUtils.cmake
  vendor/compiler-rt/dist/cmake/config-ix.cmake
  vendor/compiler-rt/dist/include/sanitizer/common_interface_defs.h
  vendor/compiler-rt/dist/lib/asan/asan_report.cc
  vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt
  vendor/compiler-rt/dist/lib/builtins/int_types.h
  vendor/compiler-rt/dist/lib/cfi/cfi.cc
  vendor/compiler-rt/dist/lib/profile/CMakeLists.txt
  vendor/compiler-rt/dist/lib/profile/InstrProfData.inc
  vendor/compiler-rt/dist/lib/profile/InstrProfiling.c
  vendor/compiler-rt/dist/lib/profile/InstrProfilingFile.c
  vendor/compiler-rt/dist/lib/profile/InstrProfilingPort.h
  vendor/compiler-rt/dist/lib/profile/InstrProfilingValue.c
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.h
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_libcdep.cc
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_nolibc.cc
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cc
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cc
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.h
  vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_printf.cc
  vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc
  vendor/compiler-rt/dist/test/cfi/CMakeLists.txt
  vendor/compiler-rt/dist/test/msan/insertvalue_origin.cc
  vendor/compiler-rt/dist/test/profile/instrprof-shared.test
  vendor/compiler-rt/dist/test/profile/instrprof-value-prof.c
  vendor/compiler-rt/dist/test/safestack/overflow.c
  vendor/compiler-rt/dist/test/tsan/mmap_stress.cc
  vendor/compiler-rt/dist/test/ubsan/TestCases/Integer/suppressions.cpp

Modified: vendor/compiler-rt/dist/cmake/Modules/CompilerRTDarwinUtils.cmake
==============================================================================
--- vendor/compiler-rt/dist/cmake/Modules/CompilerRTDarwinUtils.cmake	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/cmake/Modules/CompilerRTDarwinUtils.cmake	Wed Jan 13 20:02:03 2016	(r293842)
@@ -282,7 +282,8 @@ macro(darwin_add_builtin_libraries)
 
   set(PROFILE_SOURCES ../profile/InstrProfiling 
                       ../profile/InstrProfilingBuffer
-                      ../profile/InstrProfilingPlatformDarwin)
+                      ../profile/InstrProfilingPlatformDarwin
+                      ../profile/InstrProfilingWriter)
   foreach (os ${ARGN})
     list_union(DARWIN_BUILTIN_ARCHS DARWIN_${os}_ARCHS BUILTIN_SUPPORTED_ARCH)
     foreach (arch ${DARWIN_BUILTIN_ARCHS})

Modified: vendor/compiler-rt/dist/cmake/config-ix.cmake
==============================================================================
--- vendor/compiler-rt/dist/cmake/config-ix.cmake	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/cmake/config-ix.cmake	Wed Jan 13 20:02:03 2016	(r293842)
@@ -150,6 +150,8 @@ macro(detect_target_arch)
   check_symbol_exists(__i386__ "" __I386)
   check_symbol_exists(__mips__ "" __MIPS)
   check_symbol_exists(__mips64__ "" __MIPS64)
+  check_symbol_exists(__wasm32__ "" __WEBASSEMBLY32)
+  check_symbol_exists(__wasm64__ "" __WEBASSEMBLY64)
   if(__ARM)
     add_default_target_arch(arm)
   elseif(__AARCH64)
@@ -164,6 +166,10 @@ macro(detect_target_arch)
     add_default_target_arch(mips64)
   elseif(__MIPS)
     add_default_target_arch(mips)
+  elseif(__WEBASSEMBLY32)
+    add_default_target_arch(wasm32)
+  elseif(__WEBASSEMBLY64)
+    add_default_target_arch(wasm64)
   endif()
 endmacro()
 
@@ -220,6 +226,10 @@ elseif(NOT APPLE) # Supported archs for 
     test_target_arch(aarch32 "" "-march=armv8-a")
   elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch64")
     test_target_arch(aarch64 "" "-march=armv8-a")
+  elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "wasm32")
+    test_target_arch(wasm32 "" "--target=wasm32-unknown-unknown")
+  elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "wasm64")
+    test_target_arch(wasm64 "" "--target=wasm64-unknown-unknown")
   endif()
   set(COMPILER_RT_OS_SUFFIX "")
 endif()
@@ -260,6 +270,8 @@ 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)
@@ -268,7 +280,7 @@ if(APPLE)
 endif()
 
 set(ALL_BUILTIN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
-    ${MIPS32} ${MIPS64})
+    ${MIPS32} ${MIPS64} ${WASM32} ${WASM64})
 set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64}
     ${ARM32} ${ARM64} ${MIPS32} ${MIPS64})
 set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
@@ -299,10 +311,44 @@ if(APPLE)
   endif()
 
   option(COMPILER_RT_ENABLE_IOS "Enable building for iOS - Experimental" Off)
+  option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off)
+  option(COMPILER_RT_ENABLE_TVOS "Enable building for tvOS - Experimental" Off)
 
   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)
+
+  if(COMPILER_RT_ENABLE_IOS)
+    list(APPEND DARWIN_EMBEDDED_PLATFORMS ios)
+    set(DARWIN_ios_MIN_VER_FLAG -miphoneos-version-min)
+    set(DARWIN_ios_SANITIZER_MIN_VER_FLAG
+      ${DARWIN_ios_MIN_VER_FLAG}=7.0)
+    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_SANITIZER_MIN_VER_FLAG
+      ${DARWIN_watchos_MIN_VER_FLAG}=2.0)
+    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_SANITIZER_MIN_VER_FLAG
+      ${DARWIN_tvos_MIN_VER_FLAG}=9.0)
+    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()
 
   # Note: In order to target x86_64h on OS X the minimum deployment target must
   # be 10.8 or higher.
@@ -334,6 +380,11 @@ if(APPLE)
     -lc++
     -lc++abi)
   
+  check_linker_flag("-fapplication-extension" COMPILER_RT_HAS_APP_EXTENSION)
+  if(COMPILER_RT_HAS_APP_EXTENSION)
+    list(APPEND DARWIN_COMMON_LINKFLAGS "-fapplication-extension")
+  endif()
+
   set(DARWIN_osx_CFLAGS
     ${DARWIN_COMMON_CFLAGS}
     -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION})
@@ -379,62 +430,62 @@ if(APPLE)
       list(APPEND BUILTIN_SUPPORTED_OS 10.4)
     endif()
 
-    if(DARWIN_iossim_SYSROOT)
-      set(DARWIN_iossim_CFLAGS
-        ${DARWIN_COMMON_CFLAGS}
-        -mios-simulator-version-min=7.0
-        -isysroot ${DARWIN_iossim_SYSROOT})
-      set(DARWIN_iossim_LINKFLAGS
-        ${DARWIN_COMMON_LINKFLAGS}
-        -mios-simulator-version-min=7.0
-        -isysroot ${DARWIN_iossim_SYSROOT})
-      set(DARWIN_iossim_BUILTIN_MIN_VER 6.0)
-      set(DARWIN_iossim_BUILTIN_MIN_VER_FLAG
-        -mios-simulator-version-min=${DARWIN_iossim_BUILTIN_MIN_VER})
-
-      set(DARWIN_iossim_SKIP_CC_KEXT On)
-      darwin_test_archs(iossim
-        DARWIN_iossim_ARCHS
-        ${toolchain_arches})
-      message(STATUS "iOS Simulator supported arches: ${DARWIN_iossim_ARCHS}")
-      if(DARWIN_iossim_ARCHS)
-        list(APPEND SANITIZER_COMMON_SUPPORTED_OS iossim)
-        list(APPEND BUILTIN_SUPPORTED_OS iossim)
-        list(APPEND PROFILE_SUPPORTED_OS iossim)
+    foreach(platform ${DARWIN_EMBEDDED_PLATFORMS})
+      if(DARWIN_${platform}sim_SYSROOT)
+        set(DARWIN_${platform}sim_CFLAGS
+          ${DARWIN_COMMON_CFLAGS}
+          ${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
+          -isysroot ${DARWIN_iossim_SYSROOT})
+        set(DARWIN_${platform}sim_LINKFLAGS
+          ${DARWIN_COMMON_LINKFLAGS}
+          ${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
+          -isysroot ${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)
+        darwin_test_archs(${platform}sim
+          DARWIN_${platform}sim_ARCHS
+          ${toolchain_arches})
+        message(STATUS "${platform} Simulator supported arches: ${DARWIN_${platform}sim_ARCHS}")
+        if(DARWIN_iossim_ARCHS)
+          list(APPEND SANITIZER_COMMON_SUPPORTED_OS ${platform}sim)
+          list(APPEND BUILTIN_SUPPORTED_OS ${platform}sim)
+          list(APPEND PROFILE_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()
-      foreach(arch ${DARWIN_iossim_ARCHS})
-        list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
-        set(CAN_TARGET_${arch} 1)
-      endforeach()
-    endif()
 
-    if(DARWIN_ios_SYSROOT AND COMPILER_RT_ENABLE_IOS)
-      set(DARWIN_ios_CFLAGS
-        ${DARWIN_COMMON_CFLAGS}
-        -miphoneos-version-min=7.0
-        -isysroot ${DARWIN_ios_SYSROOT})
-      set(DARWIN_ios_LINKFLAGS
-        ${DARWIN_COMMON_LINKFLAGS}
-        -miphoneos-version-min=7.0
-        -isysroot ${DARWIN_ios_SYSROOT})
-      set(DARWIN_ios_BUILTIN_MIN_VER 6.0)
-      set(DARWIN_ios_BUILTIN_MIN_VER_FLAG
-        -miphoneos-version-min=${DARWIN_ios_BUILTIN_MIN_VER})
-
-      darwin_test_archs(ios
-        DARWIN_ios_ARCHS
-        ${toolchain_arches})
-      message(STATUS "iOS supported arches: ${DARWIN_ios_ARCHS}")
-      if(DARWIN_ios_ARCHS)
-        list(APPEND SANITIZER_COMMON_SUPPORTED_OS ios)
-        list(APPEND BUILTIN_SUPPORTED_OS ios)
-        list(APPEND PROFILE_SUPPORTED_OS ios)
+      if(DARWIN_${platform}_SYSROOT)
+        set(DARWIN_${platform}_CFLAGS
+          ${DARWIN_COMMON_CFLAGS}
+          ${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
+          -isysroot ${DARWIN_${platform}_SYSROOT})
+        set(DARWIN_${platform}_LINKFLAGS
+          ${DARWIN_COMMON_LINKFLAGS}
+          ${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
+          -isysroot ${DARWIN_${platform}_SYSROOT})
+
+        darwin_test_archs(${platform}
+          DARWIN_${platform}_ARCHS
+          ${toolchain_arches})
+        message(STATUS "${platform} supported arches: ${DARWIN_${platform}_ARCHS}")
+        if(DARWIN_${platform}_ARCHS)
+          list(APPEND SANITIZER_COMMON_SUPPORTED_OS ${platform})
+          list(APPEND BUILTIN_SUPPORTED_OS ${platform})
+          list(APPEND PROFILE_SUPPORTED_OS ${platform})
+        endif()
+        foreach(arch ${DARWIN_${platform}_ARCHS})
+          list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
+          set(CAN_TARGET_${arch} 1)
+        endforeach()
       endif()
-      foreach(arch ${DARWIN_ios_ARCHS})
-        list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
-        set(CAN_TARGET_${arch} 1)
-      endforeach()
-    endif()
+    endforeach()
   endif()
 
   # for list_union

Modified: vendor/compiler-rt/dist/include/sanitizer/common_interface_defs.h
==============================================================================
--- vendor/compiler-rt/dist/include/sanitizer/common_interface_defs.h	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/include/sanitizer/common_interface_defs.h	Wed Jan 13 20:02:03 2016	(r293842)
@@ -125,9 +125,11 @@ extern "C" {
   // to know what is being passed to libc functions, e.g. memcmp.
   // FIXME: implement more hooks.
   void __sanitizer_weak_hook_memcmp(void *called_pc, const void *s1,
-                                    const void *s2, size_t n);
+                                    const void *s2, size_t n, int result);
   void __sanitizer_weak_hook_strncmp(void *called_pc, const char *s1,
-                                    const char *s2, size_t n);
+                                    const char *s2, size_t n, int result);
+  void __sanitizer_weak_hook_strcmp(void *called_pc, const char *s1,
+                                    const char *s2, int result);
 #ifdef __cplusplus
 }  // extern "C"
 #endif

Modified: vendor/compiler-rt/dist/lib/asan/asan_report.cc
==============================================================================
--- vendor/compiler-rt/dist/lib/asan/asan_report.cc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/asan/asan_report.cc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -696,9 +696,6 @@ class ScopedInErrorReport {
                       error_message_buffer, kErrorMessageBufferSize);
     }
 
-    // Remove color sequences since logs cannot print them.
-    RemoveANSIEscapeSequencesFromString(buffer_copy.data());
-
     LogFullErrorReport(buffer_copy.data());
 
     if (error_report_callback) {

Modified: vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt
==============================================================================
--- vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt	Wed Jan 13 20:02:03 2016	(r293842)
@@ -353,6 +353,9 @@ 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)
 
 if (APPLE)

Modified: vendor/compiler-rt/dist/lib/builtins/int_types.h
==============================================================================
--- vendor/compiler-rt/dist/lib/builtins/int_types.h	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/builtins/int_types.h	Wed Jan 13 20:02:03 2016	(r293842)
@@ -61,7 +61,8 @@ typedef union
 } udwords;
 
 /* MIPS64 issue: PR 20098 */
-#if defined(__LP64__) && !(defined(__mips__) && defined(__clang__))
+#if (defined(__LP64__) || defined(__wasm__)) && \
+    !(defined(__mips__) && defined(__clang__))
 #define CRT_HAS_128BIT
 #endif
 

Modified: vendor/compiler-rt/dist/lib/cfi/cfi.cc
==============================================================================
--- vendor/compiler-rt/dist/lib/cfi/cfi.cc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/cfi/cfi.cc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -42,7 +42,7 @@ static uint16_t *mem_to_shadow(uptr x) {
   return (uint16_t *)(__cfi_shadow + ((x >> kShadowGranularity) << 1));
 }
 
-typedef int (*CFICheckFn)(uptr, void *);
+typedef int (*CFICheckFn)(u64, void *);
 
 class ShadowValue {
   uptr addr;
@@ -189,9 +189,9 @@ static void init_shadow() {
 }
 
 extern "C" SANITIZER_INTERFACE_ATTRIBUTE
-void __cfi_slowpath(uptr CallSiteTypeId, void *Ptr) {
+void __cfi_slowpath(u64 CallSiteTypeId, void *Ptr) {
   uptr Addr = (uptr)Ptr;
-  VReport(3, "__cfi_slowpath: %zx, %p\n", CallSiteTypeId, Ptr);
+  VReport(3, "__cfi_slowpath: %llx, %p\n", CallSiteTypeId, Ptr);
   ShadowValue sv = ShadowValue::load(Addr);
   if (sv.is_invalid()) {
     VReport(2, "CFI: invalid memory region for a function pointer (shadow==0): %p\n", Ptr);

Modified: vendor/compiler-rt/dist/lib/profile/CMakeLists.txt
==============================================================================
--- vendor/compiler-rt/dist/lib/profile/CMakeLists.txt	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/profile/CMakeLists.txt	Wed Jan 13 20:02:03 2016	(r293842)
@@ -35,16 +35,16 @@ set(PROFILE_SOURCES
   InstrProfilingPlatformLinux.c
   InstrProfilingPlatformOther.c
   InstrProfilingRuntime.cc
-  InstrProfilingUtil.c
-  WindowsMMap.c)
+  InstrProfilingUtil.c)
+
+if(WIN32)
+    list(APPEND PROFILE_SOURCES WindowsMMap.c)
+endif()
 
 if(UNIX)
  set(EXTRA_FLAGS
      -fPIC
      -Wno-pedantic)
-else()
- set(EXTRA_FLAGS
-     -fPIC)
 endif()
 
 if(COMPILER_RT_TARGET_HAS_ATOMICS)

Modified: vendor/compiler-rt/dist/lib/profile/InstrProfData.inc
==============================================================================
--- vendor/compiler-rt/dist/lib/profile/InstrProfData.inc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/profile/InstrProfData.inc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -28,7 +28,7 @@
  *
  * Examples of how the template is used to instantiate structure definition:
  * 1. To declare a structure:
- * 
+ *
  * struct ProfData {
  * #define INSTR_PROF_DATA(Type, LLVMType, Name, Initializer) \
  *    Type Name;
@@ -155,7 +155,7 @@ VALUE_PROF_KIND(IPVK_Last, IPVK_Indirect
 #endif
 COVMAP_FUNC_RECORD(const IntPtrT, llvm::Type::getInt8PtrTy(Ctx), \
                    NamePtr, llvm::ConstantExpr::getBitCast(NamePtr, \
-                   llvm::Type::getInt8PtrTy(Ctx))) 
+                   llvm::Type::getInt8PtrTy(Ctx)))
 COVMAP_FUNC_RECORD(const uint32_t, llvm::Type::getInt32Ty(Ctx), NameSize, \
                    llvm::ConstantInt::get(llvm::Type::getInt32Ty(Ctx),\
                    NameValue.size()))
@@ -182,7 +182,7 @@ COVMAP_HEADER(uint32_t, Int32Ty, Filenam
 COVMAP_HEADER(uint32_t, Int32Ty, CoverageSize, \
               llvm::ConstantInt::get(Int32Ty, CoverageMappingSize))
 COVMAP_HEADER(uint32_t, Int32Ty, Version, \
-              llvm::ConstantInt::get(Int32Ty, CoverageMappingVersion1))
+              llvm::ConstantInt::get(Int32Ty, CoverageMappingCurrentVersion))
 #undef COVMAP_HEADER
 /* COVMAP_HEADER end.  */
 
@@ -190,7 +190,8 @@ COVMAP_HEADER(uint32_t, Int32Ty, Version
 #ifdef INSTR_PROF_VALUE_PROF_DATA
 #define INSTR_PROF_DATA_DEFINED
 
-/*! 
+#define INSTR_PROF_MAX_NUM_VAL_PER_SITE 255
+/*!
  * This is the header of the data structure that defines the on-disk
  * layout of the value profile data of a particular kind for one function.
  */
@@ -202,7 +203,7 @@ typedef struct ValueProfRecord {
    * otherwise the record for this kind won't be emitted.
    */
   uint32_t NumValueSites;
-  /* 
+  /*
    * The first element of the array that stores the number of profiled
    * values for each value site. The size of the array is NumValueSites.
    * Since NumValueSites is greater than zero, there is at least one
@@ -226,7 +227,7 @@ typedef struct ValueProfRecord {
    * \brief Return the number of value sites.
    */
   uint32_t getNumValueSites() const { return NumValueSites; }
-  /*! 
+  /*!
    * \brief Read data from this record and save it to Record.
    */
   void deserializeTo(InstrProfRecord &Record,
@@ -247,10 +248,10 @@ typedef struct ValueProfRecord {
 typedef struct ValueProfData {
   /*
    * Total size in bytes including this field. It must be a multiple
-   * of sizeof(uint64_t). 
+   * of sizeof(uint64_t).
    */
   uint32_t TotalSize;
-  /* 
+  /*
    *The number of value profile kinds that has value profile data.
    * In this implementation, a value profile kind is considered to
    * have profile data if the number of value profile sites for the
@@ -260,7 +261,7 @@ typedef struct ValueProfData {
    */
   uint32_t NumValueKinds;
 
-  /* 
+  /*
    * Following are a sequence of variable length records. The prefix/header
    * of each record is defined by ValueProfRecord type. The number of
    * records is NumValueKinds.
@@ -314,7 +315,7 @@ typedef struct ValueProfData {
 #endif
 } ValueProfData;
 
-/* 
+/*
  * The closure is designed to abstact away two types of value profile data:
  * - InstrProfRecord which is the primary data structure used to
  *   represent profile data in host tools (reader, writer, and profile-use)
@@ -335,7 +336,7 @@ typedef struct ValueProfRecordClosure {
   uint32_t (*GetNumValueData)(const void *Record, uint32_t VKind);
   uint32_t (*GetNumValueDataForSite)(const void *R, uint32_t VK, uint32_t S);
 
-  /* 
+  /*
    * After extracting the value profile data from the value profile record,
    * this method is used to map the in-memory value to on-disk value. If
    * the method is null, value will be written out untranslated.
@@ -346,7 +347,7 @@ typedef struct ValueProfRecordClosure {
   ValueProfData *(*AllocValueProfData)(size_t TotalSizeInBytes);
 } ValueProfRecordClosure;
 
-/* 
+/*
  * A wrapper struct that represents value profile runtime data.
  * Like InstrProfRecord class which is used by profiling host tools,
  * ValueProfRuntimeRecord also implements the abstract intefaces defined in
@@ -384,7 +385,7 @@ serializeValueProfDataFromRT(const Value
 uint32_t getNumValueKindsRT(const void *R);
 
 #undef INSTR_PROF_VALUE_PROF_DATA
-#endif  /* INSTR_PROF_VALUE_PROF_DATA */ 
+#endif  /* INSTR_PROF_VALUE_PROF_DATA */
 
 
 #ifdef INSTR_PROF_COMMON_API_IMPL
@@ -412,7 +413,7 @@ uint32_t getValueProfRecordHeaderSize(ui
   return Size;
 }
 
-/*! 
+/*!
  * \brief Return the total size of the value profile record including the
  * header and the value data.
  */
@@ -432,7 +433,7 @@ InstrProfValueData *getValueProfRecordVa
                                                    This->NumValueSites));
 }
 
-/*! 
+/*!
  * \brief Return the total number of value data for \c This record.
  */
 INSTR_PROF_INLINE
@@ -444,7 +445,7 @@ uint32_t getValueProfRecordNumValueData(
   return NumValueData;
 }
 
-/*! 
+/*!
  * \brief Use this method to advance to the next \c This \c ValueProfRecord.
  */
 INSTR_PROF_INLINE
@@ -465,7 +466,7 @@ ValueProfRecord *getFirstValueProfRecord
 
 /* Closure based interfaces.  */
 
-/*! 
+/*!
  * Return the total size in bytes of the on-disk value profile data
  * given the data stored in Record.
  */
@@ -535,7 +536,7 @@ ValueProfData *serializeValueProfDataFro
   return VPD;
 }
 
-/* 
+/*
  * The value profiler runtime library stores the value profile data
  * for a given function in \c NumValueSites and \c Nodes structures.
  * \c ValueProfRuntimeRecord class is used to encapsulate the runtime
@@ -639,7 +640,7 @@ static ValueProfRecordClosure RTRecordCl
                                                  getValueForSiteRT,
                                                  allocValueProfDataRT};
 
-/* 
+/*
  * Return the size of ValueProfData structure to store data
  * recorded in the runtime record.
  */
@@ -648,7 +649,7 @@ uint32_t getValueProfDataSizeRT(const Va
   return getValueProfDataSize(&RTRecordClosure);
 }
 
-/* 
+/*
  * Return a ValueProfData instance that stores the data collected
  * from runtime. If \c DstData is provided by the caller, the value
  * profile data will be store in *DstData and DstData is returned,
@@ -696,18 +697,31 @@ serializeValueProfDataFromRT(const Value
 
 /* Raw profile format version. */
 #define INSTR_PROF_RAW_VERSION 2
+#define INSTR_PROF_INDEX_VERSION 3
+#define INSTR_PROF_COVMAP_VERSION 0
+
+/* Profile version is always of type uint_64_t. Reserve the upper 8 bits in the
+ * version for other variants of profile. We set the lowest bit of the upper 8
+ * bits (i.e. bit 56) to 1 to indicate if this is an IR-level instrumentaiton
+ * generated profile, and 0 if this is a Clang FE generated profile.
+*/
+#define VARIANT_MASKS_ALL 0xff00000000000000ULL
+#define GET_VERSION(V) ((V) & ~VARIANT_MASKS_ALL)
 
 /* Runtime section names and name strings.  */
 #define INSTR_PROF_DATA_SECT_NAME __llvm_prf_data
 #define INSTR_PROF_NAME_SECT_NAME __llvm_prf_names
 #define INSTR_PROF_CNTS_SECT_NAME __llvm_prf_cnts
+#define INSTR_PROF_COVMAP_SECT_NAME __llvm_covmap
 
-#define INSTR_PROF_DATA_SECT_NAME_STR \
-        INSTR_PROF_QUOTE(INSTR_PROF_DATA_SECT_NAME)
-#define INSTR_PROF_NAME_SECT_NAME_STR \
-        INSTR_PROF_QUOTE(INSTR_PROF_NAME_SECT_NAME)
-#define INSTR_PROF_CNTS_SECT_NAME_STR \
-        INSTR_PROF_QUOTE(INSTR_PROF_CNTS_SECT_NAME)
+#define INSTR_PROF_DATA_SECT_NAME_STR                                          \
+  INSTR_PROF_QUOTE(INSTR_PROF_DATA_SECT_NAME)
+#define INSTR_PROF_NAME_SECT_NAME_STR                                          \
+  INSTR_PROF_QUOTE(INSTR_PROF_NAME_SECT_NAME)
+#define INSTR_PROF_CNTS_SECT_NAME_STR                                          \
+  INSTR_PROF_QUOTE(INSTR_PROF_CNTS_SECT_NAME)
+#define INSTR_PROF_COVMAP_SECT_NAME_STR                                        \
+  INSTR_PROF_QUOTE(INSTR_PROF_COVMAP_SECT_NAME)
 
 /* Macros to define start/stop section symbol for a given
  * section on Linux. For instance
@@ -751,4 +765,3 @@ typedef struct ValueProfNode {
 #else
 #undef INSTR_PROF_DATA_DEFINED
 #endif
-

Modified: vendor/compiler-rt/dist/lib/profile/InstrProfiling.c
==============================================================================
--- vendor/compiler-rt/dist/lib/profile/InstrProfiling.c	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/profile/InstrProfiling.c	Wed Jan 13 20:02:03 2016	(r293842)
@@ -18,6 +18,8 @@
 
 char *(*GetEnvHook)(const char *) = 0;
 
+COMPILER_RT_WEAK uint64_t __llvm_profile_raw_version = INSTR_PROF_RAW_VERSION;
+
 COMPILER_RT_VISIBILITY uint64_t __llvm_profile_get_magic(void) {
   return sizeof(void *) == sizeof(uint64_t) ? (INSTR_PROF_RAW_MAGIC_64)
                                             : (INSTR_PROF_RAW_MAGIC_32);
@@ -32,7 +34,7 @@ __llvm_profile_get_num_padding_bytes(uin
 }
 
 COMPILER_RT_VISIBILITY uint64_t __llvm_profile_get_version(void) {
-  return INSTR_PROF_RAW_VERSION;
+  return __llvm_profile_raw_version;
 }
 
 COMPILER_RT_VISIBILITY void __llvm_profile_reset_counters(void) {
@@ -65,4 +67,3 @@ COMPILER_RT_VISIBILITY void __llvm_profi
     }
   }
 }
-

Modified: vendor/compiler-rt/dist/lib/profile/InstrProfilingFile.c
==============================================================================
--- vendor/compiler-rt/dist/lib/profile/InstrProfilingFile.c	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/profile/InstrProfilingFile.c	Wed Jan 13 20:02:03 2016	(r293842)
@@ -214,6 +214,15 @@ int __llvm_profile_write_file(void) {
     return -1;
   }
 
+  /* Check if there is llvm/runtime version mismatch.  */
+  if (GET_VERSION(__llvm_profile_get_version()) != INSTR_PROF_RAW_VERSION) {
+    PROF_ERR("LLVM Profile: runtime and instrumentation version mismatch : "
+             "expected %d, but get %d\n",
+             INSTR_PROF_RAW_VERSION,
+             (int)GET_VERSION(__llvm_profile_get_version()));
+    return -1;
+  }
+
   /* Write the file. */
   rc = writeFileWithName(__llvm_profile_CurrentFilename);
   if (rc)

Modified: vendor/compiler-rt/dist/lib/profile/InstrProfilingPort.h
==============================================================================
--- vendor/compiler-rt/dist/lib/profile/InstrProfilingPort.h	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/profile/InstrProfilingPort.h	Wed Jan 13 20:02:03 2016	(r293842)
@@ -29,16 +29,16 @@
 #define COMPILER_RT_BOOL_CMPXCHG(Ptr, OldV, NewV)                              \
   (InterlockedCompareExchange64((LONGLONG volatile *)Ptr, (LONGLONG)NewV,      \
                                 (LONGLONG)OldV) == (LONGLONG)OldV)
-#else
+#else /* !defined(_WIN64) */
 #define COMPILER_RT_BOOL_CMPXCHG(Ptr, OldV, NewV)                              \
   (InterlockedCompareExchange((LONG volatile *)Ptr, (LONG)NewV, (LONG)OldV) == \
    (LONG)OldV)
 #endif
-#else
+#else /* !defined(_MSC_VER) */
 #define COMPILER_RT_BOOL_CMPXCHG(Ptr, OldV, NewV)                              \
   __sync_bool_compare_and_swap(Ptr, OldV, NewV)
 #endif
-#else
+#else /* COMPILER_RT_HAS_ATOMICS != 1 */
 #define COMPILER_RT_BOOL_CMPXCHG(Ptr, OldV, NewV)                              \
   BoolCmpXchg((void **)Ptr, OldV, NewV)
 #endif

Modified: vendor/compiler-rt/dist/lib/profile/InstrProfilingValue.c
==============================================================================
--- vendor/compiler-rt/dist/lib/profile/InstrProfilingValue.c	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/profile/InstrProfilingValue.c	Wed Jan 13 20:02:03 2016	(r293842)
@@ -107,7 +107,7 @@ __llvm_profile_instrument_target(uint64_
     ++VDataCount;
   }
 
-  if (VDataCount >= UCHAR_MAX)
+  if (VDataCount >= INSTR_PROF_MAX_NUM_VAL_PER_SITE)
     return;
 
   CurrentVNode = (ValueProfNode *)calloc(1, sizeof(ValueProfNode));

Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.h
==============================================================================
--- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.h	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.h	Wed Jan 13 20:02:03 2016	(r293842)
@@ -665,17 +665,17 @@ INLINE void LogFullErrorReport(const cha
 
 #if SANITIZER_LINUX || SANITIZER_MAC
 void WriteOneLineToSyslog(const char *s);
+void LogMessageOnPrintf(const char *str);
 #else
 INLINE void WriteOneLineToSyslog(const char *s) {}
+INLINE void LogMessageOnPrintf(const char *str) {}
 #endif
 
 #if SANITIZER_LINUX
 // Initialize Android logging. Any writes before this are silently lost.
 void AndroidLogInit();
-bool ShouldLogAfterPrintf();
 #else
 INLINE void AndroidLogInit() {}
-INLINE bool ShouldLogAfterPrintf() { return false; }
 #endif
 
 #if SANITIZER_ANDROID

Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc
==============================================================================
--- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -214,13 +214,11 @@ static inline int CharCmpX(unsigned char
 }
 
 DECLARE_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strcmp, uptr called_pc,
-                              const char *s1, const char *s2)
+                              const char *s1, const char *s2, int result)
 
 INTERCEPTOR(int, strcmp, const char *s1, const char *s2) {
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, strcmp, s1, s2);
-  CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strcmp, GET_CALLER_PC(), s1,
-                             s2);
   unsigned char c1, c2;
   uptr i;
   for (i = 0;; i++) {
@@ -230,19 +228,21 @@ INTERCEPTOR(int, strcmp, const char *s1,
   }
   COMMON_INTERCEPTOR_READ_STRING(ctx, s1, i + 1);
   COMMON_INTERCEPTOR_READ_STRING(ctx, s2, i + 1);
-  return CharCmpX(c1, c2);
+  int result = CharCmpX(c1, c2);
+  CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strcmp, GET_CALLER_PC(), s1,
+                             s2, result);
+  return result;
 }
 
 DECLARE_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strncmp, uptr called_pc,
-                              const char *s1, const char *s2, uptr n)
+                              const char *s1, const char *s2, uptr n,
+                              int result)
 
 INTERCEPTOR(int, strncmp, const char *s1, const char *s2, uptr size) {
   if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED)
     return internal_strncmp(s1, s2, size);
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, strncmp, s1, s2, size);
-  CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strncmp, GET_CALLER_PC(), s1,
-                             s2, size);
   unsigned char c1 = 0, c2 = 0;
   uptr i;
   for (i = 0; i < size; i++) {
@@ -252,7 +252,10 @@ INTERCEPTOR(int, strncmp, const char *s1
   }
   COMMON_INTERCEPTOR_READ_RANGE(ctx, s1, Min(i + 1, size));
   COMMON_INTERCEPTOR_READ_RANGE(ctx, s2, Min(i + 1, size));
-  return CharCmpX(c1, c2);
+  int result = CharCmpX(c1, c2);
+  CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_strncmp, GET_CALLER_PC(), s1,
+                             s2, size, result);
+  return result;
 }
 
 #define INIT_STRCMP COMMON_INTERCEPT_FUNCTION(strcmp)
@@ -400,15 +403,14 @@ INTERCEPTOR(char *, strpbrk, const char 
 #if SANITIZER_INTERCEPT_MEMCMP
 
 DECLARE_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_memcmp, uptr called_pc,
-                              const void *s1, const void *s2, uptr n)
+                              const void *s1, const void *s2, uptr n,
+                              int result)
 
 INTERCEPTOR(int, memcmp, const void *a1, const void *a2, uptr size) {
   if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED)
     return internal_memcmp(a1, a2, size);
   void *ctx;
   COMMON_INTERCEPTOR_ENTER(ctx, memcmp, a1, a2, size);
-  CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_memcmp, GET_CALLER_PC(), a1,
-                             a2, size);
   if (common_flags()->intercept_memcmp) {
     if (common_flags()->strict_memcmp) {
       // Check the entire regions even if the first bytes of the buffers are
@@ -428,10 +430,16 @@ INTERCEPTOR(int, memcmp, const void *a1,
       }
       COMMON_INTERCEPTOR_READ_RANGE(ctx, s1, Min(i + 1, size));
       COMMON_INTERCEPTOR_READ_RANGE(ctx, s2, Min(i + 1, size));
-      return CharCmpX(c1, c2);
+      int r = CharCmpX(c1, c2);
+      CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_memcmp, GET_CALLER_PC(),
+                                 a1, a2, size, r);
+      return r;
     }
   }
-  return REAL(memcmp(a1, a2, size));
+  int result = REAL(memcmp(a1, a2, size));
+  CALL_WEAK_INTERCEPTOR_HOOK(__sanitizer_weak_hook_memcmp, GET_CALLER_PC(), a1,
+                             a2, size, result);
+  return result;
 }
 
 #define INIT_MEMCMP COMMON_INTERCEPT_FUNCTION(memcmp)

Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_libcdep.cc
==============================================================================
--- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_libcdep.cc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_libcdep.cc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -125,9 +125,6 @@ void WriteToSyslog(const char *msg) {
   char *p = msg_copy.data();
   char *q;
 
-  // Remove color sequences since syslogs cannot print them.
-  RemoveANSIEscapeSequencesFromString(p);
-
   // Print one line at a time.
   // syslog, at least on Android, has an implicit message length limit.
   do {

Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_nolibc.cc
==============================================================================
--- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_nolibc.cc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_nolibc.cc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -19,6 +19,7 @@ namespace __sanitizer {
 
 #if SANITIZER_LINUX
 bool ShouldLogAfterPrintf() { return false; }
+void LogMessageOnPrintf(const char *str) {}
 #endif
 void WriteToSyslog(const char *buffer) {}
 void Abort() { internal__exit(1); }

Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cc
==============================================================================
--- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -524,13 +524,13 @@ void AndroidLogInit() {
   atomic_store(&android_log_initialized, 1, memory_order_release);
 }
 
-bool ShouldLogAfterPrintf() {
+static bool ShouldLogAfterPrintf() {
   return atomic_load(&android_log_initialized, memory_order_acquire);
 }
 #else
 void AndroidLogInit() {}
 
-bool ShouldLogAfterPrintf() { return true; }
+static bool ShouldLogAfterPrintf() { return true; }
 #endif  // SANITIZER_ANDROID
 
 void WriteOneLineToSyslog(const char *s) {
@@ -541,6 +541,11 @@ void WriteOneLineToSyslog(const char *s)
 #endif
 }
 
+void LogMessageOnPrintf(const char *str) {
+  if (common_flags()->log_to_syslog && ShouldLogAfterPrintf())
+    WriteToSyslog(str);
+}
+
 #endif // SANITIZER_LINUX
 
 } // namespace __sanitizer

Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cc
==============================================================================
--- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -430,6 +430,12 @@ void WriteOneLineToSyslog(const char *s)
   asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", s);
 }
 
+void LogMessageOnPrintf(const char *str) {
+  // Log all printf output to CrashLog.
+  if (common_flags()->abort_on_error)
+    CRAppendCrashLogMessage(str);
+}
+
 void LogFullErrorReport(const char *buffer) {
   // Log with os_trace. This will make it into the crash log.
 #if SANITIZER_OS_TRACE
@@ -463,9 +469,7 @@ void LogFullErrorReport(const char *buff
   if (common_flags()->log_to_syslog)
     WriteToSyslog(buffer);
 
-  // Log to CrashLog.
-  if (common_flags()->abort_on_error)
-    CRSetCrashLogMessage(buffer);
+  // The report is added to CrashLog as part of logging all of Printf output.
 }
 
 void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {

Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.h
==============================================================================
--- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.h	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.h	Wed Jan 13 20:02:03 2016	(r293842)
@@ -44,9 +44,11 @@ static const char *__crashreporter_info_
   &__crashreporter_info_buff__[0];
 asm(".desc ___crashreporter_info__, 0x10");
 } // extern "C"
+static BlockingMutex crashreporter_info_mutex(LINKER_INITIALIZED);
 
-INLINE void CRSetCrashLogMessage(const char *msg) {
-  internal_strlcpy(__crashreporter_info_buff__, msg,
+INLINE void CRAppendCrashLogMessage(const char *msg) {
+  BlockingMutexLock l(&crashreporter_info_mutex);
+  internal_strlcat(__crashreporter_info_buff__, msg,
                    sizeof(__crashreporter_info_buff__)); }
 
 #endif  // SANITIZER_MAC

Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_printf.cc
==============================================================================
--- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_printf.cc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_printf.cc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -278,9 +278,12 @@ static void SharedPrintfCode(bool append
 #   undef CHECK_NEEDED_LENGTH
   }
   RawWrite(buffer);
-  if (common_flags()->log_to_syslog && ShouldLogAfterPrintf())
-    WriteToSyslog(buffer);
+
+  // Remove color sequences from the message.
+  RemoveANSIEscapeSequencesFromString(buffer);
   CallPrintfAndReportCallback(buffer);
+  LogMessageOnPrintf(buffer);
+
   // If we had mapped any memory, clean up.
   if (buffer != local_buffer)
     UnmapOrDie((void *)buffer, buffer_size);

Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc
==============================================================================
--- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -1892,8 +1892,10 @@ TSAN_INTERCEPTOR(int, rmdir, char *path)
 
 TSAN_INTERCEPTOR(int, closedir, void *dirp) {
   SCOPED_TSAN_INTERCEPTOR(closedir, dirp);
-  int fd = dirfd(dirp);
-  FdClose(thr, pc, fd);
+  if (dirp) {
+    int fd = dirfd(dirp);
+    FdClose(thr, pc, fd);
+  }
   return REAL(closedir)(dirp);
 }
 

Modified: vendor/compiler-rt/dist/test/cfi/CMakeLists.txt
==============================================================================
--- vendor/compiler-rt/dist/test/cfi/CMakeLists.txt	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/test/cfi/CMakeLists.txt	Wed Jan 13 20:02:03 2016	(r293842)
@@ -6,10 +6,12 @@ configure_lit_site_cfg(
 set(CFI_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
 if(NOT COMPILER_RT_STANDALONE_BUILD)
   list(APPEND CFI_TEST_DEPS
-    cfi
     opt
     ubsan
   )
+  if(COMPILER_RT_HAS_CFI)
+    list(APPEND CFI_TEST_DEPS cfi)
+  endif()
   if(LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR)
     list(APPEND CFI_TEST_DEPS
       LLVMgold

Modified: vendor/compiler-rt/dist/test/msan/insertvalue_origin.cc
==============================================================================
--- vendor/compiler-rt/dist/test/msan/insertvalue_origin.cc	Wed Jan 13 20:01:42 2016	(r293841)
+++ vendor/compiler-rt/dist/test/msan/insertvalue_origin.cc	Wed Jan 13 20:02:03 2016	(r293842)
@@ -4,7 +4,6 @@
 // RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
 
 // Test origin propagation through insertvalue IR instruction.
-// REQUIRES: stable-runtime
 
 #include <stdio.h>
 #include <stdint.h>

Added: vendor/compiler-rt/dist/test/profile/Linux/instrprof-basic.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/compiler-rt/dist/test/profile/Linux/instrprof-basic.c	Wed Jan 13 20:02:03 2016	(r293842)
@@ -0,0 +1,31 @@
+// RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t -O3 %s
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
+// RUN: llvm-profdata merge -o %t.profdata %t.profraw
+// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
+
+int begin(int i) {
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
+  if (i)
+    return 0;
+  return 1;
+}
+
+int end(int i) {
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
+  if (i)
+    return 0;
+  return 1;
+}
+
+int main(int argc, const char *argv[]) {
+  begin(0);
+  end(1);
+
+  // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
+  if (argc)
+    return 0;
+  return 1;
+}
+
+// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
+// CHECK: ![[PD2]] = !{!"branch_weights", i32 2, i32 1}

Added: vendor/compiler-rt/dist/test/profile/Linux/instrprof-dlopen.test
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/compiler-rt/dist/test/profile/Linux/instrprof-dlopen.test	Wed Jan 13 20:02:03 2016	(r293842)
@@ -0,0 +1,34 @@
+RUN: mkdir -p %t.d
+RUN: %clang_profgen -o %t.d/func.shared -fPIC -shared -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections  %S/../Inputs/instrprof-dlopen-func.c
+RUN: %clang_profgen -o %t.d/func2.shared -fPIC -shared -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections  %S/../Inputs/instrprof-dlopen-func2.c
+RUN: %clang -o %t-local -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_LOCAL" %S/../Inputs/instrprof-dlopen-main.c
+RUN: %clang -o %t-global -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_GLOBAL" %S/../Inputs/instrprof-dlopen-main.c
+
+RUN: %clang -c -o %t.d/main.o %S/../Inputs/instrprof-dlopen-main.c
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections  -o %t-static %S/../Inputs/instrprof-dlopen-func.c %S/../Inputs/instrprof-dlopen-func2.c %t.d/main.o
+
+RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
+RUN: env LLVM_PROFILE_FILE=%t-local.profraw %run %t-local
+RUN: env LLVM_PROFILE_FILE=%t-global.profraw %run %t-global
+
+RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
+RUN: llvm-profdata merge -o %t-local.profdata %t-local.profraw
+RUN: llvm-profdata merge -o %t-global.profdata %t-global.profraw
+
+RUN: %clang_profuse=%t-static.profdata -o %t-func.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
+RUN: %clang_profuse=%t-local.profdata -o %t-func.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
+RUN: %clang_profuse=%t-global.profdata -o %t-func.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
+RUN: diff %t-func.static.ll %t-func.local.ll
+RUN: diff %t-func.static.ll %t-func.global.ll
+
+RUN: %clang_profuse=%t-static.profdata -o %t-func2.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
+RUN: %clang_profuse=%t-local.profdata -o %t-func2.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
+RUN: %clang_profuse=%t-global.profdata -o %t-func2.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
+RUN: diff %t-func2.static.ll %t-func2.local.ll
+RUN: diff %t-func2.static.ll %t-func2.global.ll
+
+RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
+RUN: %clang_profuse=%t-local.profdata -o %t-main.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
+RUN: %clang_profuse=%t-local.profdata -o %t-main.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
+RUN: diff %t-main.static.ll %t-main.local.ll
+RUN: diff %t-main.static.ll %t-main.global.ll

Added: vendor/compiler-rt/dist/test/profile/Linux/instrprof-dynamic-one-shared.test
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/compiler-rt/dist/test/profile/Linux/instrprof-dynamic-one-shared.test	Wed Jan 13 20:02:03 2016	(r293842)
@@ -0,0 +1,23 @@
+RUN: mkdir -p %t.d
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t.d/a.shared -fPIC -shared %S/../Inputs/instrprof-dynamic-a.cpp
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-shared -fPIC -rpath %t.d %t.d/a.shared %S/../Inputs/instrprof-dynamic-b.cpp %S/../Inputs/instrprof-dynamic-main.cpp
+
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-static %S/../Inputs/instrprof-dynamic-a.cpp %S/../Inputs/instrprof-dynamic-b.cpp %S/../Inputs/instrprof-dynamic-main.cpp
+
+RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
+RUN: env LLVM_PROFILE_FILE=%t-shared.profraw %run %t-shared
+
+RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
+RUN: llvm-profdata merge -o %t-shared.profdata %t-shared.profraw
+
+RUN: %clang_profuse=%t-static.profdata -o %t-a.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-a.cpp
+RUN: %clang_profuse=%t-shared.profdata -o %t-a.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-a.cpp
+RUN: diff %t-a.static.ll %t-a.shared.ll
+
+RUN: %clang_profuse=%t-static.profdata -o %t-b.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-b.cpp
+RUN: %clang_profuse=%t-shared.profdata -o %t-b.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-b.cpp
+RUN: diff %t-b.static.ll %t-b.shared.ll
+
+RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-main.cpp
+RUN: %clang_profuse=%t-shared.profdata -o %t-main.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-main.cpp
+RUN: diff %t-main.static.ll %t-main.shared.ll

Added: vendor/compiler-rt/dist/test/profile/Linux/instrprof-dynamic-two-shared.test
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/compiler-rt/dist/test/profile/Linux/instrprof-dynamic-two-shared.test	Wed Jan 13 20:02:03 2016	(r293842)
@@ -0,0 +1,24 @@
+RUN: mkdir -p %t.d
+RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t.d/a.shared -fPIC -shared %S/../Inputs/instrprof-dynamic-a.cpp

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601132002.u0DK24Tw087605>