MentOS  0.8.0
The Mentoring Operating System
link_access.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 // #ifdef __APPLE__
9 
10 // /// @brief Define variables pointing to external symbols, specifically
11 // /// to the .data section of a linked object file.
12 // #define EXTLD(NAME) extern const unsigned char _section$__DATA__##NAME[];
13 // /// Provide access to the .data of the linked object.
14 // #define LDVAR(NAME) _section$__DATA__##NAME
15 
16 // #elif (defined __WIN32__) // mingw
17 
18 #if (defined __WIN32__) // mingw
19 
22 #define EXTLD(NAME) \
23  extern const unsigned char binary_##NAME##_start[]; \
24  extern const unsigned char binary_##NAME##_end[]; \
25  extern const unsigned char binary_##NAME##_size[];
27 #define LDVAR(NAME) binary_##NAME##_start
29 #define LDLEN(NAME) binary_##NAME##_size
30 
31 #else // gnu/linux ld
32 
35 #define EXTLD(NAME) \
36  extern const unsigned char _binary_##NAME##_start[]; \
37  extern const unsigned char _binary_##NAME##_end[]; \
38  extern const unsigned char _binary_##NAME##_size[];
40 #define LDVAR(NAME) _binary_##NAME##_start
42 #define LDLEN(NAME) _binary_##NAME##_size
43 #endif