diff --git a/arch/posix/CMakeLists.txt b/arch/posix/CMakeLists.txt index 0980ba2bca1..635e5a630a6 100644 --- a/arch/posix/CMakeLists.txt +++ b/arch/posix/CMakeLists.txt @@ -30,7 +30,7 @@ add_library(native_simulator INTERFACE) if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/${CMAKE_HOST_SYSTEM_NAME}.${CMAKE_HOST_SYSTEM_PROCESSOR}.cmake) # @Intent: Set necessary compiler & linker options for this specific host architecture & OS include(${CMAKE_HOST_SYSTEM_NAME}.${CMAKE_HOST_SYSTEM_PROCESSOR}.cmake) -else() +else() # Linux.x86_64 if (CONFIG_64BIT) # some gcc versions fail to build without -fPIC zephyr_compile_options(-m64 -fPIC) @@ -44,6 +44,14 @@ else() target_link_options(native_simulator INTERFACE "-m32") target_compile_options(native_simulator INTERFACE "-m32") + + # When building for 32bits x86, gcc defaults to using the old 8087 float arithmetic + # which causes some issues with literal float comparisons. So we set it + # to use the SSE2 float path instead + # (clang defaults to use SSE, but, setting this option for it is safe) + check_set_compiler_property(APPEND PROPERTY fpsse2 "SHELL:-msse2 -mfpmath=sse") + zephyr_compile_options($) + target_compile_options(native_simulator INTERFACE "$") endif () endif()