25
25
#define PRAGMA (pragma ) _Pragma (#pragma)
26
26
27
27
#define DECLARE_SWIFT_SECTION (name ) \
28
- PRAGMA (section(" ." #name " $A" , long , read, write)) \
28
+ PRAGMA (section(" ." #name " $A" , long , read)) \
29
29
__declspec(allocate(" ." #name " $A" )) \
30
30
static uintptr_t __start_##name = 0 ; \
31
31
\
32
- PRAGMA (section(" ." #name " $C" , long , read, write)) \
32
+ PRAGMA (section(" ." #name " $C" , long , read)) \
33
33
__declspec(allocate(" ." #name " $C" )) \
34
34
static uintptr_t __stop_##name = 0 ;
35
35
36
36
extern " C" {
37
+ DECLARE_SWIFT_SECTION (sw5prt)
37
38
DECLARE_SWIFT_SECTION(sw5prtc)
38
39
DECLARE_SWIFT_SECTION(sw5tymd)
39
40
@@ -59,6 +60,7 @@ static void swift_image_constructor() {
59
60
nullptr ,
60
61
nullptr ,
61
62
63
+ SWIFT_SECTION_RANGE (sw5prt),
62
64
SWIFT_SECTION_RANGE (sw5prtc),
63
65
SWIFT_SECTION_RANGE (sw5tymd),
64
66
@@ -73,6 +75,8 @@ static void swift_image_constructor() {
73
75
swift_addNewDSOImage (§ions);
74
76
}
75
77
78
+ #pragma section(".CRT$XCIS", long, read)
79
+
76
80
__declspec (allocate(" .CRT$XCIS" ))
77
81
extern "C" void (*pSwiftImageConstructor)(void ) = &swift_image_constructor;
78
82
#pragma comment(linker, "/include:" STRING(C_LABEL(pSwiftImageConstructor)))
0 commit comments