Skip to content

Commit

Permalink
On macOS allow DUAL_MAPPED_CODE_ZONE to be tested (don't rely on proc…
Browse files Browse the repository at this point in the history
…ctl.h

and privide exeName).  Also avoid including COGDEFS twice in CFLAGS.
  • Loading branch information
eliotmiranda committed Jul 3, 2021
1 parent ae5a967 commit 74afafc
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.macos32x86/common/Makefile.vm
Expand Up @@ -119,7 +119,7 @@ DEBUGVM=-DDEBUGVM=0 -DNDEBUG=1 # Define NDEBUG for production to exclude asserts
endif

TZ:=$(shell date +%Z)
DEFS:= $(COGDEFS) -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
DEFS:= -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
-DUSE_INLINE_MEMORY_ACCESSORS -D'TZ="$(TZ)"' \
-DHAVE_CONFIG_H=1

Expand Down
2 changes: 1 addition & 1 deletion build.macos64ARMv8/common/Makefile.flags
Expand Up @@ -45,7 +45,7 @@ ifdef BIT_IDENTICAL_FLOATING_POINT
CFLAGS:=$(CFLAGS) -DBIT_IDENTICAL_FLOATING_POINT=1
endif

CFLAGS:=$(CFLAGS) -DBUILD_FOR_OSX=1 -DUSE_METAL=1 -DUSE_OPENGL=1 -DUSE_CORE_GRAPHICS=1 \
CFLAGS:=$(CFLAGS) -DBUILD_FOR_OSX=1 -DUSE_METAL=1 -DUSE_CORE_GRAPHICS=1 \
-arch $(TARGET_ARCH) \
-mmacosx-version-min=$(TARGET_VERSION_MIN) \
-fvisibility=default \
Expand Down
2 changes: 1 addition & 1 deletion build.macos64ARMv8/common/Makefile.vm
Expand Up @@ -123,7 +123,7 @@ DEBUGVM=-DDEBUGVM=0 -DNDEBUG=1 # Define NDEBUG for production to exclude asserts
endif

TZ:=$(shell date +%Z)
DEFS:= $(COGDEFS) -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
DEFS:= -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
-DUSE_INLINE_MEMORY_ACCESSORS -D'TZ="$(TZ)"' \
-DUSE_METAL=1 -DHAVE_CONFIG_H=1
XDEFS:= -DSQUEAK_BUILTIN_PLUGIN
Expand Down
2 changes: 1 addition & 1 deletion build.macos64x64/common/Makefile.vm
Expand Up @@ -123,7 +123,7 @@ DEBUGVM=-DDEBUGVM=0 -DNDEBUG=1 # Define NDEBUG for production to exclude asserts
endif

TZ:=$(shell date +%Z)
DEFS:= $(COGDEFS) -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
DEFS:= -DUSE_GLOBAL_STRUCT=0 -DNO_ISNAN=1 \
-DUSE_INLINE_MEMORY_ACCESSORS -D'TZ="$(TZ)"' \
-DUSE_METAL=1 -DHAVE_CONFIG_H=1
XDEFS:= -DSQUEAK_BUILTIN_PLUGIN
Expand Down
Expand Up @@ -92,7 +92,7 @@ - (const char *) getAttribute:(sqInt)indexNumber {
else {
switch (indexNumber) {
case 0:
return [[[[NSBundle mainBundle] executablePath] precomposedStringWithCanonicalMapping] UTF8String];
return fullExeName;

case 1:
return [self getImageName];
Expand Down
3 changes: 3 additions & 0 deletions platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.h
Expand Up @@ -46,6 +46,9 @@
#import "sqSqueakInfoPlistInterface.h"
#import "sqSqueakSoundCoreAudio.h"

extern char *fullExeName; /* full VM path /Applications/Sq.../MacOS/Squeak */
extern char *exeName; /* short vm name, e.g. "Squeak" */

@interface sqSqueakMainApplication : NSObject {
NSURL* vmPathStringURL;
NSURL* imageNameURL;
Expand Down
7 changes: 7 additions & 0 deletions platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m
Expand Up @@ -53,6 +53,8 @@ Some of this code was funded via a grant from the European Smalltalk User Group

extern BOOL gSqueakHeadless;
extern sqSqueakAppDelegate *gDelegateApp;
char *fullExeName;
char *exeName;

@implementation sqSqueakMainApplication;
@synthesize vmPathStringURL;
Expand Down Expand Up @@ -116,6 +118,11 @@ - (void) doMemorySetup {
}

- (void) parseUnixArgs {
fullExeName = [[[[NSBundle mainBundle] executablePath]
precomposedStringWithCanonicalMapping] UTF8String];
exeName = strrchr(fullExeName,'/')
? strrchr(fullExeName,'/') + 1
: fullExeName;
}

- (void) setupMenus {
Expand Down
1 change: 1 addition & 0 deletions platforms/iOS/vm/OSX/sqSqueakOSXApplication.m
Expand Up @@ -159,6 +159,7 @@ - (void) setupSoundLogic {
}

- (void) parseUnixArgs {
[super parseUnixArgs];
NSProcessInfo *p = [NSProcessInfo processInfo];
[self parseArgs: [p arguments]];
[self parseEnv: [p environment]];
Expand Down
4 changes: 3 additions & 1 deletion platforms/unix/vm/sqUnixSpurMemory.c
Expand Up @@ -37,7 +37,9 @@
# include <sys/mman.h>
#endif
#if DUAL_MAPPED_CODE_ZONE
# include <sys/prctl.h>
# if !__APPLE__
# include <sys/prctl.h>
# endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h> /* For mode constants */
#endif
Expand Down

0 comments on commit 74afafc

Please sign in to comment.