Skip to content

Commit 5663b44

Browse files
authored
Merge pull request #14378 from compnerd/windows-runtime-initializer
2 parents d2862dd + 76d7bfd commit 5663b44

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

stdlib/public/runtime/SwiftRT-COFF.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
#define PRAGMA(pragma) _Pragma(#pragma)
2626

2727
#define DECLARE_SWIFT_SECTION(name) \
28-
PRAGMA(section("." #name "$A", long, read, write)) \
28+
PRAGMA(section("." #name "$A", long, read)) \
2929
__declspec(allocate("." #name "$A")) \
3030
static uintptr_t __start_##name = 0; \
3131
\
32-
PRAGMA(section("." #name "$C", long, read, write)) \
32+
PRAGMA(section("." #name "$C", long, read)) \
3333
__declspec(allocate("." #name "$C")) \
3434
static uintptr_t __stop_##name = 0;
3535

3636
extern "C" {
37+
DECLARE_SWIFT_SECTION(sw5prt)
3738
DECLARE_SWIFT_SECTION(sw5prtc)
3839
DECLARE_SWIFT_SECTION(sw5tymd)
3940

@@ -59,6 +60,7 @@ static void swift_image_constructor() {
5960
nullptr,
6061
nullptr,
6162

63+
SWIFT_SECTION_RANGE(sw5prt),
6264
SWIFT_SECTION_RANGE(sw5prtc),
6365
SWIFT_SECTION_RANGE(sw5tymd),
6466

@@ -73,6 +75,8 @@ static void swift_image_constructor() {
7375
swift_addNewDSOImage(&sections);
7476
}
7577

78+
#pragma section(".CRT$XCIS", long, read)
79+
7680
__declspec(allocate(".CRT$XCIS"))
7781
extern "C" void (*pSwiftImageConstructor)(void) = &swift_image_constructor;
7882
#pragma comment(linker, "/include:" STRING(C_LABEL(pSwiftImageConstructor)))

0 commit comments

Comments
 (0)