diff --git a/src/x86/cpu-regs.h b/src/x86/cpu-regs.h index 12fbfa43..21876b9a 100644 --- a/src/x86/cpu-regs.h +++ b/src/x86/cpu-regs.h @@ -129,7 +129,7 @@ #define ENTRY(x) .globl _UNDER(x); .balign 16; _UNDER(x)##: -#if !__PIC__ +#if !__PIC__ || (__APPLE__ && !__LP64__) // For non-Position Independent Code, the assembly is relatively simple... @@ -161,7 +161,7 @@ # define REG2MEM(op,x,sym) op x, _UNDER(sym)(%rip) // op register-to-memory # define MEM2REG(op,sym,x) op _UNDER(sym)(%rip), x // op memory-to-register # elif __LP64__ -# define _AT_PLT @PLT +# define _AT_PLT @PLT # define _LEA(sym) movq _UNDER(sym)@GOTPCREL(%rip), _X8 # define CALL_IND0(fn) callq *_UNDER(fn)_AT_PLT # define _2MEM(op,sym) _LEA(sym); op (_X8) // op to-memory diff --git a/src/x86/cpu.S b/src/x86/cpu.S index 15ee4c4e..c0f1919b 100644 --- a/src/x86/cpu.S +++ b/src/x86/cpu.S @@ -16,7 +16,7 @@ #include "cpu-regs.h" #include "vm.h" -#if !__PIC__ +#if !__PIC__ || (__APPLE__ && !__LP64__) # define SAVE_Y_REG() \ REG2MEM(movb, Y_Reg, cpu65_y) # define _POP_PICREG() @@ -2222,7 +2222,7 @@ ENTRY(cpu65_run) // NOTE: should we be also preserving r12-r15? #endif -#if __PIC__ && __i386__ +#if __PIC__ && __i386__ && !__APPLE__ calll .Lget_pc_thunk0 .Lget_pc_thunk0: _POP_PICREG()