Skip to content

Commit 271e073

Browse files
authored
[libc] Fix fixed point detection and add compile option. (#81788)
1 parent ad49657 commit 271e073

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

libc/cmake/modules/LLVMLibCObjectRules.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ function(_get_common_compile_options output_var flags)
4949
list(APPEND compile_options "-ffreestanding")
5050
endif()
5151

52+
if(LIBC_COMPILER_HAS_FIXED_POINT)
53+
list(APPEND compile_options "-ffixed-point")
54+
endif()
55+
5256
list(APPEND compile_options "-fno-builtin")
5357
list(APPEND compile_options "-fno-exceptions")
5458
list(APPEND compile_options "-fno-lax-vector-conversions")

libc/cmake/modules/compiler_features/check_fixed_point.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "include/llvm-libc-macross/stdfix_macros.h"
1+
#include "include/llvm-libc-macros/stdfix-macros.h"
22

33
#ifndef LIBC_COMPILER_HAS_FIXED_POINT
44
#error unsupported

libc/test/UnitTest/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ function(add_unittest_framework_library name)
3131
if(TARGET libc.src.time.clock)
3232
target_compile_definitions(${lib} PRIVATE TARGET_SUPPORTS_CLOCK)
3333
endif()
34+
if(LIBC_COMPILER_HAS_FIXED_POINT)
35+
target_compile_options(${lib} PUBLIC -ffixed-point)
36+
endif()
3437
endforeach()
3538
target_include_directories(${name}.hermetic PRIVATE ${LIBC_BUILD_DIR}/include)
3639
target_compile_options(${name}.hermetic

0 commit comments

Comments
 (0)