mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[NDK][CMAKE] Introduce DATA_SEG and CODE_SEG macro
These are for putting code and data to non-default sections At the same time, move INIT section attributes declaration to cmake files
This commit is contained in:
parent
ba447018c8
commit
658f742c2d
4 changed files with 9 additions and 15 deletions
|
@ -52,7 +52,7 @@ function(add_hal _halname)
|
|||
set_module_type(${_halname} kerneldll ENTRYPOINT HalInitSystem 8)
|
||||
add_cd_file(TARGET ${_halname} DESTINATION reactos/system32 NO_CAB FOR all)
|
||||
if(MSVC)
|
||||
add_target_link_flags(${_halname} "/ignore:4216 /ignore:4078")
|
||||
add_target_link_flags(${_halname} "/ignore:4216 /SECTION:INIT,ERWD")
|
||||
else()
|
||||
target_link_libraries(${_halname} -lgcc)
|
||||
endif()
|
||||
|
|
|
@ -36,7 +36,7 @@ set_subsystem(ntoskrnl native)
|
|||
if(MSVC)
|
||||
set_image_base(ntoskrnl 0x00400000)
|
||||
add_target_link_flags(ntoskrnl "/SECTION:.rsrc,!DP") #Accessed from bugcheck code
|
||||
add_target_link_flags(ntoskrnl "/SECTION:INIT,D")
|
||||
add_target_link_flags(ntoskrnl "/SECTION:INIT,ERWD")
|
||||
else()
|
||||
if(GDB)
|
||||
# Completely disable optimizations when debugging the kernel
|
||||
|
|
|
@ -248,9 +248,9 @@ function(set_module_type_toolchain MODULE TYPE)
|
|||
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 /IGNORE:4078 /SECTION:INIT,D")
|
||||
add_target_link_flags(${MODULE} "/DRIVER /SECTION:INIT,ERWD")
|
||||
elseif(${TYPE} STREQUAL "wdmdriver")
|
||||
add_target_link_flags(${MODULE} "/DRIVER:WDM /IGNORE:4078 /SECTION:INIT,D")
|
||||
add_target_link_flags(${MODULE} "/DRIVER:WDM /SECTION:INIT,ERWD")
|
||||
endif()
|
||||
|
||||
if(RUNTIME_CHECKS)
|
||||
|
|
|
@ -8,7 +8,7 @@ Header Name:
|
|||
|
||||
Abstract:
|
||||
|
||||
Preprocessor definitions to put code and data into the INIT section.
|
||||
Preprocessor definitions to put code and data into specific sections.
|
||||
|
||||
Author:
|
||||
|
||||
|
@ -20,19 +20,13 @@ Author:
|
|||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
|
||||
#define INIT_SECTION __attribute__((section ("INIT")))
|
||||
#define INIT_FUNCTION __attribute__((section ("INIT")))
|
||||
#define DATA_SEG(segment) __attribute__((section(segment)))
|
||||
#define CODE_SEG(segment) __attribute__((section(segment)))
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#pragma comment(linker, "/SECTION:INIT,ERW")
|
||||
#define INIT_SECTION __declspec(allocate("INIT"))
|
||||
#if (_MSC_VER >= 1800) // Visual Studio 2013 / version 12.0
|
||||
#define INIT_FUNCTION __declspec(code_seg("INIT"))
|
||||
#else
|
||||
#pragma section("INIT", read,execute,discard)
|
||||
#define INIT_FUNCTION
|
||||
#endif
|
||||
#define DATA_SEG(segment) __declspec(allocate(segment))
|
||||
#define CODE_SEG(segment) __declspec(code_seg(segment))
|
||||
|
||||
#else
|
||||
|
||||
|
|
Loading…
Reference in a new issue