[libc-commits] [libc] 271e073 - [libc] Fix fixed point detection and add compile option. (#81788)

via libc-commits libc-commits at lists.llvm.org
Wed Feb 14 14:12:55 PST 2024


Author: lntue
Date: 2024-02-14T17:12:51-05:00
New Revision: 271e07321bd0673f5472055012b4cfd1671be9ec

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

LOG: [libc] Fix fixed point detection and add compile option. (#81788)

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCObjectRules.cmake
    libc/cmake/modules/compiler_features/check_fixed_point.cpp
    libc/test/UnitTest/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index ef1f24863f61ab..54c7e1eaed0bfd 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -49,6 +49,10 @@ function(_get_common_compile_options output_var flags)
       list(APPEND compile_options "-ffreestanding")
     endif()
 
+    if(LIBC_COMPILER_HAS_FIXED_POINT)
+      list(APPEND compile_options "-ffixed-point")
+    endif()
+
     list(APPEND compile_options "-fno-builtin")
     list(APPEND compile_options "-fno-exceptions")
     list(APPEND compile_options "-fno-lax-vector-conversions")

diff  --git a/libc/cmake/modules/compiler_features/check_fixed_point.cpp b/libc/cmake/modules/compiler_features/check_fixed_point.cpp
index 02932dbf4d722d..a5192697d43f77 100644
--- a/libc/cmake/modules/compiler_features/check_fixed_point.cpp
+++ b/libc/cmake/modules/compiler_features/check_fixed_point.cpp
@@ -1,4 +1,4 @@
-#include "include/llvm-libc-macross/stdfix_macros.h"
+#include "include/llvm-libc-macros/stdfix-macros.h"
 
 #ifndef LIBC_COMPILER_HAS_FIXED_POINT
 #error unsupported

diff  --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt
index 9baa41874a83db..e3099e45154765 100644
--- a/libc/test/UnitTest/CMakeLists.txt
+++ b/libc/test/UnitTest/CMakeLists.txt
@@ -31,6 +31,9 @@ function(add_unittest_framework_library name)
     if(TARGET libc.src.time.clock)
       target_compile_definitions(${lib} PRIVATE TARGET_SUPPORTS_CLOCK)
     endif()
+    if(LIBC_COMPILER_HAS_FIXED_POINT)
+      target_compile_options(${lib} PUBLIC -ffixed-point)
+    endif()
   endforeach()
   target_include_directories(${name}.hermetic PRIVATE ${LIBC_BUILD_DIR}/include)
   target_compile_options(${name}.hermetic


        


More information about the libc-commits mailing list