[compiler-rt] r333216 - [cmake] [ARM] Check if VFP is supported before including any VFP builtins

Azharuddin Mohammed via llvm-commits llvm-commits at lists.llvm.org
Thu May 24 11:53:16 PDT 2018


Author: azharudd
Date: Thu May 24 11:53:16 2018
New Revision: 333216

URL: http://llvm.org/viewvc/llvm-project?rev=333216&view=rev
Log:
[cmake] [ARM] Check if VFP is supported before including any VFP builtins

Summary:
rL325492 disables FPU features when using soft floating point
(-mfloat-abi=soft), which is used internally when building for armv7. This
causes errors with builtins that utililize VFP instructions. With this change
we first check if VFP is enabled (by checking if the preprocessor macro
__VFP_FP__ is defined) before including such builtins.

Reviewers: rengolin, samsonov, compnerd, smeenai, javed.absar, peter.smith

Reviewed By: peter.smith

Subscribers: peter.smith, mgorny, kristof.beyls, chrib, llvm-commits

Differential Revision: https://reviews.llvm.org/D47217

Modified:
    compiler-rt/trunk/cmake/builtin-config-ix.cmake
    compiler-rt/trunk/lib/builtins/CMakeLists.txt

Modified: compiler-rt/trunk/cmake/builtin-config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/builtin-config-ix.cmake?rev=333216&r1=333215&r2=333216&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/builtin-config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/builtin-config-ix.cmake Thu May 24 11:53:16 2018
@@ -48,6 +48,12 @@ set(ALL_BUILTIN_SUPPORTED_ARCH ${X86} ${
 include(CompilerRTUtils)
 include(CompilerRTDarwinUtils)
 
+# If targeting ARM, check if VFP is supported.
+if(CAN_TARGET_arm)
+  string(REPLACE ";" " " _TARGET_arm_CFLAGS "${TARGET_arm_CFLAGS}")
+  check_compile_definition(__VFP_FP__ "${CMAKE_C_FLAGS} ${_TARGET_arm_CFLAGS}" COMPILER_RT_HAS_ARM_VFP)
+endif()
+
 if(APPLE)
 
   find_darwin_sdk_dir(DARWIN_osx_SYSROOT macosx)

Modified: compiler-rt/trunk/lib/builtins/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/CMakeLists.txt?rev=333216&r1=333215&r2=333216&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/builtins/CMakeLists.txt Thu May 24 11:53:16 2018
@@ -394,11 +394,20 @@ set(arm_Thumb1_VFPv2_SOURCES
   arm/unordsf2vfp.S)
 set(arm_Thumb1_icache_SOURCES
   arm/sync_synchronize.S)
-set(arm_Thumb1_SOURCES
-  ${arm_Thumb1_JT_SOURCES}
-  ${arm_Thumb1_SjLj_EH_SOURCES}
-  ${arm_Thumb1_VFPv2_SOURCES}
-  ${arm_Thumb1_icache_SOURCES})
+
+# If VFP is supported, include arm_Thumb1_SjLj_EH_SOURCES and
+# arm_Thumb1_VFPv2_SOURCES in arm_Thumb1_SOURCES.
+if(COMPILER_RT_HAS_ARM_VFP)
+  set(arm_Thumb1_SOURCES
+    ${arm_Thumb1_JT_SOURCES}
+    ${arm_Thumb1_SjLj_EH_SOURCES}
+    ${arm_Thumb1_VFPv2_SOURCES}
+    ${arm_Thumb1_icache_SOURCES})
+else()
+  set(arm_Thumb1_SOURCES
+    ${arm_Thumb1_JT_SOURCES}
+    ${arm_Thumb1_icache_SOURCES})
+endif()
 
 if(MINGW)
   set(arm_SOURCES




More information about the llvm-commits mailing list