Skip to content

Commit b32cd42

Browse files
Merge pull request livecode#3532 from livecodefraser/mac_installer_sadness
Ensure that the __project section isn't dead-stripped from the OSX installer
2 parents 7ddaa59 + 890abab commit b32cd42

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

engine/src/mode_installer.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ asm (".section .project, \"aw\", \"nobits\"; .global MCcapsule; MCcapsule: .alig
114114
#define PAYLOAD_SECTION_NAME "__PAYLOAD"
115115
#define PROJECT_SECTION_NAME "__PROJECT"
116116

117-
__attribute__((section("__PROJECT,__project"))) volatile MCCapsuleInfo MCcapsule = {};
117+
__attribute__((section("__PROJECT,__project"),__used__)) volatile MCCapsuleInfo MCcapsule = {};
118118

119119
#endif
120120

@@ -244,7 +244,11 @@ class MCInternalPayloadOpen: public MCStatement
244244
if (t_payload_data == nil)
245245
{
246246
#ifdef _MACOSX
247-
// On Mac OS X, the payload is in a separate file.
247+
// Force a reference to the project section to prevent extra-clever
248+
// optimising linkers from discarding the section.
249+
(void)MCcapsule.size;
250+
251+
// On Mac OS X, the payload is in a separate file.
248252
// MM-2011-03-23: Refactored code to use method call.
249253
MCAutoStringRef t_payload_file;
250254
uindex_t t_last_slash;

0 commit comments

Comments
 (0)