[PATCH] D47217: [cmake] [ARM] Check if VFP is supported before including any VFP builtins

Azharuddin Mohammed via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 12:35:13 PDT 2018


azharudd created this revision.
azharudd added reviewers: rengolin, samsonov, compnerd, smeenai.
Herald added subscribers: chrib, kristof.beyls, mgorny.
Herald added a reviewer: javed.absar.

https://reviews.llvm.org/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.


Repository:
  rL LLVM

https://reviews.llvm.org/D47217

Files:
  cmake/builtin-config-ix.cmake
  lib/builtins/CMakeLists.txt


Index: lib/builtins/CMakeLists.txt
===================================================================
--- lib/builtins/CMakeLists.txt
+++ lib/builtins/CMakeLists.txt
@@ -394,11 +394,20 @@
   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(NOT COMPILER_RT_HAS_ARM_VFP)
+  set(arm_Thumb1_SOURCES
+    ${arm_Thumb1_JT_SOURCES}
+    ${arm_Thumb1_icache_SOURCES})
+else()
+  set(arm_Thumb1_SOURCES
+    ${arm_Thumb1_JT_SOURCES}
+    ${arm_Thumb1_SjLj_EH_SOURCES}
+    ${arm_Thumb1_VFPv2_SOURCES}
+    ${arm_Thumb1_icache_SOURCES})
+endif()
 
 if(MINGW)
   set(arm_SOURCES
Index: cmake/builtin-config-ix.cmake
===================================================================
--- cmake/builtin-config-ix.cmake
+++ cmake/builtin-config-ix.cmake
@@ -47,6 +47,12 @@
 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47217.148071.patch
Type: text/x-patch
Size: 1434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180522/83ee47a6/attachment.bin>


More information about the llvm-commits mailing list