mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 19:21:38 +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
|
@ -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…
Add table
Add a link
Reference in a new issue