lang/ocaml

This is based of the work of Pierre Metras <pierre@alterna.tv>.
This commit is contained in:
Lionel Sambuc 2016-11-16 00:37:15 +00:00 committed by Lionel Sambuc
parent b946e1c41f
commit bc03a75ab6
11 changed files with 244 additions and 0 deletions

View File

@ -33,3 +33,13 @@ SHA1 (patch-tools_ocamlmklib) = 49ea077e3f77527336548ae6515d135461b83080
SHA1 (patch-tools_ocamloptp.ml) = 9c2b6344b98fde8f4b7d6e2ee46f6bb6fbb4f507
SHA1 (patch-utils_clflags.ml) = d16832fedb5db08d035f1661eaf9c3b48411bc69
SHA1 (patch-utils_clflags.mli) = 381951d9583e032d3a520b68a8fe9f867ec49995
SHA1 (patch-zz-minix-a) = 9e8ec38d2879c8acdf6535d3b29e3e9b9de6d162
SHA1 (patch-zz-minix-b) = 07ece14c0b42361166f30c41fc6614eba653a45f
SHA1 (patch-zz-minix-c) = 492ef988008f9511557ac99aaacabd90b5f864eb
SHA1 (patch-zz-minix-d) = 181023605ecd1370455d8fe8faf442df1bbbac98
SHA1 (patch-zz-minix-e) = c9f93cc40b5b2bd773b122066c43593577371ce1
SHA1 (patch-zz-minix-f) = 9be8cb628ad067e3c6804a93f12cb1884e1e936f
SHA1 (patch-zz-minix-g) = f77a6695f26b766803c165864db5f40ccabce1e5
SHA1 (patch-zz-minix-h) = ac4242232eea44da70e8dd92c8e7a135538cfeaf
SHA1 (patch-zz-minix-i) = c7c49e5533cca201ae0d5debc591509251f3e649
SHA1 (patch-zz-minix-j) = 53193bc665accdb24fe831c97603deea18c096a7

View File

@ -0,0 +1,11 @@
--- asmcomp/arm/arch.ml.orig Tue Nov 15 23:56:47 2016
+++ asmcomp/arm/arch.ml Tue Nov 15 23:57:53 2016
@@ -25,7 +25,7 @@
let abi =
match Config.system with
"linux_eabi" | "freebsd" -> EABI
- | "linux_eabihf" | "netbsd" -> EABI_HF
+ | "linux_eabihf" | "minix" | "netbsd" -> EABI_HF
| _ -> assert false
let string_of_arch = function

View File

@ -0,0 +1,20 @@
--- asmcomp/arm/emit.mlp.orig Tue Nov 15 23:59:05 2016
+++ asmcomp/arm/emit.mlp Tue Nov 15 23:59:35 2016
@@ -824,7 +824,7 @@
let emit_profile() =
match Config.system with
- "linux_eabi" | "linux_eabihf" | "netbsd" ->
+ "linux_eabi" | "linux_eabihf" | "minix" | "netbsd" ->
` push \{lr}\n`;
` {emit_call "__gnu_mcount_nc"}\n`
| _ -> ()
@@ -952,7 +952,7 @@
` .type {emit_symbol lbl}, %object\n`;
` .size {emit_symbol lbl}, .-{emit_symbol lbl}\n`;
begin match Config.system with
- "linux_eabihf" | "linux_eabi" | "netbsd" ->
+ "linux_eabihf" | "linux_eabi" | "minix" | "netbsd" ->
(* Mark stack as non-executable *)
` .section .note.GNU-stack,\"\",%progbits\n`
| _ -> ()

View File

