Skip to content

Commit b533962

Browse files
Merge pull request livecode#3526 from livecodefraser/windows_lto_installer_fix
Ensure LTO doesn't discard the .payload and .project sections of the installer
2 parents 233582f + 16690d8 commit b533962

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

engine/src/mode_installer.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ __declspec(allocate(".project")) volatile MCCapsuleInfo MCcapsule = {};
105105
#define PAYLOAD_SECTION_NAME ".payload"
106106
#define PROJECT_SECTION_NAME ".project"
107107

108-
extern MCCapsuleInfo MCpayload, MCcapsule;
108+
extern volatile MCCapsuleInfo MCpayload, MCcapsule;
109109
asm (".section .payload, \"aw\", \"nobits\"; .global MCpayload; MCpayload: .align 16; .space 16;");
110110
asm (".section .project, \"aw\", \"nobits\"; .global MCcapsule; MCcapsule: .align 16; .space 16;");
111111

@@ -263,6 +263,11 @@ class MCInternalPayloadOpen: public MCStatement
263263
}
264264
}
265265
#else
266+
// Force references to the payload and project sections to prevent
267+
// extra-clever optimising linkers from discarding the sections.
268+
(void)MCpayload.size;
269+
(void)MCcapsule.size;
270+
266271
// Search for the payload section - first see if there is a payload
267272
// section of suitable size; then if in debug mode, try to load a stack
268273
// via env var.

0 commit comments

Comments
 (0)