summaryrefslogtreecommitdiff
path: root/translate/grt/config
diff options
context:
space:
mode:
authorgingold2008-01-15 05:53:39 +0000
committergingold2008-01-15 05:53:39 +0000
commiteb4d862a6b8ac3991dac9a8bc2fb0b9d9830e951 (patch)
tree3944b708fedbc9f955f09f947cd4377c286a9127 /translate/grt/config
parent861828b455955858709dfda217af0188cfdef799 (diff)
downloadghdl-eb4d862a6b8ac3991dac9a8bc2fb0b9d9830e951.tar.gz
ghdl-eb4d862a6b8ac3991dac9a8bc2fb0b9d9830e951.tar.bz2
ghdl-eb4d862a6b8ac3991dac9a8bc2fb0b9d9830e951.zip
synchronize: add support for MacOSX, fix bogus type conversion
Diffstat (limited to 'translate/grt/config')
-rw-r--r--translate/grt/config/chkstk.S12
-rw-r--r--translate/grt/config/i386.S43
2 files changed, 34 insertions, 21 deletions
diff --git a/translate/grt/config/chkstk.S b/translate/grt/config/chkstk.S
index 79abfb2..3fa5cc6 100644
--- a/translate/grt/config/chkstk.S
+++ b/translate/grt/config/chkstk.S
@@ -3,10 +3,16 @@
.text
- /* Function called to loop on the process. */
+#ifdef __APPLE__
+#define __chkstk ___chkstk
+#endif
+
+ /* Function called to loop on the process. */
.align 4
+#ifdef __ELF__
.type __chkstk,@function
- .global __chkstk
+#endif
+ .globl __chkstk
__chkstk:
testl %eax,%eax
je 0f
@@ -15,6 +21,8 @@ __chkstk:
jmp *(%esp,%eax)
0:
ret
+#ifdef __ELF__
.size __chkstk, . - __chkstk
+#endif
.ident "Written by T.Gingold"
diff --git a/translate/grt/config/i386.S b/translate/grt/config/i386.S
index fbd8954..2490ea1 100644
--- a/translate/grt/config/i386.S
+++ b/translate/grt/config/i386.S
@@ -21,21 +21,30 @@
.text
- /* Function called to loop on the process. */
- .align 4
- .type grt_stack_loop,@function
-grt_stack_loop:
+#ifdef __ELF__
+#define ENTRY(func) .align 4; .globl func; .type func,@function; func:
+#define END(func) .size func, . - func
+#define NAME(name) name
+#elif __APPLE__
+#define ENTRY(func) .align 4; .globl _##func; _##func:
+#define END(func)
+#define NAME(name) _##name
+#else
+#define ENTRY(func) .align 4; func:
+#define END(func)
+#define NAME(name) name
+#endif
+
+ /* Function called to loop on the process. */
+ENTRY(grt_stack_loop)
call *4(%esp)
- jmp grt_stack_loop
- .size grt_stack_loop, . - grt_stack_loop
+ jmp NAME(grt_stack_loop)
+END(grt_stack_loop)
/* function Stack_Create (Func : Address; Arg : Address)
return Stack_Type;
*/
- .align 4
- .globl grt_stack_create
- .type grt_stack_create,@function
-grt_stack_create:
+ENTRY(grt_stack_create)
/* Standard prologue. */
pushl %ebp
movl %esp,%ebp
@@ -43,7 +52,7 @@ grt_stack_create:
subl $8,%esp
/* Allocate the stack, and exit in case of failure */
- call grt_stack_allocate
+ call NAME(grt_stack_allocate)
testl %eax,%eax
je .Ldone
@@ -58,7 +67,7 @@ grt_stack_create:
movl 12(%ebp), %ecx
movl %ecx, -8(%eax)
/* The return function. */
- movl $grt_stack_loop, -12(%eax)
+ movl $NAME(grt_stack_loop), -12(%eax)
/* The context. */
movl %ebx, -16(%eax)
movl %esi, -20(%eax)
@@ -72,16 +81,12 @@ grt_stack_create:
.Ldone:
leave
ret
- .size grt_stack_create,. - grt_stack_create
-
+END(grt_stack_create)
- .align 4
- .globl grt_stack_switch
/* Arguments: TO, FROM
Both are pointers to a stack_context. */
- .type grt_stack_switch,@function
-grt_stack_switch:
+ENTRY(grt_stack_switch)
/* TO -> ECX. */
movl 4(%esp), %ecx
/* FROM -> EDX. */
@@ -102,7 +107,7 @@ grt_stack_switch:
popl %ebx
/* Run. */
ret
- .size grt_stack_switch, . - grt_stack_switch
+END(grt_stack_switch)
.ident "Written by T.Gingold"