[compiler-rt] [compiler-rt] Detect arm hardfloat targets via __ARM_PCS_VFP (PR #137175)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 24 05:49:27 PDT 2025


https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/137175

This makes sure that COMPILER_RT_ARMHF_TARGET is set properly for targets without a specific "armhf" target name, such as armv7 windows.

This fixes the builtins test comparesf2_test.c on Windows on armv7.

>From 53c34b1917044d24d024d898b8dfc8b20d75e39e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Mon, 21 Apr 2025 15:28:12 +0300
Subject: [PATCH] [compiler-rt] Detect arm hardfloat targets via __ARM_PCS_VFP

This makes sure that COMPILER_RT_ARMHF_TARGET is set properly
for targets without a specific "armhf" target name, such as
armv7 windows.

This fixes the builtins test comparesf2_test.c on Windows on armv7.
---
 compiler-rt/lib/builtins/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 74d9627b9f102..0c986f484bf5e 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -877,6 +877,7 @@ else ()
       # For ARM archs, exclude any VFP builtins if VFP is not supported
       if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em|armv8m.main|armv8.1m.main)$")
         check_compile_definition(__ARM_FP "${CMAKE_C_FLAGS}" COMPILER_RT_HAS_${arch}_VFP)
+        check_compile_definition(__ARM_PCS_VFP "${CMAKE_C_FLAGS}" COMPILER_RT_HAS_${arch}_ARMHF)
         if(NOT COMPILER_RT_HAS_${arch}_VFP)
           list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES} ${arm_Thumb1_VFPv2_SP_SOURCES} ${arm_Thumb1_SjLj_EH_SOURCES})
         else()
@@ -908,7 +909,7 @@ else ()
 
       # Needed for clear_cache on debug mode, due to r7's usage in inline asm.
       # Release mode already sets it via -O2/3, Debug mode doesn't.
-      if (${arch} STREQUAL "armhf")
+      if (COMPILER_RT_HAS_${arch}_ARMHF)
         list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET)
       endif()
 



More information about the llvm-commits mailing list