Author: tkreuzer
Date: Mon Mar 28 16:38:26 2016
New Revision: 71066
URL:
http://svn.reactos.org/svn/reactos?rev=71066&view=rev
Log:
[CMAKE/MSVC] Enable function level linking and comdat folding independent from build type.
This reduces freeldr size and allows to build with /RTC1 again. Since GCC doesn't
support function level linking, cmlib should be refactored by moving some functions into
different source files to avoid linking unused code into freeldr.
Modified:
trunk/reactos/cmake/msvc.cmake
Modified: trunk/reactos/cmake/msvc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/msvc.cmake?rev=71066…
==============================================================================
--- trunk/reactos/cmake/msvc.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/msvc.cmake [iso-8859-1] Mon Mar 28 16:38:26 2016
@@ -6,7 +6,6 @@
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
add_compile_flags("/Ox /Ob2 /Ot /Oy /GT /GF")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /OPT:ICF")
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF
/OPT:ICF")
elseif(OPTIMIZE STREQUAL "1")
add_definitions(/O1)
elseif(OPTIMIZE STREQUAL "2")
@@ -18,6 +17,11 @@
elseif(OPTIMIZE STREQUAL "5")
add_definitions(/GF /Gy /Ob2 /Os /Ox /GS-)
endif()
+
+# Enable function level linking and comdat folding
+add_compile_flags("/Gy")
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF
/OPT:ICF")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /OPT:ICF")
if(ARCH STREQUAL "i386")
add_definitions(/DWIN32 /D_WINDOWS)