From 63944988a25335a5ac97f4028e759aede04a8458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Thu, 22 Apr 2021 17:31:39 +0200 Subject: [PATCH] [CMAKE] Disable SSE instruction on GCC amd64 builds Except for user-mode modules --- sdk/cmake/gcc.cmake | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake index f542d34ef19..25893031e52 100644 --- a/sdk/cmake/gcc.cmake +++ b/sdk/cmake/gcc.cmake @@ -172,6 +172,14 @@ add_definitions(-D_inline=__inline) # Fix build with GLIBCXX + our c++ headers add_definitions(-D_GLIBCXX_HAVE_BROKEN_VSWPRINTF) +# Disable SSE globally on amd64 builds. +# We can't disable it for kernel mode modules only, +# as we don't call set_module_type on static libraries +# Instead we disable this options for user-mode modules +if(ARCH STREQUAL "amd64") + add_compile_options(-mno-sse) +endif() + # Alternative arch name if(ARCH STREQUAL "amd64") set(ARCH2 x86_64) @@ -314,6 +322,9 @@ function(set_module_type_toolchain MODULE TYPE) # Believe it or not, cmake doesn't do that set_property(TARGET ${MODULE} APPEND PROPERTY LINK_DEPENDS $) + else() + # We can safely use SSE for user-mode parts + remove_target_compile_option(${MODULE} -mno-sse) endif() endfunction()