port to cygwin-64

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14337 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Damien Doligez 2013-12-03 14:43:02 +00:00
parent 0f6873a183
commit aa58e55958
6 changed files with 26 additions and 16 deletions

View File

@ -786,7 +786,8 @@ partialclean::
# Check that the stack limit is reasonable.
checkstack:
@if $(BYTECC) -o tools/checkstack tools/checkstack.c; \
@if $(BYTECC) $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) \
-o tools/checkstack tools/checkstack.c; \
then tools/checkstack; \
else :; \
fi

View File

@ -22,6 +22,7 @@ open Emitaux
let macosx = (Config.system = "macosx")
let mingw64 = (Config.system = "mingw64")
let cygwin = (Config.system = "cygwin")
let fp = Config.with_frame_pointers
@ -61,17 +62,17 @@ let emit_symbol s =
Emitaux.emit_symbol '$' s
let emit_call s =
if !Clflags.dlcode && not macosx && not mingw64
if !Clflags.dlcode && not macosx && not mingw64 && not cygwin
then `call {emit_symbol s}@PLT`
else `call {emit_symbol s}`
let emit_jump s =
if !Clflags.dlcode && not macosx && not mingw64
if !Clflags.dlcode && not macosx && not mingw64 && not cygwin
then `jmp {emit_symbol s}@PLT`
else `jmp {emit_symbol s}`
let load_symbol_addr s =
if !Clflags.dlcode && not mingw64
if !Clflags.dlcode && not mingw64 && not cygwin
then `movq {emit_symbol s}@GOTPCREL(%rip)`
else if !pic_code
then `leaq {emit_symbol s}(%rip)`
@ -636,7 +637,7 @@ let emit_instr fallthrough i =
` jmp *{emit_reg tmp1}\n`;
if macosx then
` .const\n`
else if mingw64 then
else if mingw64 || cygwin then
` .section .rdata,\"dr\"\n`
else
` .section .rodata\n`;
@ -790,7 +791,7 @@ let begin_assembly() =
(* from amd64.S; could emit these constants on demand *)
if macosx then
` .literal16\n`
else if mingw64 then
else if mingw64 || cygwin then
` .section .rdata,\"dr\"\n`
else
` .section .rodata.cst8,\"a\",@progbits\n`;
@ -813,7 +814,7 @@ let end_assembly() =
if !float_constants <> [] then begin
if macosx then
` .literal8\n`
else if mingw64 then
else if mingw64 || cygwin then
` .section .rdata,\"dr\"\n`
else
` .section .rodata.cst8,\"a\",@progbits\n`;

View File

@ -24,7 +24,7 @@ let fp = Config.with_frame_pointers
let win64 =
match Config.system with
| "win64" | "mingw64" -> true
| "win64" | "mingw64" | "cygwin" -> true
| _ -> false
(* Which asm conventions to use *)

View File

@ -32,7 +32,7 @@
.align FUNCTION_ALIGN; \
name:
#elif defined(SYS_mingw64)
#elif defined(SYS_mingw64) || defined(SYS_cygwin)
#define LBL(x) .L##x
#define G(r) r
@ -90,7 +90,7 @@
#endif
#if defined(__PIC__) && !defined(SYS_mingw64)
#if defined(__PIC__) && !defined(SYS_mingw64) && !defined(SYS_cygwin)
/* Position-independent operations on global variables. */
@ -179,7 +179,7 @@
/* Save and restore all callee-save registers on stack.
Keep the stack 16-aligned. */
#if defined(SYS_mingw64)
#if defined(SYS_mingw64) || defined(SYS_cygwin)
/* Win64 API: callee-save regs are rbx, rbp, rsi, rdi, r12-r15, xmm6-xmm15 */
@ -249,7 +249,7 @@
#endif
#ifdef SYS_mingw64
#if defined(SYS_mingw64) || defined (SYS_cygwin)
/* Calls from OCaml to C must reserve 32 bytes of extra stack space */
# define PREPARE_FOR_C_CALL subq $32, %rsp; CFI_ADJUST(32)
# define CLEANUP_AFTER_C_CALL addq $32, %rsp; CFI_ADJUST(-32)
@ -271,7 +271,7 @@ FUNCTION(G(caml_call_gc))
CFI_STARTPROC
RECORD_STACK_FRAME(0)
LBL(caml_call_gc):
#ifndef SYS_mingw64
#if !defined(SYS_mingw64) && !defined(SYS_cygwin)
/* Touch the stack to trigger a recoverable segfault
if insufficient space remains */
subq $32768, %rsp
@ -448,7 +448,7 @@ LBL(caml_c_call):
STORE_VAR(%r12, caml_last_return_address)
STORE_VAR(%rsp, caml_bottom_of_stack)
subq $8, %rsp; CFI_ADJUST(8) /* equivalent to pushq %r12 */
#ifndef SYS_mingw64
#if !defined(SYS_mingw64) && !defined(SYS_cygwin)
/* Touch the stack to trigger a recoverable segfault
if insufficient space remains */
subq $32768, %rsp
@ -517,7 +517,7 @@ CFI_ENDPROC
/* Registers holding arguments of C functions. */
#ifdef SYS_mingw64
#if defined(SYS_mingw64) || defined(SYS_cygwin)
#define C_ARG_1 %rcx
#define C_ARG_2 %rdx
#define C_ARG_3 %r8
@ -674,7 +674,7 @@ G(caml_system__frametable):
#if defined(SYS_macosx)
.literal16
#elif defined(SYS_mingw64)
#elif defined(SYS_mingw64) || defined(SYS_cygwin)
.section .rdata,"dr"
#else
.section .rodata.cst8,"a",@progbits

View File

@ -22,6 +22,9 @@
#ifdef HAS_UNISTD
#include <unistd.h>
#endif
#ifdef __CYGWIN__
#include </usr/include/io.h>
#endif
#include "alloc.h"
#include "custom.h"
#include "fail.h"

5
configure vendored
View File

@ -381,6 +381,10 @@ case "$bytecc,$target" in
mkexedebugflag="-link -g"
fi
fi
if test $with_sharedlibs = no; then
mkexe="$mkexe -Wl,--stack,16777216"
bytecclinkopts="-Wl,--stack,16777216"
fi
exe=".exe"
ostype="Cygwin";;
*gcc*,*-*-mingw*)
@ -858,6 +862,7 @@ case "$target" in
x86_64-*-darwin*) arch=amd64; system=macosx;;
x86_64-*-mingw*) arch=amd64; system=mingw;;
aarch64-*-linux*) arch=arm64; system=linux;;
x86_64-*-cygwin*) arch=amd64; system=cygwin;;
esac
# Some platforms exist both in 32-bit and 64-bit variants, not distinguished