@ -0,0 +1,36 @@
--- asmcomp/i386/emit.mlp.orig Wed Nov 16 00:01:00 2016
+++ asmcomp/i386/emit.mlp Wed Nov 16 00:02:50 2016
@@ -91,6 +91,7 @@
match system with
| S_linux_elf -> ""
| S_bsd_elf -> ""
+ | S_minix -> ""
| S_solaris -> ""
| S_beos -> ""
| S_gnu -> ""
@@ -108,6 +109,7 @@
match system with
| S_linux_elf -> ".L"
| S_bsd_elf -> ".L"
+ | S_minix -> ".L"
| S_solaris -> ".L"
| S_beos -> ".L"
| S_gnu -> ".L"
@@ -935,7 +937,7 @@
let emit_profile () =
match system with
| S_linux_elf | S_gnu -> call_mcount "mcount"
- | S_bsd_elf -> call_mcount ".mcount"
+ | S_bsd_elf | S_minix -> call_mcount ".mcount"
| S_macosx -> call_mcount "Lmcount$stub"
| _ -> () (*unsupported yet*)
@@ -974,7 +976,7 @@
emit_call_bound_errors ();
cfi_endproc ();
begin match system with
- | S_linux_elf | S_bsd_elf | S_gnu ->
+ | S_linux_elf | S_bsd_elf | S_minix | S_gnu ->
D.type_ (emit_symbol fundecl.fun_name) "@function";
D.size (emit_symbol fundecl.fun_name)
(ConstSub (

View File

@ -0,0 +1,18 @@
--- asmcomp/x86_proc.ml.orig Wed Nov 16 00:04:07 2016
+++ asmcomp/x86_proc.ml Wed Nov 16 00:08:14 2016
@@ -26,6 +26,7 @@
| S_win32
| S_linux_elf
| S_bsd_elf
+ | S_minix
| S_beos
| S_mingw
@@ -43,6 +44,7 @@
| "win32" -> S_win32
| "linux_elf" -> S_linux_elf
| "bsd_elf" -> S_bsd_elf
+ | "minix" -> S_minix
| "beos" -> S_beos
| "gnu" -> S_gnu
| "cygwin" -> S_cygwin

View File

@ -0,0 +1,10 @@
--- asmcomp/x86_proc.mli.orig Wed Nov 16 00:08:53 2016
+++ asmcomp/x86_proc.mli Wed Nov 16 00:09:23 2016
@@ -67,6 +67,7 @@
| S_win32
| S_linux_elf
| S_bsd_elf
+ | S_minix
| S_beos
| S_mingw

View File

@ -0,0 +1,30 @@
--- asmrun/i386.S.orig Wed Nov 16 00:10:14 2016
+++ asmrun/i386.S Wed Nov 16 00:13:13 2016
@@ -28,7 +28,8 @@
#endif
#if defined(SYS_linux_elf) || defined(SYS_bsd_elf) \
- || defined(SYS_solaris) || defined(SYS_beos) || defined(SYS_gnu)
+ || defined(SYS_solaris) || defined(SYS_beos) || defined(SYS_gnu) \
+ || defined(SYS_minix)
#define G(x) x
#define LBL(x) CONCAT(.L,x)
#else
@@ -38,7 +39,7 @@
#if defined(SYS_linux_elf) || defined(SYS_bsd_elf) \
|| defined(SYS_solaris) || defined(SYS_beos) || defined(SYS_cygwin) \
- || defined(SYS_mingw) || defined(SYS_gnu)
+ || defined(SYS_mingw) || defined(SYS_gnu) || defined(SYS_minix)
#define FUNCTION_ALIGN 4
#else
#define FUNCTION_ALIGN 2
@@ -77,7 +78,7 @@
movl %esp, %ebp; \
call mcount; \
popl %ebp; CFI_ADJUST(-4)
-#elif defined(SYS_bsd_elf)
+#elif defined(SYS_bsd_elf) || defined(SYS_minix)
#define PROFILE_CAML \
pushl %ebp; CFI_ADJUST(4); \
movl %esp, %ebp; \

View File

@ -0,0 +1,11 @@
--- config/auto-aux/gethostbyaddr.c.orig Wed Nov 16 00:16:17 2016
+++ config/auto-aux/gethostbyaddr.c Wed Nov 16 00:16:58 2016
@@ -21,7 +21,7 @@
#include <sys/types.h>
#include <netdb.h>
-#ifdef SYS_netbsd
+#if defined(SYS_netbsd) || defined(SYS_minix)
#error "this OS doesn't have gethostbyaddr_r"
#endif

View File

@ -0,0 +1,11 @@
--- config/auto-aux/gethostbyname.c.orig Wed Nov 16 00:17:47 2016
+++ config/auto-aux/gethostbyname.c Wed Nov 16 00:18:21 2016
@@ -21,7 +21,7 @@
#include <sys/types.h>
#include <netdb.h>
-#ifdef SYS_netbsd
+#if defined(SYS_netbsd) || defined(SYS_minix)
#error "this OS doesn't have gethostbyname_r"
#endif

View File

@ -0,0 +1,59 @@
--- configure.orig Wed Nov 16 00:19:15 2016
+++ configure Wed Nov 16 00:24:27 2016
@@ -671,7 +671,7 @@
mkmaindll="$flexlink -maindll"
shared_libraries_supported=true;;
*-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*|*-*-freebsd[1-9][0-9]*\
- |*-*-openbsd*|*-*-netbsd*|*-*-dragonfly|*-*-gnu*|*-*-haiku*)
+ |*-*-openbsd*|*-*-minix*|*-*-netbsd*|*-*-dragonfly|*-*-gnu*|*-*-haiku*)
sharedcccompopts="-fPIC"
mksharedlib="$bytecc -shared"
bytecclinkopts="$bytecclinkopts -Wl,-E"
@@ -782,6 +782,7 @@
x86_64-*-freebsd*) natdynlink=true;;
i[3456]86-*-openbsd*) natdynlink=true;;
x86_64-*-openbsd*) natdynlink=true;;
+ i[3456]86-*-minix*) natdynlink=true;;
i[3456]86-*-netbsd*) natdynlink=true;;
x86_64-*-netbsd*) natdynlink=true;;
i[3456]86-*-dragonfly*) natdynlink=true;;
@@ -791,6 +792,7 @@
i[3456]86-*-haiku*) natdynlink=true;;
arm*-*-linux*) natdynlink=true;;
arm*-*-freebsd*) natdynlink=true;;
+ earm*-*-minix*) natdynlink=true;;
earm*-*-netbsd*) natdynlink=true;;
aarch64-*-linux*) natdynlink=true;;
esac
@@ -834,6 +836,7 @@
fi;;
i[3456]86-*-gnu*) arch=i386; system=gnu;;
i[3456]86-*-mingw*) arch=i386; system=mingw;;
+ i[3456]86-*-minix*) arch=i386; system=minix;;
powerpc64le*-*-linux*) arch=power; model=ppc64le; system=elf;;
powerpc*-*-linux*) arch=power;
if $arch64; then model=ppc64; else model=ppc; fi
@@ -853,6 +856,7 @@
armv5*-*-linux-gnueabi) arch=arm; model=armv5; system=linux_eabi;;
arm*-*-linux-gnueabi) arch=arm; system=linux_eabi;;
arm*-*-netbsd*) arch=arm; system=netbsd;;
+ arm*-*-minix*) arch=arm; system=minix;;
arm*-*-openbsd*) arch=arm; system=bsd;;
zaurus*-*-openbsd*) arch=arm; system=bsd;;
x86_64-*-linux*) arch=amd64; system=linux;;
@@ -951,6 +955,7 @@
i386,linux_elf) profiling='prof';;
i386,gnu) profiling='prof';;
i386,bsd_elf) profiling='prof';;
+ i386,minix) profiling='prof';;
amd64,macosx) profiling='prof';;
i386,macosx) profiling='prof';;
sparc,bsd) profiling='prof';;
@@ -961,6 +966,7 @@
amd64,openbsd) profiling='prof';;
amd64,freebsd) profiling='prof';;
amd64,netbsd) profiling='prof';;
+ arm,minix) profiling='prof';;
arm,netbsd) profiling='prof';;
amd64,gnu) profiling='prof';;
arm,linux*) profiling='prof';;

