mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 05:25:48 +00:00
[CMAKE] Add the kernel module type
Take this as an occasion to use target_link_options more
This commit is contained in:
parent
812c9e5a11
commit
e55123a6a2
5 changed files with 125 additions and 71 deletions
|
@ -249,13 +249,20 @@ function(set_image_base MODULE IMAGE_BASE)
|
|||
endfunction()
|
||||
|
||||
function(set_module_type_toolchain MODULE TYPE)
|
||||
if((${TYPE} STREQUAL "win32dll") OR (${TYPE} STREQUAL "win32ocx") OR (${TYPE} STREQUAL "cpl"))
|
||||
add_target_link_flags(${MODULE} "/DLL")
|
||||
elseif(${TYPE} STREQUAL "kernelmodedriver")
|
||||
# Disable linker warning 4078 (multiple sections found with different attributes) for INIT section use
|
||||
add_target_link_flags(${MODULE} "/DRIVER /SECTION:INIT,ERWD")
|
||||
elseif(${TYPE} STREQUAL "wdmdriver")
|
||||
add_target_link_flags(${MODULE} "/DRIVER:WDM /SECTION:INIT,ERWD")
|
||||
if((TYPE STREQUAL win32dll) OR (TYPE STREQUAL win32ocx) OR (TYPE STREQUAL cpl))
|
||||
target_link_options(${MODULE} PRIVATE /DLL)
|
||||
elseif(TYPE IN_LIST KERNEL_MODULE_TYPES)
|
||||
# Mark INIT section as Executable Read Write Discardable
|
||||
target_link_options(${MODULE} PRIVATE /SECTION:INIT,ERWD)
|
||||
|
||||
if(TYPE STREQUAL kernelmodedriver)
|
||||
target_link_options(${MODULE} PRIVATE /DRIVER)
|
||||
elseif(TYPE STREQUAL wdmdriver)
|
||||
target_link_options(${MODULE} PRIVATE /DRIVER:WDM)
|
||||
elseif (TYPE STREQUAL kernel)
|
||||
# Mark .rsrc section as non-disposable non-pageable, as bugcheck code needs to access it
|
||||
target_link_options(${MODULE} PRIVATE /SECTION:.rsrc,!DP )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(RUNTIME_CHECKS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue