From 8421cad3c5d31ca08c26cf157a652e2cfedd415d Mon Sep 17 00:00:00 2001 From: Geoff Cant Date: Tue, 12 Jan 2010 22:22:13 +1300 Subject: Allow configure to enable_hipe for darwin/amd64 builds --- erts/configure.in | 1 - 1 file changed, 1 deletion(-) (limited to 'erts') diff --git a/erts/configure.in b/erts/configure.in index 1892a7a1f4..1928000ef5 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -316,7 +316,6 @@ if test X${enable_darwin_64bit} = Xyes; then esac fi if test X${enable_darwin_64bit} = Xyes -o X${enable_m64_build} = Xyes; then - enable_hipe=no case $CFLAGS in *-m64*) ;; -- cgit v1.2.3 From 022fa2dd03a1e632c401e7c08aab8a184717847b Mon Sep 17 00:00:00 2001 From: Geoff Cant Date: Tue, 12 Jan 2010 22:24:36 +1300 Subject: Automatically enable hipe for darwin/amd64 builds --- erts/configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'erts') diff --git a/erts/configure.in b/erts/configure.in index 1928000ef5..a9df8980c1 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -2142,7 +2142,7 @@ if test "$cross_compiling" != "yes" && test X${enable_hipe} != Xno; then AC_MSG_NOTICE([HiPE disabled as no valid m4 is found in PATH]) else case "$ARCH-$OPSYS" in - x86-linux|amd64-linux|ppc-linux|ppc-darwin|arm-linux|amd64-freebsd|x86-freebsd|x86-sol2|amd64-sol2|ultrasparc-linux) + x86-linux|amd64-linux|x86-darwin*|amd64-darwin*|ppc-linux|ppc-darwin|arm-linux|amd64-freebsd|x86-freebsd|x86-sol2|amd64-sol2|ultrasparc-linux) enable_hipe=yes ;; esac -- cgit v1.2.3 From d17dd27c7d9b98f2cfd243fadd58a477c3edd7f1 Mon Sep 17 00:00:00 2001 From: Geoff Cant Date: Tue, 12 Jan 2010 22:25:51 +1300 Subject: Porting x86 darwin fixes to amd64 darwin hipe asm/m4 code Compared to GNU as, Mac OS X's assembler uses different directives for text and global sections, and omits type and size directives entirely. We also need to mangle symbol names in order to allow linking with C object files. --- erts/emulator/hipe/hipe_amd64_asm.m4 | 23 ++++ erts/emulator/hipe/hipe_amd64_bifs.m4 | 216 +++++++++++++++++----------------- erts/emulator/hipe/hipe_amd64_glue.S | 106 ++++++++--------- 3 files changed, 184 insertions(+), 161 deletions(-) (limited to 'erts') diff --git a/erts/emulator/hipe/hipe_amd64_asm.m4 b/erts/emulator/hipe/hipe_amd64_asm.m4 index 9ce9b4fc5b..8e3faaa569 100644 --- a/erts/emulator/hipe/hipe_amd64_asm.m4 +++ b/erts/emulator/hipe/hipe_amd64_asm.m4 @@ -36,6 +36,29 @@ define(SIMULATE_NSP,0)dnl change to 1 to simulate call/ret insns `#define AMD64_LEAF_WORDS 'LEAF_WORDS `#define LEAF_WORDS 'LEAF_WORDS +/* + * Workarounds for Darwin. + */ +ifelse(OPSYS,darwin,`` +/* Darwin */ +#define TEXT .text +#define JOIN(X,Y) X##Y +#define CSYM(NAME) JOIN(_,NAME) +#define ASYM(NAME) CSYM(NAME) +#define GLOBAL(NAME) .globl NAME +#define SET_SIZE(NAME) /*empty*/ +#define TYPE_FUNCTION(NAME) /*empty*/ +'',`` +/* Not Darwin */ +#define TEXT .section ".text" +#define CSYM(NAME) NAME +#define ASYM(NAME) NAME +#define GLOBAL(NAME) .global NAME +#define SET_SIZE(NAME) .size NAME,.-NAME +#define TYPE_FUNCTION(NAME) .type NAME,@function +'')dnl + + /* * Reserved registers. */ diff --git a/erts/emulator/hipe/hipe_amd64_bifs.m4 b/erts/emulator/hipe/hipe_amd64_bifs.m4 index 66fd167f47..32eada24cf 100644 --- a/erts/emulator/hipe/hipe_amd64_bifs.m4 +++ b/erts/emulator/hipe/hipe_amd64_bifs.m4 @@ -46,17 +46,17 @@ define(standard_bif_interface_1, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi NBIF_ARG(%rsi,1,0) /* make the call on the C stack */ SWITCH_ERLANG_TO_C - call $2 + call CSYM($2) TEST_GOT_MBUF SWITCH_C_TO_ERLANG @@ -65,18 +65,18 @@ $1: jz nbif_1_simple_exception NBIF_RET(1) HANDLE_GOT_MBUF(1) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(standard_bif_interface_2, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi NBIF_ARG(%rsi,2,0) @@ -84,7 +84,7 @@ $1: /* make the call on the C stack */ SWITCH_ERLANG_TO_C - call $2 + call CSYM($2) TEST_GOT_MBUF SWITCH_C_TO_ERLANG @@ -93,18 +93,18 @@ $1: jz nbif_2_simple_exception NBIF_RET(2) HANDLE_GOT_MBUF(2) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(standard_bif_interface_3, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi NBIF_ARG(%rsi,3,0) @@ -113,7 +113,7 @@ $1: /* make the call on the C stack */ SWITCH_ERLANG_TO_C - call $2 + call CSYM($2) TEST_GOT_MBUF SWITCH_C_TO_ERLANG @@ -122,8 +122,8 @@ $1: jz nbif_3_simple_exception NBIF_RET(3) HANDLE_GOT_MBUF(3) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') /* @@ -136,16 +136,16 @@ define(fail_bif_interface_0, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi /* make the call on the C stack */ SWITCH_ERLANG_TO_C - call $2 + call CSYM($2) TEST_GOT_MBUF SWITCH_C_TO_ERLANG @@ -154,8 +154,8 @@ $1: jz nbif_0_simple_exception NBIF_RET(0) HANDLE_GOT_MBUF(0) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') /* @@ -172,59 +172,59 @@ define(nofail_primop_interface_0, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi /* make the call on the C stack */ SWITCH_ERLANG_TO_C - call $2 + call CSYM($2) TEST_GOT_MBUF SWITCH_C_TO_ERLANG /* return */ NBIF_RET(0) HANDLE_GOT_MBUF(0) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(nofail_primop_interface_1, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi NBIF_ARG(%rsi,1,0) /* make the call on the C stack */ SWITCH_ERLANG_TO_C - call $2 + call CSYM($2) TEST_GOT_MBUF SWITCH_C_TO_ERLANG /* return */ NBIF_RET(1) HANDLE_GOT_MBUF(1) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(nofail_primop_interface_2, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi NBIF_ARG(%rsi,2,0) @@ -232,25 +232,25 @@ $1: /* make the call on the C stack */ SWITCH_ERLANG_TO_C - call $2 + call CSYM($2) TEST_GOT_MBUF SWITCH_C_TO_ERLANG /* return */ NBIF_RET(2) HANDLE_GOT_MBUF(2) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(nofail_primop_interface_3, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi NBIF_ARG(%rsi,3,0) @@ -259,15 +259,15 @@ $1: /* make the call on the C stack */ SWITCH_ERLANG_TO_C - call $2 + call CSYM($2) TEST_GOT_MBUF SWITCH_C_TO_ERLANG /* return */ NBIF_RET(3) HANDLE_GOT_MBUF(3) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') /* @@ -285,55 +285,55 @@ define(nocons_nofail_primop_interface_0, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi /* make the call on the C stack */ SWITCH_ERLANG_TO_C_QUICK - call $2 + call CSYM($2) SWITCH_C_TO_ERLANG_QUICK /* return */ NBIF_RET(0) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(nocons_nofail_primop_interface_1, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi NBIF_ARG(%rsi,1,0) /* make the call on the C stack */ SWITCH_ERLANG_TO_C_QUICK - call $2 + call CSYM($2) SWITCH_C_TO_ERLANG_QUICK /* return */ NBIF_RET(1) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(nocons_nofail_primop_interface_2, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi NBIF_ARG(%rsi,2,0) @@ -341,23 +341,23 @@ $1: /* make the call on the C stack */ SWITCH_ERLANG_TO_C_QUICK - call $2 + call CSYM($2) SWITCH_C_TO_ERLANG_QUICK /* return */ NBIF_RET(2) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(nocons_nofail_primop_interface_3, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi NBIF_ARG(%rsi,3,0) @@ -366,23 +366,23 @@ $1: /* make the call on the C stack */ SWITCH_ERLANG_TO_C_QUICK - call $2 + call CSYM($2) SWITCH_C_TO_ERLANG_QUICK /* return */ NBIF_RET(3) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(nocons_nofail_primop_interface_5, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ movq P, %rdi NBIF_ARG(%rsi,5,0) @@ -393,13 +393,13 @@ $1: /* make the call on the C stack */ SWITCH_ERLANG_TO_C_QUICK - call $2 + call CSYM($2) SWITCH_C_TO_ERLANG_QUICK /* return */ NBIF_RET(5) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') /* @@ -417,74 +417,74 @@ define(noproc_primop_interface_0, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* make the call on the C stack */ SWITCH_ERLANG_TO_C_QUICK - call $2 + call CSYM($2) SWITCH_C_TO_ERLANG_QUICK /* return */ NBIF_RET(0) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(noproc_primop_interface_1, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ NBIF_ARG(%rdi,1,0) /* make the call on the C stack */ SWITCH_ERLANG_TO_C_QUICK - call $2 + call CSYM($2) SWITCH_C_TO_ERLANG_QUICK /* return */ NBIF_RET(1) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(noproc_primop_interface_2, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ NBIF_ARG(%rdi,2,0) NBIF_ARG(%rsi,2,1) /* make the call on the C stack */ SWITCH_ERLANG_TO_C_QUICK - call $2 + call CSYM($2) SWITCH_C_TO_ERLANG_QUICK /* return */ NBIF_RET(2) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(noproc_primop_interface_3, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ NBIF_ARG(%rdi,3,0) NBIF_ARG(%rsi,3,1) @@ -492,23 +492,23 @@ $1: /* make the call on the C stack */ SWITCH_ERLANG_TO_C_QUICK - call $2 + call CSYM($2) SWITCH_C_TO_ERLANG_QUICK /* return */ NBIF_RET(3) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') define(noproc_primop_interface_5, ` #ifndef HAVE_$1 #`define' HAVE_$1 - .section ".text" + TEXT .align 4 - .global $1 -$1: + GLOBAL(ASYM($1)) +ASYM($1): /* set up the parameters */ NBIF_ARG(%rdi,5,0) NBIF_ARG(%rsi,5,1) @@ -518,13 +518,13 @@ $1: /* make the call on the C stack */ SWITCH_ERLANG_TO_C_QUICK - call $2 + call CSYM($2) SWITCH_C_TO_ERLANG_QUICK /* return */ NBIF_RET(5) - .size $1,.-$1 - .type $1,@function + SET_SIZE(ASYM($1)) + TYPE_FUNCTION(ASYM($1)) #endif') /* diff --git a/erts/emulator/hipe/hipe_amd64_glue.S b/erts/emulator/hipe/hipe_amd64_glue.S index 872c5dc9e3..c9221bac68 100644 --- a/erts/emulator/hipe/hipe_amd64_glue.S +++ b/erts/emulator/hipe/hipe_amd64_glue.S @@ -56,16 +56,16 @@ /* switch to native stack */ \ SWITCH_C_TO_ERLANG - .section ".text" + TEXT /* * int x86_call_to_native(Process *p); * Emulated code recursively calls native code. */ .align 4 - .global x86_call_to_native - .global nbif_return -x86_call_to_native: + GLOBAL(CSYM(x86_call_to_native)) + GLOBAL(ASYM(nbif_return)) +CSYM(x86_call_to_native): ENTER_FROM_C /* get argument registers */ LOAD_ARG_REGS @@ -77,7 +77,7 @@ x86_call_to_native: * * This is where native code returns to emulated code. */ -nbif_return: +ASYM(nbif_return): movq %rax, P_ARG0(P) # save retval movl $HIPE_MODE_SWITCH_RES_RETURN, %eax /* FALLTHROUGH to .flush_exit @@ -118,8 +118,8 @@ nbif_return: * XXX: Different stubs for different number of register parameters? */ .align 4 - .global nbif_callemu -nbif_callemu: + GLOBAL(ASYM(nbif_callemu)) +ASYM(nbif_callemu): STORE_ARG_REGS movl $HIPE_MODE_SWITCH_RES_CALL, %eax jmp .suspend_exit @@ -128,8 +128,8 @@ nbif_callemu: * nbif_apply */ .align 4 - .global nbif_apply -nbif_apply: + GLOBAL(ASYM(nbif_apply)) +ASYM(nbif_apply): STORE_ARG_REGS movl $HIPE_MODE_SWITCH_RES_APPLY, %eax jmp .suspend_exit @@ -145,8 +145,8 @@ nbif_apply: */ #if NR_ARG_REGS >= 6 .align 4 - .global nbif_ccallemu6 -nbif_ccallemu6: + GLOBAL(ASYM(nbif_ccallemu6)) +ASYM(nbif_ccallemu6): movq ARG5, P_ARG5(P) #if NR_ARG_REGS > 6 movq ARG6, ARG5 @@ -158,8 +158,8 @@ nbif_ccallemu6: #if NR_ARG_REGS >= 5 .align 4 - .global nbif_ccallemu5 -nbif_ccallemu5: + GLOBAL(ASYM(nbif_ccallemu5)) +ASYM(nbif_ccallemu5): movq ARG4, P_ARG4(P) #if NR_ARG_REGS > 5 movq ARG5, ARG4 @@ -171,8 +171,8 @@ nbif_ccallemu5: #if NR_ARG_REGS >= 4 .align 4 - .global nbif_ccallemu4 -nbif_ccallemu4: + GLOBAL(ASYM(nbif_ccallemu4)) +ASYM(nbif_ccallemu4): movq ARG3, P_ARG3(P) #if NR_ARG_REGS > 4 movq ARG4, ARG3 @@ -184,8 +184,8 @@ nbif_ccallemu4: #if NR_ARG_REGS >= 3 .align 4 - .global nbif_ccallemu3 -nbif_ccallemu3: + GLOBAL(ASYM(nbif_ccallemu3)) +ASYM(nbif_ccallemu3): movq ARG2, P_ARG2(P) #if NR_ARG_REGS > 3 movq ARG3, ARG2 @@ -197,8 +197,8 @@ nbif_ccallemu3: #if NR_ARG_REGS >= 2 .align 4 - .global nbif_ccallemu2 -nbif_ccallemu2: + GLOBAL(ASYM(nbif_ccallemu2)) +ASYM(nbif_ccallemu2): movq ARG1, P_ARG1(P) #if NR_ARG_REGS > 2 movq ARG2, ARG1 @@ -210,8 +210,8 @@ nbif_ccallemu2: #if NR_ARG_REGS >= 1 .align 4 - .global nbif_ccallemu1 -nbif_ccallemu1: + GLOBAL(ASYM(nbif_ccallemu1)) +ASYM(nbif_ccallemu1): movq ARG0, P_ARG0(P) #if NR_ARG_REGS > 1 movq ARG1, ARG0 @@ -222,8 +222,8 @@ nbif_ccallemu1: #endif .align 4 - .global nbif_ccallemu0 -nbif_ccallemu0: + GLOBAL(ASYM(nbif_ccallemu0)) +ASYM(nbif_ccallemu0): /* We use %rsi not ARG0 here because ARG0 is not defined when NR_ARG_REGS == 0. */ #if NR_ARG_REGS == 0 @@ -237,8 +237,8 @@ nbif_ccallemu0: * This is where native code suspends. */ .align 4 - .global nbif_suspend_0 -nbif_suspend_0: + GLOBAL(ASYM(nbif_suspend_0)) +ASYM(nbif_suspend_0): movl $HIPE_MODE_SWITCH_RES_SUSPEND, %eax jmp .suspend_exit @@ -246,8 +246,8 @@ nbif_suspend_0: * Suspend from a receive (waiting for a message) */ .align 4 - .global nbif_suspend_msg -nbif_suspend_msg: + GLOBAL(ASYM(nbif_suspend_msg)) +ASYM(nbif_suspend_msg): movl $HIPE_MODE_SWITCH_RES_WAIT, %eax jmp .suspend_exit @@ -257,8 +257,8 @@ nbif_suspend_msg: * else { return 0; } */ .align 4 - .global nbif_suspend_msg_timeout -nbif_suspend_msg_timeout: + GLOBAL(ASYM(nbif_suspend_msg_timeout)) +ASYM(nbif_suspend_msg_timeout): movq P_FLAGS(P), %rax /* this relies on F_TIMO (1<<2) fitting in a byte */ testb $F_TIMO, %al # F_TIMO set? @@ -275,8 +275,8 @@ nbif_suspend_msg_timeout: * Emulated code returns to its native code caller. */ .align 4 - .global x86_return_to_native -x86_return_to_native: + GLOBAL(CSYM(x86_return_to_native)) +CSYM(x86_return_to_native): ENTER_FROM_C /* get return value */ movq P_ARG0(P), %rax @@ -292,8 +292,8 @@ x86_return_to_native: * Emulated code tailcalls native code. */ .align 4 - .global x86_tailcall_to_native -x86_tailcall_to_native: + GLOBAL(CSYM(x86_tailcall_to_native)) +CSYM(x86_tailcall_to_native): ENTER_FROM_C /* get argument registers */ LOAD_ARG_REGS @@ -305,8 +305,8 @@ x86_tailcall_to_native: * Emulated code throws an exception to its native code caller. */ .align 4 - .global x86_throw_to_native -x86_throw_to_native: + GLOBAL(CSYM(x86_throw_to_native)) +CSYM(x86_throw_to_native): ENTER_FROM_C /* invoke the handler */ jmp *P_NCALLEE(P) # set by hipe_find_handler() @@ -315,15 +315,15 @@ x86_throw_to_native: * This is the default exception handler for native code. */ .align 4 - .global nbif_fail -nbif_fail: + GLOBAL(ASYM(nbif_fail)) +ASYM(nbif_fail): movl $HIPE_MODE_SWITCH_RES_THROW, %eax jmp .flush_exit - .global nbif_0_gc_after_bif - .global nbif_1_gc_after_bif - .global nbif_2_gc_after_bif - .global nbif_3_gc_after_bif + GLOBAL(nbif_0_gc_after_bif) + GLOBAL(nbif_1_gc_after_bif) + GLOBAL(nbif_2_gc_after_bif) + GLOBAL(nbif_3_gc_after_bif) .align 4 nbif_0_gc_after_bif: xorl %edx, %edx @@ -346,7 +346,7 @@ nbif_3_gc_after_bif: subq $(16-8), %rsp movq P, %rdi movq %rax, %rsi - call erts_gc_after_bif_call + call CSYM(erts_gc_after_bif_call) addq $(16-8), %rsp movl $0, P_NARITY(P) # Note: narity is a 32-bit field ret @@ -356,10 +356,10 @@ nbif_3_gc_after_bif: * exceptional condition. * The stack/heap registers were just read from P. */ - .global nbif_0_simple_exception - .global nbif_1_simple_exception - .global nbif_2_simple_exception - .global nbif_3_simple_exception + GLOBAL(nbif_0_simple_exception) + GLOBAL(nbif_1_simple_exception) + GLOBAL(nbif_2_simple_exception) + GLOBAL(nbif_3_simple_exception) .align 4 nbif_0_simple_exception: xorl %eax, %eax @@ -389,7 +389,7 @@ nbif_3_simple_exception: /* find and prepare to invoke the handler */ SWITCH_ERLANG_TO_C_QUICK # The cached state is clean and need not be saved. movq P, %rdi - call hipe_handle_exception # Note: hipe_handle_exception() conses + call CSYM(hipe_handle_exception) # Note: hipe_handle_exception() conses SWITCH_C_TO_ERLANG # %rsp updated by hipe_find_handler() /* now invoke the handler */ jmp *P_NCALLEE(P) # set by hipe_find_handler() @@ -408,15 +408,15 @@ nbif_3_simple_exception: * nbif_stack_trap_ra: trap return address for maintaining * the gray/white stack boundary */ - .global nbif_stack_trap_ra + GLOBAL(ASYM(nbif_stack_trap_ra)) .align 4 -nbif_stack_trap_ra: # a return address, not a function +ASYM(nbif_stack_trap_ra): # a return address, not a function # This only handles a single return value. # If we have more, we need to save them in the PCB. movq %rax, TEMP_RV # save retval SWITCH_ERLANG_TO_C_QUICK movq P, %rdi - call hipe_handle_stack_trap # must not cons; preserves TEMP_RV + call CSYM(hipe_handle_stack_trap) # must not cons; preserves TEMP_RV movq %rax, %rdx # original RA SWITCH_C_TO_ERLANG_QUICK movq TEMP_RV, %rax # restore retval @@ -425,15 +425,15 @@ nbif_stack_trap_ra: # a return address, not a function /* * nbif_inc_stack_0 */ - .global nbif_inc_stack_0 + GLOBAL(ASYM(nbif_inc_stack_0)) .align 4 -nbif_inc_stack_0: +ASYM(nbif_inc_stack_0): SWITCH_ERLANG_TO_C_QUICK STORE_ARG_REGS movq P, %rdi # hipe_inc_nstack reads and writes NSP and NSP_LIMIT, # but does not access HP or FCALLS (or the non-amd64 NRA). - call hipe_inc_nstack + call CSYM(hipe_inc_nstack) LOAD_ARG_REGS SWITCH_C_TO_ERLANG_QUICK NSP_RET0 -- cgit v1.2.3 From 56c0170c68a83634c6e2d955723b92c70b117c64 Mon Sep 17 00:00:00 2001 From: Geoff Cant Date: Tue, 12 Jan 2010 22:30:04 +1300 Subject: Fix hipe memory allocation problems on darwin/amd64 HiPE on amd64 needs to be able to allocate memory in the 0x20000000+ range so that compiled code will be addressable with 32bit pointers (when sign extended). By default, when building 64bit executables on OS X, PAGEZERO occupies the first 4GB of virtual memory. The PAGEZERO segment cannot be mmap(ed) or vm_allocate(d) into. To avoid this problem we use the -pagezero_size linker flag to reduce the size of PAGEZERO and free up the 0x20000000+ space. --- erts/emulator/Makefile.in | 3 +++ 1 file changed, 3 insertions(+) (limited to 'erts') diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index bc846d1e3d..97c21ce28f 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -167,6 +167,9 @@ ifeq ($(OPSYS),linux) ppcBEAMLDFLAGS=-Wl,-m,elf32ppc ppc64BEAMLDFLAGS=-Wl,-m,elf64ppc,-T,hipe/elf64ppc.x endif +ifeq ($(OPSYS),darwin) +amd64BEAMLDFLAGS=-pagezero_size 0x10000000 +endif HIPEBEAMLDFLAGS=$($(ARCH)BEAMLDFLAGS) endif -- cgit v1.2.3