mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 13:34:53 +00:00
[CMAKE] Fixup of driver sections in GCC builds
Also introduce a helper variable to list KMode modules
This commit is contained in:
parent
5489efcb1a
commit
812c9e5a11
|
@ -540,6 +540,8 @@ function(add_importlibs _module)
|
||||||
endforeach()
|
endforeach()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Some helper lists
|
||||||
|
list(APPEND KERNEL_MODULE_TYPES kerneldll kernelmodedriver wdmdriver)
|
||||||
function(set_module_type MODULE TYPE)
|
function(set_module_type MODULE TYPE)
|
||||||
cmake_parse_arguments(__module "UNICODE" "IMAGEBASE" "ENTRYPOINT" ${ARGN})
|
cmake_parse_arguments(__module "UNICODE" "IMAGEBASE" "ENTRYPOINT" ${ARGN})
|
||||||
|
|
||||||
|
|
|
@ -280,13 +280,18 @@ function(set_image_base MODULE IMAGE_BASE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(set_module_type_toolchain MODULE TYPE)
|
function(set_module_type_toolchain MODULE TYPE)
|
||||||
if((${TYPE} STREQUAL "kernelmodedriver") OR (${TYPE} STREQUAL "wdmdriver"))
|
if (TYPE IN_LIST KERNEL_MODULE_TYPES)
|
||||||
add_target_link_flags(${MODULE} "-Wl,--exclude-all-symbols,-file-alignment=0x1000,-section-alignment=0x1000")
|
target_link_options(${MODULE} PRIVATE -Wl,--exclude-all-symbols,-file-alignment=0x1000,-section-alignment=0x1000)
|
||||||
if(${TYPE} STREQUAL "wdmdriver")
|
if(${TYPE} STREQUAL "wdmdriver")
|
||||||
add_target_link_flags(${MODULE} "-Wl,--wdmdriver")
|
target_link_options(${MODULE} PRIVATE "-Wl,--wdmdriver")
|
||||||
endif()
|
endif()
|
||||||
# Place INIT section at the tail of the module
|
# Place INIT section at the tail of the module
|
||||||
add_linker_script(${MODULE} ${REACTOS_SOURCE_DIR}/sdk/cmake/init-section.lds)
|
add_linker_script(${MODULE} ${REACTOS_SOURCE_DIR}/sdk/cmake/init-section.lds)
|
||||||
|
# Fixup section characteristiscs
|
||||||
|
add_custom_command(TARGET ${MODULE} POST_BUILD
|
||||||
|
COMMAND native-pefixup --driver $<TARGET_FILE:${MODULE}>)
|
||||||
|
# Believe it or not, cmake doesn't do that
|
||||||
|
set_property(TARGET ${MODULE} APPEND PROPERTY LINK_DEPENDS $<TARGET_PROPERTY:native-pefixup,IMPORTED_LOCATION>)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue