Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Aug 2016 19:35:22 +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: r304302 - in vendor/compiler-rt/dist: cmake cmake/Modules lib/builtins lib/sanitizer_common/tests test/asan/TestCases test/asan/TestCases/Darwin
Message-ID:  <201608171935.u7HJZMOh083062@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Aug 17 19:35:22 2016
New Revision: 304302
URL: https://svnweb.freebsd.org/changeset/base/304302

Log:
  Vendor import of compiler-rt release_39 branch r278877:
  https://llvm.org/svn/llvm-project/compiler-rt/branches/release_39@278877

Deleted:
  vendor/compiler-rt/dist/test/asan/TestCases/Darwin/dead-strip.c
Modified:
  vendor/compiler-rt/dist/cmake/Modules/BuiltinTests.cmake
  vendor/compiler-rt/dist/cmake/builtin-config-ix.cmake
  vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt
  vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_symbolizer_test.cc
  vendor/compiler-rt/dist/test/asan/TestCases/alloca_constant_size.cc

Modified: vendor/compiler-rt/dist/cmake/Modules/BuiltinTests.cmake
==============================================================================
--- vendor/compiler-rt/dist/cmake/Modules/BuiltinTests.cmake	Wed Aug 17 19:35:05 2016	(r304301)
+++ vendor/compiler-rt/dist/cmake/Modules/BuiltinTests.cmake	Wed Aug 17 19:35:22 2016	(r304302)
@@ -2,11 +2,15 @@
 # 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})
@@ -51,7 +55,20 @@ 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")

Modified: vendor/compiler-rt/dist/cmake/builtin-config-ix.cmake
==============================================================================
--- vendor/compiler-rt/dist/cmake/builtin-config-ix.cmake	Wed Aug 17 19:35:05 2016	(r304301)
+++ vendor/compiler-rt/dist/cmake/builtin-config-ix.cmake	Wed Aug 17 19:35:22 2016	(r304302)
@@ -1,4 +1,5 @@
 include(BuiltinTests)
+include(CheckCSourceCompiles)
 
 # Make all the tests only check the compiler
 set(TEST_COMPILE_ONLY On)
@@ -14,6 +15,15 @@ builtin_check_c_compiler_flag(-mfloat-ab
 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)

Modified: vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt
==============================================================================
--- vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt	Wed Aug 17 19:35:05 2016	(r304301)
+++ vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt	Wed Aug 17 19:35:22 2016	(r304302)
@@ -38,8 +38,6 @@ set(GENERIC_SOURCES
   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
@@ -162,6 +160,12 @@ set(GENERIC_SOURCES
   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

Modified: vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_symbolizer_test.cc
==============================================================================
--- vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_symbolizer_test.cc	Wed Aug 17 19:35:05 2016	(r304301)
+++ vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_symbolizer_test.cc	Wed Aug 17 19:35:22 2016	(r304302)
@@ -62,7 +62,9 @@ TEST(Symbolizer, DemangleSwiftAndCXX) {
   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

Modified: vendor/compiler-rt/dist/test/asan/TestCases/alloca_constant_size.cc
==============================================================================
--- vendor/compiler-rt/dist/test/asan/TestCases/alloca_constant_size.cc	Wed Aug 17 19:35:05 2016	(r304301)
+++ vendor/compiler-rt/dist/test/asan/TestCases/alloca_constant_size.cc	Wed Aug 17 19:35:22 2016	(r304302)
@@ -10,6 +10,8 @@
 // MSVC provides _alloca instead of alloca.
 #if defined(_MSC_VER) && !defined(alloca)
 # define alloca _alloca
+#elif defined(__FreeBSD__)
+#include <stdlib.h>
 #else
 #include <alloca.h>
 #endif



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