summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2017-01-06 08:21:02 +0000
committerMichal Gorny <mgorny@gentoo.org>2017-01-06 08:21:02 +0000
commit45d6d00c311fab33b6625b4dc52272e398bcad1c (patch)
treeb648ae6f868e801974dbeb56be43590912c4a673
parentc6611cdb3718b02ce1a4346939cbb0f4094385b2 (diff)
downloadcompiler-rt-45d6d00c311fab33b6625b4dc52272e398bcad1c.tar.gz
[cmake] Disable appending -msse4.2 flag implicitly
Disable the code appending -msse4.2 flag implicitly when the compiler supports it. The compiler support for this flags do not indicate that the underlying CPU will support SSE4.2, and passing it may result in SSE4.2 code being emitted *implicitly*. If the target platform supports SSE4.2 appropriately, the relevant bits should be already enabled via -march= or equivalent. In this case passing -msse4.2 is redundant. If a runtime detection is desired (which seems to be a case with SCUDO), then (as gcc manpage points out) the specific SSE4.2 needs to be isolated into a separate file, the -msse4.2 flag can be forced only for that file and the function defined in that file can only be called when the CPU is determined to support SSE4.2. This fixes SIGILL on SCUDO when it is compiled using gcc-5.4. Differential Revision: https://reviews.llvm.org/D28304 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291217 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--cmake/config-ix.cmake1
-rw-r--r--lib/scudo/CMakeLists.txt1
2 files changed, 0 insertions, 2 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 7d9aa446b..c6bb850e5 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -29,7 +29,6 @@ check_cxx_compiler_flag(-std=c++11 COMPILER_RT_HAS_STD_CXX11_FLAG)
check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
check_cxx_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
check_cxx_compiler_flag("-Werror -msse3" COMPILER_RT_HAS_MSSE3_FLAG)
-check_cxx_compiler_flag("-Werror -msse4.2" COMPILER_RT_HAS_MSSE4_2_FLAG)
check_cxx_compiler_flag(--sysroot=. COMPILER_RT_HAS_SYSROOT_FLAG)
if(NOT WIN32 AND NOT CYGWIN)
diff --git a/lib/scudo/CMakeLists.txt b/lib/scudo/CMakeLists.txt
index 332c3a972..e683379b2 100644
--- a/lib/scudo/CMakeLists.txt
+++ b/lib/scudo/CMakeLists.txt
@@ -4,7 +4,6 @@ include_directories(..)
set(SCUDO_CFLAGS ${SANITIZER_COMMON_CFLAGS})
append_rtti_flag(OFF SCUDO_CFLAGS)
-append_list_if(COMPILER_RT_HAS_MSSE4_2_FLAG -msse4.2 SCUDO_CFLAGS)
set(SCUDO_SOURCES
scudo_allocator.cpp