Author: akhaldi Date: Fri Feb 28 16:18:41 2014 New Revision: 62354
URL: http://svn.reactos.org/svn/reactos?rev=62354&view=rev Log: [CMAKE] * Add support for marking an image as hotpatchable. [INCLUDES] * Introduce a way to allow us to mark pretty much any function in our codebase as DECLSPEC_HOTPATCH (not just in Wine modules). * Fix DECLSPEC_HOTPATCH define and enable this hot patching feature support. CORE-7959
Modified: trunk/reactos/cmake/CMakeMacros.cmake trunk/reactos/include/crt/_mingw.h trunk/reactos/include/reactos/wine/config.h
Modified: trunk/reactos/cmake/CMakeMacros.cmake URL: http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/CMakeMacros.cmake?rev... ============================================================================== --- trunk/reactos/cmake/CMakeMacros.cmake [iso-8859-1] (original) +++ trunk/reactos/cmake/CMakeMacros.cmake [iso-8859-1] Fri Feb 28 16:18:41 2014 @@ -417,7 +417,7 @@ endfunction()
function(set_module_type MODULE TYPE) - cmake_parse_arguments(__module "UNICODE" "IMAGEBASE" "ENTRYPOINT" ${ARGN}) + cmake_parse_arguments(__module "UNICODE;HOTPATCHABLE" "IMAGEBASE" "ENTRYPOINT" ${ARGN})
if(__module_UNPARSED_ARGUMENTS) message(STATUS "set_module_type : unparsed arguments ${__module_UNPARSED_ARGUMENTS}, module : ${MODULE}") @@ -457,6 +457,17 @@ add_target_compile_definitions(${MODULE} UNICODE _UNICODE) endif()
+ # Handle hotpatchable images. + # GCC has this as a function attribute so we're handling it using DECLSPEC_HOTPATCH + if(__module_HOTPATCHABLE AND MSVC) + set_property(TARGET ${_target} APPEND_STRING PROPERTY COMPILE_FLAGS " /hotpatch") + if(ARCH STREQUAL "i386") + set_property(TARGET ${_target} APPEND_STRING PROPERTY LINK_FLAGS " /FUNCTIONPADMIN:5") + elseif(ARCH STREQUAL "amd64") + set_property(TARGET ${_target} APPEND_STRING PROPERTY LINK_FLAGS " /FUNCTIONPADMIN:6") + endif() + endif() + # set entry point if(__module_ENTRYPOINT OR (__module_ENTRYPOINT STREQUAL "0")) list(GET __module_ENTRYPOINT 0 __entrypoint)
Modified: trunk/reactos/include/crt/_mingw.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/_mingw.h?rev=62... ============================================================================== --- trunk/reactos/include/crt/_mingw.h [iso-8859-1] (original) +++ trunk/reactos/include/crt/_mingw.h [iso-8859-1] Fri Feb 28 16:18:41 2014 @@ -215,6 +215,15 @@ #define _DECLSPEC_INTRIN_TYPE #endif
+/* Define to a function attribute for Microsoft hotpatch assembly prefix. */ +#ifndef DECLSPEC_HOTPATCH +#ifdef _MSC_VER +#define DECLSPEC_HOTPATCH +#else +#define DECLSPEC_HOTPATCH __attribute__((__ms_hook_prologue__)) +#endif +#endif /* DECLSPEC_HOTPATCH */ + #include "_mingw_mac.h"
#endif /* !_INC_MINGW */
Modified: trunk/reactos/include/reactos/wine/config.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/wine/config... ============================================================================== --- trunk/reactos/include/reactos/wine/config.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/wine/config.h [iso-8859-1] Fri Feb 28 16:18:41 2014 @@ -1,7 +1,13 @@ #define __WINE_CONFIG_H
/* Define to a function attribute for Microsoft hotpatch assembly prefix. */ +#ifndef DECLSPEC_HOTPATCH +#ifdef _MSC_VER #define DECLSPEC_HOTPATCH +#else +#define DECLSPEC_HOTPATCH __attribute__((__ms_hook_prologue__)) +#endif +#endif /* DECLSPEC_HOTPATCH */
/* Define to the file extension for executables. */ #define EXEEXT ".exe"