* 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

svn path=/trunk/; revision=62354
This commit is contained in:
Amine Khaldi 2014-02-28 16:18:41 +00:00
parent 5729a923fe
commit 06a96d5805
3 changed files with 27 additions and 1 deletions

View file

@ -417,7 +417,7 @@ function(add_importlibs _module)
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 @@ function(set_module_type MODULE TYPE)
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)

View file

@ -215,6 +215,15 @@ allow GCC to optimize away some EH unwind code, at least in DW2 case. */
#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 */

View file

@ -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"