[compiler-rt] r254308 - [CMake] Add -fvisibility-inlines-hidden if the compiler supports it.

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 09:42:31 PST 2015


Author: cbieneman
Date: Mon Nov 30 11:42:30 2015
New Revision: 254308

URL: http://llvm.org/viewvc/llvm-project?rev=254308&view=rev
Log:
[CMake] Add -fvisibility-inlines-hidden if the compiler supports it.

This results in a significant reduction in the size of the sanitizer libraries.

Modified:
    compiler-rt/trunk/cmake/config-ix.cmake

Modified: compiler-rt/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=254308&r1=254307&r2=254308&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake (original)
+++ compiler-rt/trunk/cmake/config-ix.cmake Mon Nov 30 11:42:30 2015
@@ -30,6 +30,12 @@ check_cxx_compiler_flag(-fno-lto
 check_cxx_compiler_flag(-msse3               COMPILER_RT_HAS_MSSE3_FLAG)
 check_cxx_compiler_flag(-std=c99             COMPILER_RT_HAS_STD_C99_FLAG)
 
+if(NOT WIN32 AND NOT CYGWIN)
+  # MinGW warns if -fvisibility-inlines-hidden is used.
+  check_cxx_compiler_flag("-fvisibility-inlines-hidden" COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG)
+  append_string_if(COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG "-fvisibility-inlines-hidden" CMAKE_CXX_FLAGS)
+endif()
+
 check_cxx_compiler_flag(/GR COMPILER_RT_HAS_GR_FLAG)
 check_cxx_compiler_flag(/GS COMPILER_RT_HAS_GS_FLAG)
 check_cxx_compiler_flag(/MT COMPILER_RT_HAS_MT_FLAG)




More information about the llvm-commits mailing list