diff options
Diffstat (limited to 'unix')
-rw-r--r-- | unix/Makefile | 6 | ||||
-rw-r--r-- | unix/gccollect.c | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/unix/Makefile b/unix/Makefile index d5ad928b34..fd98d2ced2 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -58,10 +58,14 @@ endif # On OSX, 'gcc' is a symlink to clang unless a real gcc is installed. # The unix port of micropython on OSX must be compiled with clang, -# while cross-compile ports require gcc, so we test here for OSX and +# while cross-compile ports require gcc, so we test here for OSX and # if necessary override the value of 'CC' set in py/mkenv.mk ifeq ($(UNAME_S),Darwin) +ifeq ($(MICROPY_FORCE_32BIT),1) +CC = clang -m32 +else CC = clang +endif # Use clang syntax for map file LDFLAGS_ARCH = -Wl,-map,$@.map -Wl,-dead_strip else diff --git a/unix/gccollect.c b/unix/gccollect.c index 397c4ffe1c..4ec8c2bf54 100644 --- a/unix/gccollect.c +++ b/unix/gccollect.c @@ -80,6 +80,18 @@ STATIC void gc_helper_get_regs(regs_t arr) { register long esi asm ("esi"); register long edi asm ("edi"); register long ebp asm ("ebp"); +#ifdef __clang__ + // TODO: + // This is dirty workaround for Clang. It tries to get around + // uncompliant (wrt to GCC) behavior of handling register variables. + // Application of this patch here is random, and done only to unbreak + // MacOS build. Better, cross-arch ways to deal with Clang issues should + // be found. + asm("" : "=r"(ebx)); + asm("" : "=r"(esi)); + asm("" : "=r"(edi)); + asm("" : "=r"(ebp)); +#endif arr[0] = ebx; arr[1] = esi; arr[2] = edi; |