Finally: Mac Intel patches

Mikael Pettersson <>
Fri Aug 25 00:13:55 CEST 2006


On Thu, 24 Aug 2006 21:03:42 +0100, Joel Reymont wrote:
>> I've only seen the "bx is clobbered" error with gcc -fPIC before,
>> so I assume Darwin does that by default?
>
>I think HiPE is compiled with -mdynamic-no-pic on my machine. Also, I  
>still get errors:
>
>gcc -mdynamic-no-pic -g -O2 -I/Users/joelr/temp/otp-0804/erts/i386- 
>apple-darwin8.7.1  -no-cpp-precomp   -DHYBRID -DHAVE_CONFIG_H -Wall - 
>Wstrict-prototypes -Wmissing-prototypes -DUSE_THREADS  -D_THREAD_SAFE  
>-D_REENTRANT  -Ibeam -Isys/unix -Isys/common -Ii386-apple-darwin8.7.1/ 
>opt/hybrid -Ii386-apple-darwin8.7.1 -Izlib -Ihipe -I../include/ 
>internal -I../include/internal/i386-apple-darwin8.7.1 -c sys/unix/ 
>sys_float.c -o obj/i386-apple-darwin8.7.1/opt/hybrid/sys_float.o
>sys/unix/sys_float.c: In function 'skip_sse2_insn':
>sys/unix/sys_float.c:337: error: request for member 'ss' in something  
>not a structure or union
>sys/unix/sys_float.c:431: error: request for member 'ss' in something  
>not a structure or union
>sys/unix/sys_float.c: In function 'fpe_sig_action':
>sys/unix/sys_float.c:490: warning: passing argument 1 of  
>'skip_sse2_insn' from incompatible pointer type
>make[3]: *** [obj/i386-apple-darwin8.7.1/opt/hybrid/sys_float.o] Error 1
>make[2]: *** [opt] Error 2
>make[1]: *** [hybrid] Error 2
>make: *** [emulator] Error 2

My fault again. While trying to clean up sys_float.c
I missed that mcontext_t is a pointer on Darwin, where
it is a struct on Linux, so the 'mcontext_t*' formal
parameter to skip_sse2_insn() was wrong for Darwin.
The patch below (patch-otp-0804-9-darwin-x86-sys_float-fix)
should fix this.

--- otp-0804/erts/emulator/sys/unix/sys_float.c.~1~	2006-08-24 23:09:18.000000000 +0200
+++ otp-0804/erts/emulator/sys/unix/sys_float.c	2006-08-24 23:48:44.000000000 +0200
@@ -326,13 +326,16 @@ static void unmask_fpe(void)
 
 #if defined(__linux__) && defined(__x86_64__)
 #define mc_pc(mc)	((mc)->gregs[REG_RIP])
+typedef mcontext_t *erts_mcontext_ptr_t;
 #elif defined(__linux__) && defined(__i386__)
 #define mc_pc(mc)	((mc)->gregs[REG_EIP])
+typedef mcontext_t *erts_mcontext_ptr_t;
 #elif defined(__DARWIN__) && defined(__i386__)
 #define mc_pc(mc)	((mc)->ss.eip)
+typedef mcontext_t erts_mcontext_ptr_t;
 #endif
 
-static void skip_sse2_insn(mcontext_t *mc)
+static void skip_sse2_insn(erts_mcontext_ptr_t mc)
 {
     unsigned char *pc0 = (unsigned char*)mc_pc(mc);
     unsigned char *pc = pc0;



More information about the erlang-questions mailing list