mirror of
https://github.com/reactos/reactos.git
synced 2024-09-07 03:11:07 +00:00
![Timo Kreuzer](/assets/img/avatar_default.png)
* Add an NDK header to define INIT_FUNCTION/INIT_SECTION globally * Use _declspec(allocate(x)) and _declspec(code_seg(x)) on MSVC versions that support it * Use INIT_FUNCTION on functions only and INIT_SECTION on data only (required by MSVC) * Place INIT_FUNCTION before the return type (required by MSVC) * Make sure declarations and implementations share the same modifiers (required by MSVC) * Add a global linker option to suppress warnings about defined but unused INIT section * Merge INIT section into .text in freeldr
42 lines
755 B
C
42 lines
755 B
C
/*++ NDK Version: 0099
|
|
|
|
Copyright (c) Alex Ionescu. All rights reserved.
|
|
|
|
Header Name:
|
|
|
|
section_attribs.h
|
|
|
|
Abstract:
|
|
|
|
Preprocessor definitions to put code and data into the INIT section.
|
|
|
|
Author:
|
|
|
|
Timo Kreuzer (timo.kreuzer@reactos.org)
|
|
|
|
--*/
|
|
|
|
#pragma once
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#define INIT_SECTION __attribute__((section ("INIT")))
|
|
#define INIT_FUNCTION __attribute__((section ("INIT")))
|
|
|
|
#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
|
|
|
|
#else
|
|
|
|
#error Invalid compiler!
|
|
|
|
#endif
|