[compiler-rt] cfb978d - [compiler-rt] Use try_compile_only to check for __ARM_FP

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 13:22:02 PDT 2021


Author: Martin Storsjö
Date: 2021-03-16T22:21:18+02:00
New Revision: cfb978d85fe131493f37a1bc8beeb3898deccca0

URL: https://github.com/llvm/llvm-project/commit/cfb978d85fe131493f37a1bc8beeb3898deccca0
DIFF: https://github.com/llvm/llvm-project/commit/cfb978d85fe131493f37a1bc8beeb3898deccca0.diff

LOG: [compiler-rt] Use try_compile_only to check for __ARM_FP

This fixes detection when linking isn't supported (i.e. while building
builtins the first time).

Since 8368e4d54c459fe173d76277f17c632478e91add, after setting
CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY, this isn't strictly
needed, but is good for correctness anyway (and in case that commit
ends up reverted).

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

Added: 
    

Modified: 
    compiler-rt/lib/builtins/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 4e81093219c0..c81c535c8538 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -707,10 +707,11 @@ else ()
           list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES} ${arm_Thumb1_VFPv2_SP_SOURCES} ${arm_Thumb1_SjLj_EH_SOURCES})
         else()
           # Exclude any double-precision builtins if VFP is single-precision-only
-          check_c_source_compiles("#if !(__ARM_FP & 0x8)
+          try_compile_only(COMPILER_RT_HAS_${arch}_VFP_DP
+                           SOURCE "#if !(__ARM_FP & 0x8)
                                    #error No double-precision support!
                                    #endif
-                                   int main() { return 0; }" COMPILER_RT_HAS_${arch}_VFP_DP)
+                                   int main() { return 0; }")
           if(NOT COMPILER_RT_HAS_${arch}_VFP_DP)
             list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES})
           endif()


        


More information about the llvm-commits mailing list