View File

@ -0,0 +1,28 @@
--- otherlibs/bigarray/mmap_unix.c.orig Wed Nov 16 00:25:40 2016
+++ otherlibs/bigarray/mmap_unix.c Wed Nov 16 00:29:14 2016
@@ -104,6 +104,12 @@
uintnat array_size, page, delta;
void * addr;
+#if defined(__minix)
+//#warning "Shared mmap is not yet implemented in Minix3! To be removed when it's done..."
+ if (Bool_val(vshared)) {
+ caml_invalid_argument("Bigarray.map_file: shared mmap not yet implemented in Minix3");
+ }
+#endif
fd = Int_val(vfd);
flags = Caml_ba_kind_val(vkind) | Caml_ba_layout_val(vlayout);
startpos = File_offset_val(vstart);
@@ -199,7 +205,12 @@
addr = (void *)((uintnat)addr - delta);
len = len + delta;
#if defined(_POSIX_SYNCHRONIZED_IO)
+#if defined(__minix)
+//#warning "msync() is not yet implemented in Minix3! To be removed when it's done..."
+ caml_failwith("Bigarray.unmap_file: msync() is not yet implemented in Minix3! To be removed when it's done...");
+#else
msync(addr, len, MS_ASYNC); /* PR#3571 */
+#endif /* defined(__minix) */
#endif
munmap(addr, len);
#endif