Author: dgorbachev
Date: Sat Mar 10 23:38:37 2012
New Revision: 56109
URL:
http://svn.reactos.org/svn/reactos?rev=56109&view=rev
Log:
[CMAKE]
Allow to build with link-time code generation.
Modified:
trunk/reactos/cmake/config-amd64.cmake
trunk/reactos/cmake/config-arm.cmake
trunk/reactos/cmake/config.cmake
trunk/reactos/cmake/gcc.cmake
trunk/reactos/lib/sdk/crt/msvcrtex.cmake
trunk/reactos/ntoskrnl/CMakeLists.txt
Modified: trunk/reactos/cmake/config-amd64.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/config-amd64.cmake?r…
==============================================================================
--- trunk/reactos/cmake/config-amd64.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/config-amd64.cmake [iso-8859-1] Sat Mar 10 23:38:37 2012
@@ -14,6 +14,9 @@
3 = -O1
4 = -O2
5 = -O3")
+
+set(LTCG FALSE CACHE BOOL
+"Whether to build with link-time code generation")
set(DBG TRUE CACHE BOOL
"Whether to compile for debugging.")
Modified: trunk/reactos/cmake/config-arm.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/config-arm.cmake?rev…
==============================================================================
--- trunk/reactos/cmake/config-arm.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/config-arm.cmake [iso-8859-1] Sat Mar 10 23:38:37 2012
@@ -15,6 +15,9 @@
3 = -O1
4 = -O2
5 = -O3")
+
+set(LTCG FALSE CACHE BOOL
+"Whether to build with link-time code generation")
set(DBG TRUE CACHE BOOL
"Whether to compile for debugging.")
Modified: trunk/reactos/cmake/config.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/config.cmake?rev=561…
==============================================================================
--- trunk/reactos/cmake/config.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/config.cmake [iso-8859-1] Sat Mar 10 23:38:37 2012
@@ -20,6 +20,9 @@
3 = -O1
4 = -O2
5 = -O3")
+
+set(LTCG FALSE CACHE BOOL
+"Whether to build with link-time code generation")
set(GDB FALSE CACHE BOOL
"Whether to compile for debugging with GDB.
Modified: trunk/reactos/cmake/gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/gcc.cmake?rev=56109&…
==============================================================================
--- trunk/reactos/cmake/gcc.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/gcc.cmake [iso-8859-1] Sat Mar 10 23:38:37 2012
@@ -77,6 +77,11 @@
add_compile_flags("-O3")
endif()
+# Link-time code generation
+if(LTCG)
+ add_compile_flags("-flto -Wno-error=clobbered")
+endif()
+
add_compile_flags("-fno-strict-aliasing")
if(ARCH MATCHES i386)
@@ -139,19 +144,19 @@
# Normal rsym build
get_target_property(RSYM native-rsym IMPORTED_LOCATION_NOCONFIG)
set(CMAKE_C_LINK_EXECUTABLE
- "<CMAKE_C_COMPILER> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS>
<OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
+ "<CMAKE_C_COMPILER> ${CMAKE_C_FLAGS} <CMAKE_C_LINK_FLAGS>
<LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
"${RSYM} <TARGET> <TARGET>")
set(CMAKE_CXX_LINK_EXECUTABLE
- "<CMAKE_CXX_COMPILER> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS>
<OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
+ "<CMAKE_CXX_COMPILER> ${CMAKE_CXX_FLAGS} <CMAKE_CXX_LINK_FLAGS>
<LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>"
"${RSYM} <TARGET> <TARGET>")
set(CMAKE_C_CREATE_SHARED_LIBRARY
- "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS>
<LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET>
<OBJECTS> <LINK_LIBRARIES>"
+ "<CMAKE_C_COMPILER> ${CMAKE_C_FLAGS}
<CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS>
<CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS>
<LINK_LIBRARIES>"
"${RSYM} <TARGET> <TARGET>")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
- "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS>
<LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET>
<OBJECTS> <LINK_LIBRARIES>"
+ "<CMAKE_CXX_COMPILER> ${CMAKE_CXX_FLAGS}
<CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS>
<CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> <OBJECTS>
<LINK_LIBRARIES>"
"${RSYM} <TARGET> <TARGET>")
set(CMAKE_RC_CREATE_SHARED_LIBRARY
- "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS>
<LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET>
<OBJECTS> <LINK_LIBRARIES>"
+ "<CMAKE_C_COMPILER> ${CMAKE_C_FLAGS}
<CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS>
<CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS>
<LINK_LIBRARIES>"
"${RSYM} <TARGET> <TARGET>")
endif()
Modified: trunk/reactos/lib/sdk/crt/msvcrtex.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/msvcrtex.cmake…
==============================================================================
--- trunk/reactos/lib/sdk/crt/msvcrtex.cmake [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/msvcrtex.cmake [iso-8859-1] Sat Mar 10 23:38:37 2012
@@ -3,6 +3,9 @@
if(NOT MSVC)
add_compile_flags("-Wno-main")
+ if(LTCG)
+ add_compile_flags("-fno-lto")
+ endif()
endif()
list(APPEND MSVCRTEX_SOURCE
Modified: trunk/reactos/ntoskrnl/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/CMakeLists.txt?re…
==============================================================================
--- trunk/reactos/ntoskrnl/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/CMakeLists.txt [iso-8859-1] Sat Mar 10 23:38:37 2012
@@ -438,6 +438,11 @@
set_image_base(ntoskrnl 0x80800000)
endif()
+# Linker bug
+if(NOT MSVC AND LTCG)
+ add_target_link_flags(ntoskrnl "-shared")
+endif()
+
target_link_libraries(ntoskrnl
cportlib
csq