Compare commits
No commits in common. "c9" and "c8s" have entirely different histories.
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
||||
SOURCES/ocaml-4.11.1.tar.xz
|
||||
SOURCES/ocaml-4.07.0.tar.xz
|
||||
/ocaml-4.07.0.tar.xz
|
||||
|
@ -1 +0,0 @@
|
||||
2bfc9e3af2a679b87f692e3b991034b920b8b3c3 SOURCES/ocaml-4.11.1.tar.xz
|
@ -1,27 +1,27 @@
|
||||
From 4c7732daae8f0d2a622f91f5ff3add5c2248a2e3 Mon Sep 17 00:00:00 2001
|
||||
From 8ddacdf1283fe3d7054f51a4b764bc6b44d7a342 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 24 Jun 2014 10:00:15 +0100
|
||||
Subject: [PATCH 1/6] Don't add rpaths to libraries.
|
||||
Subject: [PATCH 1/8] Don't add rpaths to libraries.
|
||||
|
||||
---
|
||||
tools/Makefile | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/Makefile b/tools/Makefile
|
||||
index dbad0b74f..c920a5337 100644
|
||||
index 78d2a1068..fbec019ed 100644
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -154,8 +154,8 @@ $(call byte_and_opt,ocamlmklib,ocamlmklibconfig.cmo config.cmo \
|
||||
ocamlmklibconfig.ml: $(ROOTDIR)/Makefile.config Makefile
|
||||
@@ -157,8 +157,8 @@ $(call byte_and_opt,ocamlmklib,ocamlmklibconfig.cmo config.cmo misc.cmo \
|
||||
ocamlmklibconfig.ml: ../config/Makefile Makefile
|
||||
(echo 'let bindir = "$(BINDIR)"'; \
|
||||
echo 'let supports_shared_libraries = $(SUPPORTS_SHARED_LIBRARIES)';\
|
||||
- echo 'let default_rpath = "$(RPATH)"'; \
|
||||
- echo 'let mksharedlibrpath = "$(MKSHAREDLIBRPATH)"'; \
|
||||
+ echo 'let default_rpath = ""'; \
|
||||
+ echo 'let mksharedlibrpath = ""'; \
|
||||
echo 'let toolpref = "$(TOOLPREF)"';) \
|
||||
echo 'let toolpref = "$(TOOLPREF)"'; \
|
||||
sed -n -e 's/^#ml //p' ../config/Makefile) \
|
||||
> ocamlmklibconfig.ml
|
||||
|
||||
--
|
||||
2.32.0
|
||||
2.17.1
|
||||
|
240
0002-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch
Normal file
240
0002-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch
Normal file
@ -0,0 +1,240 @@
|
||||
From 118057a71576cb39d71633bf80a37815bf4ff932 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 29 May 2012 20:40:36 +0100
|
||||
Subject: [PATCH 2/8] ocamlbyteinfo, ocamlplugininfo: Useful utilities from
|
||||
Debian, sent upstream.
|
||||
|
||||
See:
|
||||
http://git.debian.org/?p=pkg-ocaml-maint/packages/ocaml.git;a=tree;f=debian/ocamlbyteinfo;hb=HEAD
|
||||
---
|
||||
ocamlbyteinfo.ml | 101 +++++++++++++++++++++++++++++++++++++++++
|
||||
ocamlplugininfo.ml | 109 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 210 insertions(+)
|
||||
create mode 100644 ocamlbyteinfo.ml
|
||||
create mode 100644 ocamlplugininfo.ml
|
||||
|
||||
diff --git a/ocamlbyteinfo.ml b/ocamlbyteinfo.ml
|
||||
new file mode 100644
|
||||
index 000000000..0a537e4d5
|
||||
--- /dev/null
|
||||
+++ b/ocamlbyteinfo.ml
|
||||
@@ -0,0 +1,101 @@
|
||||
+(***********************************************************************)
|
||||
+(* *)
|
||||
+(* Objective Caml *)
|
||||
+(* *)
|
||||
+(* Xavier Leroy, projet Gallium, INRIA Rocquencourt *)
|
||||
+(* *)
|
||||
+(* Copyright 2009 Institut National de Recherche en Informatique et *)
|
||||
+(* en Automatique. All rights reserved. This file is distributed *)
|
||||
+(* under the terms of the GNU Library General Public License, with *)
|
||||
+(* the special exception on linking described in file ../../LICENSE. *)
|
||||
+(* *)
|
||||
+(***********************************************************************)
|
||||
+
|
||||
+(* $Id$ *)
|
||||
+
|
||||
+(* Dumps a bytecode binary file *)
|
||||
+
|
||||
+open Sys
|
||||
+open Dynlinkaux
|
||||
+
|
||||
+let input_stringlist ic len =
|
||||
+ let get_string_list sect len =
|
||||
+ let rec fold s e acc =
|
||||
+ if e != len then
|
||||
+ if sect.[e] = '\000' then
|
||||
+ fold (e+1) (e+1) (String.sub sect s (e-s) :: acc)
|
||||
+ else fold s (e+1) acc
|
||||
+ else acc
|
||||
+ in fold 0 0 []
|
||||
+ in
|
||||
+ let sect = Bytes.create len in
|
||||
+ let _ = really_input ic sect 0 len in
|
||||
+ get_string_list (Bytes.to_string sect) len
|
||||
+
|
||||
+let print = Printf.printf
|
||||
+let perr s =
|
||||
+ Printf.eprintf "%s\n" s;
|
||||
+ exit(1)
|
||||
+let p_title title = print "%s:\n" title
|
||||
+
|
||||
+let p_section title format pdata = function
|
||||
+ | [] -> ()
|
||||
+ | l ->
|
||||
+ p_title title;
|
||||
+ List.iter
|
||||
+ (fun (name, data) -> print format (pdata data) name)
|
||||
+ l
|
||||
+
|
||||
+let p_list title format = function
|
||||
+ | [] -> ()
|
||||
+ | l ->
|
||||
+ p_title title;
|
||||
+ List.iter
|
||||
+ (fun name -> print format name)
|
||||
+ l
|
||||
+
|
||||
+let _ =
|
||||
+ try
|
||||
+ let input_name = Sys.argv.(1) in
|
||||
+ let ic = open_in_bin input_name in
|
||||
+ Bytesections.read_toc ic;
|
||||
+ List.iter
|
||||
+ (fun section ->
|
||||
+ try
|
||||
+ let len = Bytesections.seek_section ic section in
|
||||
+ if len > 0 then match section with
|
||||
+ | "CRCS" ->
|
||||
+ p_section
|
||||
+ "Imported Units"
|
||||
+ "\t%s\t%s\n"
|
||||
+ Digest.to_hex
|
||||
+ (input_value ic : (string * Digest.t) list)
|
||||
+ | "DLLS" ->
|
||||
+ p_list
|
||||
+ "Used Dlls" "\t%s\n"
|
||||
+ (input_stringlist ic len)
|
||||
+ | "DLPT" ->
|
||||
+ p_list
|
||||
+ "Additional Dll paths"
|
||||
+ "\t%s\n"
|
||||
+ (input_stringlist ic len)
|
||||
+ | "PRIM" ->
|
||||
+ let prims = (input_stringlist ic len) in
|
||||
+ print "Uses unsafe features: ";
|
||||
+ begin match prims with
|
||||
+ [] -> print "no\n"
|
||||
+ | l -> print "YES\n";
|
||||
+ p_list "Primitives declared in this module"
|
||||
+ "\t%s\n"
|
||||
+ l
|
||||
+ end
|
||||
+ | _ -> ()
|
||||
+ with Not_found | Failure _ | Invalid_argument _ -> ()
|
||||
+ )
|
||||
+ ["CRCS"; "DLLS"; "DLPT"; "PRIM"];
|
||||
+ close_in ic
|
||||
+ with
|
||||
+ | Sys_error msg ->
|
||||
+ perr msg
|
||||
+ | Invalid_argument("index out of bounds") ->
|
||||
+ perr (Printf.sprintf "Usage: %s filename" Sys.argv.(0))
|
||||
diff --git a/ocamlplugininfo.ml b/ocamlplugininfo.ml
|
||||
new file mode 100644
|
||||
index 000000000..e28800f31
|
||||
--- /dev/null
|
||||
+++ b/ocamlplugininfo.ml
|
||||
@@ -0,0 +1,109 @@
|
||||
+(***********************************************************************)
|
||||
+(* *)
|
||||
+(* Objective Caml *)
|
||||
+(* *)
|
||||
+(* Xavier Leroy, projet Gallium, INRIA Rocquencourt *)
|
||||
+(* *)
|
||||
+(* Copyright 2009 Institut National de Recherche en Informatique et *)
|
||||
+(* en Automatique. All rights reserved. This file is distributed *)
|
||||
+(* under the terms of the GNU Library General Public License, with *)
|
||||
+(* the special exception on linking described in file ../../LICENSE. *)
|
||||
+(* *)
|
||||
+(***********************************************************************)
|
||||
+
|
||||
+(* $Id$ *)
|
||||
+
|
||||
+(* Dumps a .cmxs file *)
|
||||
+
|
||||
+open Natdynlink
|
||||
+open Format
|
||||
+
|
||||
+let file =
|
||||
+ try
|
||||
+ Sys.argv.(1)
|
||||
+ with _ -> begin
|
||||
+ Printf.eprintf "Usage: %s file.cmxs\n" Sys.argv.(0);
|
||||
+ exit(1)
|
||||
+ end
|
||||
+
|
||||
+exception Abnormal_exit
|
||||
+
|
||||
+let error s e =
|
||||
+ let eprint = Printf.eprintf in
|
||||
+ let print_exc s = function
|
||||
+ | End_of_file ->
|
||||
+ eprint "%s: %s\n" s file
|
||||
+ | Abnormal_exit ->
|
||||
+ eprint "%s\n" s
|
||||
+ | e -> eprint "%s\n" (Printexc.to_string e)
|
||||
+ in
|
||||
+ print_exc s e;
|
||||
+ exit(1)
|
||||
+
|
||||
+let read_in command =
|
||||
+ let cmd = Printf.sprintf command file in
|
||||
+ let ic = Unix.open_process_in cmd in
|
||||
+ try
|
||||
+ let line = input_line ic in
|
||||
+ begin match (Unix.close_process_in ic) with
|
||||
+ | Unix.WEXITED 0 -> Str.split (Str.regexp "[ ]+") line
|
||||
+ | Unix.WEXITED _ | Unix.WSIGNALED _ | Unix.WSTOPPED _ ->
|
||||
+ error
|
||||
+ (Printf.sprintf
|
||||
+ "Command \"%s\" exited abnormally"
|
||||
+ cmd
|
||||
+ )
|
||||
+ Abnormal_exit
|
||||
+ end
|
||||
+ with e -> error "File is empty" e
|
||||
+
|
||||
+let get_offset adr_off adr_sec =
|
||||
+ try
|
||||
+ let adr = List.nth adr_off 4 in
|
||||
+ let off = List.nth adr_off 5 in
|
||||
+ let sec = List.hd adr_sec in
|
||||
+
|
||||
+ let (!) x = Int64.of_string ("0x" ^ x) in
|
||||
+ let (+) = Int64.add in
|
||||
+ let (-) = Int64.sub in
|
||||
+
|
||||
+ Int64.to_int (!off + !sec - !adr)
|
||||
+
|
||||
+ with Failure _ | Invalid_argument _ ->
|
||||
+ error
|
||||
+ "Command output doesn't have the expected format"
|
||||
+ Abnormal_exit
|
||||
+
|
||||
+let print_infos name crc defines cmi cmx =
|
||||
+ let print_name_crc (name, crc) =
|
||||
+ printf "@ %s (%s)" name (Digest.to_hex crc)
|
||||
+ in
|
||||
+ let pr_imports ppf imps = List.iter print_name_crc imps in
|
||||
+ printf "Name: %s@." name;
|
||||
+ printf "CRC of implementation: %s@." (Digest.to_hex crc);
|
||||
+ printf "@[<hov 2>Globals defined:";
|
||||
+ List.iter (fun s -> printf "@ %s" s) defines;
|
||||
+ printf "@]@.";
|
||||
+ printf "@[<v 2>Interfaces imported:%a@]@." pr_imports cmi;
|
||||
+ printf "@[<v 2>Implementations imported:%a@]@." pr_imports cmx
|
||||
+
|
||||
+let _ =
|
||||
+ let adr_off = read_in "objdump -h %s | grep ' .data '" in
|
||||
+ let adr_sec = read_in "objdump -T %s | grep ' caml_plugin_header$'" in
|
||||
+
|
||||
+ let ic = open_in file in
|
||||
+ let _ = seek_in ic (get_offset adr_off adr_sec) in
|
||||
+ let header = (input_value ic : Natdynlink.dynheader) in
|
||||
+ if header.magic <> Natdynlink.dyn_magic_number then
|
||||
+ raise(Error(Natdynlink.Not_a_bytecode_file file))
|
||||
+ else begin
|
||||
+ List.iter
|
||||
+ (fun ui ->
|
||||
+ print_infos
|
||||
+ ui.name
|
||||
+ ui.crc
|
||||
+ ui.defines
|
||||
+ ui.imports_cmi
|
||||
+ ui.imports_cmx)
|
||||
+ header.units
|
||||
+ end
|
||||
--
|
||||
2.17.1
|
||||
|
27
0003-configure-Allow-user-defined-C-compiler-flags.patch
Normal file
27
0003-configure-Allow-user-defined-C-compiler-flags.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 8ddd2fb4909bf6ed1a3506723126432da8fcf0c4 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 29 May 2012 20:44:18 +0100
|
||||
Subject: [PATCH 3/8] configure: Allow user defined C compiler flags.
|
||||
|
||||
---
|
||||
configure | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 1316b3c1e..53f45f85b 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -2050,6 +2050,10 @@ if $flat_float_array; then
|
||||
echo "#define FLAT_FLOAT_ARRAY" >> m.h
|
||||
fi
|
||||
|
||||
+# Allow user defined C Compiler flags
|
||||
+bytecccompopts="$bytecccompopts $CFLAGS"
|
||||
+nativecccompopts="$nativecccompopts $CFLAGS"
|
||||
+
|
||||
# Finish generated files
|
||||
|
||||
cclibs="$cclibs $mathlib"
|
||||
--
|
||||
2.17.1
|
||||
|
1768
0004-Add-RISC-V-backend.patch
Normal file
1768
0004-Add-RISC-V-backend.patch
Normal file
File diff suppressed because it is too large
Load Diff
717
0005-Copyright-untabify.patch
Normal file
717
0005-Copyright-untabify.patch
Normal file
@ -0,0 +1,717 @@
|
||||
From 2e4038b6b8073f55012613f18cb19a4c99e8219d Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Ojeda Bar <n.oje.bar@gmail.com>
|
||||
Date: Fri, 1 Dec 2017 14:39:46 +0100
|
||||
Subject: [PATCH 5/8] Copyright, untabify
|
||||
|
||||
---
|
||||
asmrun/riscv.S | 608 ++++++++++++++++++++++++-------------------------
|
||||
1 file changed, 304 insertions(+), 304 deletions(-)
|
||||
|
||||
diff --git a/asmrun/riscv.S b/asmrun/riscv.S
|
||||
index a82048efc..88d7ab924 100644
|
||||
--- a/asmrun/riscv.S
|
||||
+++ b/asmrun/riscv.S
|
||||
@@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* Nicolas Ojeda Bar <n.oje.bar@gmail.com> */
|
||||
/* */
|
||||
-/* Copyright 1996 Institut National de Recherche en Informatique et */
|
||||
+/* Copyright 2017 Institut National de Recherche en Informatique et */
|
||||
/* en Automatique. All rights reserved. This file is distributed */
|
||||
/* under the terms of the GNU Library General Public License, with */
|
||||
/* the special exception on linking described in file ../LICENSE. */
|
||||
@@ -37,388 +37,388 @@
|
||||
.option nopic
|
||||
#endif
|
||||
|
||||
- .section .text
|
||||
+ .section .text
|
||||
/* Invoke the garbage collector. */
|
||||
|
||||
- .globl caml_system__code_begin
|
||||
+ .globl caml_system__code_begin
|
||||
caml_system__code_begin:
|
||||
|
||||
- .align 2
|
||||
- .globl caml_call_gc
|
||||
- .type caml_call_gc, @function
|
||||
+ .align 2
|
||||
+ .globl caml_call_gc
|
||||
+ .type caml_call_gc, @function
|
||||
caml_call_gc:
|
||||
/* Record return address */
|
||||
- store ra, caml_last_return_address, TMP0
|
||||
+ store ra, caml_last_return_address, TMP0
|
||||
/* Record lowest stack address */
|
||||
- mv TMP1, sp
|
||||
- store sp, caml_bottom_of_stack, TMP0
|
||||
+ mv TMP1, sp
|
||||
+ store sp, caml_bottom_of_stack, TMP0
|
||||
.Lcaml_call_gc:
|
||||
- /* Set up stack space, saving return address */
|
||||
+ /* Set up stack space, saving return address */
|
||||
/* (1 reg for RA, 1 reg for FP, 21 allocatable int regs, 20 caller-save float regs) * 8 */
|
||||
/* + 1 for alignment */
|
||||
- addi sp, sp, -0x160
|
||||
- mv s0, sp
|
||||
- store ra, 0x8(sp)
|
||||
- store s0, 0x0(sp)
|
||||
+ addi sp, sp, -0x160
|
||||
+ mv s0, sp
|
||||
+ store ra, 0x8(sp)
|
||||
+ store s0, 0x0(sp)
|
||||
/* Save allocatable integer registers on the stack,
|
||||
in the order given in proc.ml */
|
||||
- store a0, 0x10(sp)
|
||||
- store a1, 0x18(sp)
|
||||
- store a2, 0x20(sp)
|
||||
- store a3, 0x28(sp)
|
||||
- store a4, 0x30(sp)
|
||||
- store a5, 0x38(sp)
|
||||
- store a6, 0x40(sp)
|
||||
- store a7, 0x48(sp)
|
||||
- store s2, 0x50(sp)
|
||||
- store s3, 0x58(sp)
|
||||
- store s4, 0x60(sp)
|
||||
- store s5, 0x68(sp)
|
||||
- store s6, 0x70(sp)
|
||||
- store s7, 0x78(sp)
|
||||
- store s8, 0x80(sp)
|
||||
- store s9, 0x88(sp)
|
||||
- store t2, 0x90(sp)
|
||||
- store t3, 0x98(sp)
|
||||
- store t4, 0xa0(sp)
|
||||
- store t5, 0xa8(sp)
|
||||
- store t6, 0xb0(sp)
|
||||
+ store a0, 0x10(sp)
|
||||
+ store a1, 0x18(sp)
|
||||
+ store a2, 0x20(sp)
|
||||
+ store a3, 0x28(sp)
|
||||
+ store a4, 0x30(sp)
|
||||
+ store a5, 0x38(sp)
|
||||
+ store a6, 0x40(sp)
|
||||
+ store a7, 0x48(sp)
|
||||
+ store s2, 0x50(sp)
|
||||
+ store s3, 0x58(sp)
|
||||
+ store s4, 0x60(sp)
|
||||
+ store s5, 0x68(sp)
|
||||
+ store s6, 0x70(sp)
|
||||
+ store s7, 0x78(sp)
|
||||
+ store s8, 0x80(sp)
|
||||
+ store s9, 0x88(sp)
|
||||
+ store t2, 0x90(sp)
|
||||
+ store t3, 0x98(sp)
|
||||
+ store t4, 0xa0(sp)
|
||||
+ store t5, 0xa8(sp)
|
||||
+ store t6, 0xb0(sp)
|
||||
/* Save caller-save floating-point registers on the stack
|
||||
(callee-saves are preserved by caml_garbage_collection) */
|
||||
- fsd ft0, 0xb8(sp)
|
||||
- fsd ft1, 0xc0(sp)
|
||||
- fsd ft2, 0xc8(sp)
|
||||
- fsd ft3, 0xd0(sp)
|
||||
- fsd ft4, 0xd8(sp)
|
||||
- fsd ft5, 0xe0(sp)
|
||||
- fsd ft6, 0xe8(sp)
|
||||
- fsd ft7, 0xf0(sp)
|
||||
- fsd fa0, 0xf8(sp)
|
||||
- fsd fa1, 0x100(sp)
|
||||
- fsd fa2, 0x108(sp)
|
||||
- fsd fa3, 0x110(sp)
|
||||
- fsd fa4, 0x118(sp)
|
||||
- fsd fa5, 0x120(sp)
|
||||
- fsd fa6, 0x128(sp)
|
||||
- fsd fa7, 0x130(sp)
|
||||
- fsd ft8, 0x138(sp)
|
||||
- fsd ft9, 0x140(sp)
|
||||
- fsd ft9, 0x148(sp)
|
||||
- fsd ft10, 0x150(sp)
|
||||
- fsd ft11, 0x158(sp)
|
||||
+ fsd ft0, 0xb8(sp)
|
||||
+ fsd ft1, 0xc0(sp)
|
||||
+ fsd ft2, 0xc8(sp)
|
||||
+ fsd ft3, 0xd0(sp)
|
||||
+ fsd ft4, 0xd8(sp)
|
||||
+ fsd ft5, 0xe0(sp)
|
||||
+ fsd ft6, 0xe8(sp)
|
||||
+ fsd ft7, 0xf0(sp)
|
||||
+ fsd fa0, 0xf8(sp)
|
||||
+ fsd fa1, 0x100(sp)
|
||||
+ fsd fa2, 0x108(sp)
|
||||
+ fsd fa3, 0x110(sp)
|
||||
+ fsd fa4, 0x118(sp)
|
||||
+ fsd fa5, 0x120(sp)
|
||||
+ fsd fa6, 0x128(sp)
|
||||
+ fsd fa7, 0x130(sp)
|
||||
+ fsd ft8, 0x138(sp)
|
||||
+ fsd ft9, 0x140(sp)
|
||||
+ fsd ft9, 0x148(sp)
|
||||
+ fsd ft10, 0x150(sp)
|
||||
+ fsd ft11, 0x158(sp)
|
||||
/* Store pointer to saved integer registers in caml_gc_regs */
|
||||
- addi TMP1, sp, 16
|
||||
- store TMP1, caml_gc_regs, TMP0
|
||||
+ addi TMP1, sp, 16
|
||||
+ store TMP1, caml_gc_regs, TMP0
|
||||
/* Save current allocation pointer for debugging purposes */
|
||||
- store ALLOC_PTR, caml_young_ptr, TMP0
|
||||
+ store ALLOC_PTR, caml_young_ptr, TMP0
|
||||
/* Save trap pointer in case an exception is raised during GC */
|
||||
- store TRAP_PTR, caml_exception_pointer, TMP0
|
||||
+ store TRAP_PTR, caml_exception_pointer, TMP0
|
||||
/* Call the garbage collector */
|
||||
- call caml_garbage_collection
|
||||
+ call caml_garbage_collection
|
||||
/* Restore registers */
|
||||
- load a0, 0x10(sp)
|
||||
- load a1, 0x18(sp)
|
||||
- load a2, 0x20(sp)
|
||||
- load a3, 0x28(sp)
|
||||
- load a4, 0x30(sp)
|
||||
- load a5, 0x38(sp)
|
||||
- load a6, 0x40(sp)
|
||||
- load a7, 0x48(sp)
|
||||
- load s2, 0x50(sp)
|
||||
- load s3, 0x58(sp)
|
||||
- load s4, 0x60(sp)
|
||||
- load s5, 0x68(sp)
|
||||
- load s6, 0x70(sp)
|
||||
- load s7, 0x78(sp)
|
||||
- load s8, 0x80(sp)
|
||||
- load s9, 0x88(sp)
|
||||
- load t2, 0x90(sp)
|
||||
- load t3, 0x98(sp)
|
||||
- load t4, 0xa0(sp)
|
||||
- load t5, 0xa8(sp)
|
||||
- load t6, 0xb0(sp)
|
||||
- fld ft0, 0xb8(sp)
|
||||
- fld ft1, 0xc0(sp)
|
||||
- fld ft2, 0xc8(sp)
|
||||
- fld ft3, 0xd0(sp)
|
||||
- fld ft4, 0xd8(sp)
|
||||
- fld ft5, 0xe0(sp)
|
||||
- fld ft6, 0xe8(sp)
|
||||
- fld ft7, 0xf0(sp)
|
||||
- fld fa0, 0xf8(sp)
|
||||
- fld fa1, 0x100(sp)
|
||||
- fld fa2, 0x108(sp)
|
||||
- fld fa3, 0x110(sp)
|
||||
- fld fa4, 0x118(sp)
|
||||
- fld fa5, 0x120(sp)
|
||||
- fld fa6, 0x128(sp)
|
||||
- fld fa7, 0x130(sp)
|
||||
- fld ft8, 0x138(sp)
|
||||
- fld ft9, 0x140(sp)
|
||||
- fld ft9, 0x148(sp)
|
||||
- fld ft10, 0x150(sp)
|
||||
- fld ft11, 0x158(sp)
|
||||
+ load a0, 0x10(sp)
|
||||
+ load a1, 0x18(sp)
|
||||
+ load a2, 0x20(sp)
|
||||
+ load a3, 0x28(sp)
|
||||
+ load a4, 0x30(sp)
|
||||
+ load a5, 0x38(sp)
|
||||
+ load a6, 0x40(sp)
|
||||
+ load a7, 0x48(sp)
|
||||
+ load s2, 0x50(sp)
|
||||
+ load s3, 0x58(sp)
|
||||
+ load s4, 0x60(sp)
|
||||
+ load s5, 0x68(sp)
|
||||
+ load s6, 0x70(sp)
|
||||
+ load s7, 0x78(sp)
|
||||
+ load s8, 0x80(sp)
|
||||
+ load s9, 0x88(sp)
|
||||
+ load t2, 0x90(sp)
|
||||
+ load t3, 0x98(sp)
|
||||
+ load t4, 0xa0(sp)
|
||||
+ load t5, 0xa8(sp)
|
||||
+ load t6, 0xb0(sp)
|
||||
+ fld ft0, 0xb8(sp)
|
||||
+ fld ft1, 0xc0(sp)
|
||||
+ fld ft2, 0xc8(sp)
|
||||
+ fld ft3, 0xd0(sp)
|
||||
+ fld ft4, 0xd8(sp)
|
||||
+ fld ft5, 0xe0(sp)
|
||||
+ fld ft6, 0xe8(sp)
|
||||
+ fld ft7, 0xf0(sp)
|
||||
+ fld fa0, 0xf8(sp)
|
||||
+ fld fa1, 0x100(sp)
|
||||
+ fld fa2, 0x108(sp)
|
||||
+ fld fa3, 0x110(sp)
|
||||
+ fld fa4, 0x118(sp)
|
||||
+ fld fa5, 0x120(sp)
|
||||
+ fld fa6, 0x128(sp)
|
||||
+ fld fa7, 0x130(sp)
|
||||
+ fld ft8, 0x138(sp)
|
||||
+ fld ft9, 0x140(sp)
|
||||
+ fld ft9, 0x148(sp)
|
||||
+ fld ft10, 0x150(sp)
|
||||
+ fld ft11, 0x158(sp)
|
||||
/* Reload new allocation pointer and allocation limit */
|
||||
- load ALLOC_PTR, caml_young_ptr
|
||||
- load ALLOC_LIMIT, caml_young_limit
|
||||
+ load ALLOC_PTR, caml_young_ptr
|
||||
+ load ALLOC_LIMIT, caml_young_limit
|
||||
/* Free stack space and return to caller */
|
||||
- load ra, 0x8(sp)
|
||||
- load s0, 0x0(sp)
|
||||
- addi sp, sp, 0x160
|
||||
+ load ra, 0x8(sp)
|
||||
+ load s0, 0x0(sp)
|
||||
+ addi sp, sp, 0x160
|
||||
ret
|
||||
- .size caml_call_gc, .-caml_call_gc
|
||||
+ .size caml_call_gc, .-caml_call_gc
|
||||
|
||||
/* Call a C function from OCaml */
|
||||
/* Function to call is in ARG */
|
||||
|
||||
- .align 2
|
||||
- .globl caml_c_call
|
||||
- .type caml_c_call, @function
|
||||
+ .align 2
|
||||
+ .globl caml_c_call
|
||||
+ .type caml_c_call, @function
|
||||
caml_c_call:
|
||||
/* Preserve return address in callee-save register s2 */
|
||||
- mv s2, ra
|
||||
+ mv s2, ra
|
||||
/* Record lowest stack address and return address */
|
||||
- store ra, caml_last_return_address, TMP0
|
||||
- store sp, caml_bottom_of_stack, TMP0
|
||||
+ store ra, caml_last_return_address, TMP0
|
||||
+ store sp, caml_bottom_of_stack, TMP0
|
||||
/* Make the exception handler alloc ptr available to the C code */
|
||||
- store ALLOC_PTR, caml_young_ptr, TMP0
|
||||
- store TRAP_PTR, caml_exception_pointer, TMP0
|
||||
+ store ALLOC_PTR, caml_young_ptr, TMP0
|
||||
+ store TRAP_PTR, caml_exception_pointer, TMP0
|
||||
/* Call the function */
|
||||
- jalr ARG
|
||||
+ jalr ARG
|
||||
/* Reload alloc ptr and alloc limit */
|
||||
- load ALLOC_PTR, caml_young_ptr
|
||||
- load TRAP_PTR, caml_exception_pointer
|
||||
+ load ALLOC_PTR, caml_young_ptr
|
||||
+ load TRAP_PTR, caml_exception_pointer
|
||||
/* Return */
|
||||
- jr s2
|
||||
- .size caml_c_call, .-caml_c_call
|
||||
+ jr s2
|
||||
+ .size caml_c_call, .-caml_c_call
|
||||
|
||||
/* Raise an exception from OCaml */
|
||||
- .align 2
|
||||
- .globl caml_raise_exn
|
||||
- .type caml_raise_exn, @function
|
||||
+ .align 2
|
||||
+ .globl caml_raise_exn
|
||||
+ .type caml_raise_exn, @function
|
||||
caml_raise_exn:
|
||||
/* Test if backtrace is active */
|
||||
- load TMP1, caml_backtrace_active
|
||||
- bnez TMP1, 2f
|
||||
+ load TMP1, caml_backtrace_active
|
||||
+ bnez TMP1, 2f
|
||||
1: /* Cut stack at current trap handler */
|
||||
- mv sp, TRAP_PTR
|
||||
+ mv sp, TRAP_PTR
|
||||
/* Pop previous handler and jump to it */
|
||||
- load TMP1, 8(sp)
|
||||
- load TRAP_PTR, 0(sp)
|
||||
- addi sp, sp, 16
|
||||
- jr TMP1
|
||||
+ load TMP1, 8(sp)
|
||||
+ load TRAP_PTR, 0(sp)
|
||||
+ addi sp, sp, 16
|
||||
+ jr TMP1
|
||||
2: /* Preserve exception bucket in callee-save register s2 */
|
||||
- mv s2, a0
|
||||
+ mv s2, a0
|
||||
/* Stash the backtrace */
|
||||
- mv a1, ra
|
||||
- mv a2, sp
|
||||
- mv a3, TRAP_PTR
|
||||
- call caml_stash_backtrace
|
||||
+ mv a1, ra
|
||||
+ mv a2, sp
|
||||
+ mv a3, TRAP_PTR
|
||||
+ call caml_stash_backtrace
|
||||
/* Restore exception bucket and raise */
|
||||
- mv a0, s2
|
||||
- j 1b
|
||||
- .size caml_raise_exn, .-caml_raise_exn
|
||||
+ mv a0, s2
|
||||
+ j 1b
|
||||
+ .size caml_raise_exn, .-caml_raise_exn
|
||||
|
||||
- .globl caml_reraise_exn
|
||||
- .type caml_reraise_exn, @function
|
||||
+ .globl caml_reraise_exn
|
||||
+ .type caml_reraise_exn, @function
|
||||
|
||||
/* Raise an exception from C */
|
||||
|
||||
- .align 2
|
||||
- .globl caml_raise_exception
|
||||
- .type caml_raise_exception, @function
|
||||
+ .align 2
|
||||
+ .globl caml_raise_exception
|
||||
+ .type caml_raise_exception, @function
|
||||
caml_raise_exception:
|
||||
- load TRAP_PTR, caml_exception_pointer
|
||||
- load ALLOC_PTR, caml_young_ptr
|
||||
- load ALLOC_LIMIT, caml_young_limit
|
||||
- load TMP1, caml_backtrace_active
|
||||
- bnez TMP1, 2f
|
||||
+ load TRAP_PTR, caml_exception_pointer
|
||||
+ load ALLOC_PTR, caml_young_ptr
|
||||
+ load ALLOC_LIMIT, caml_young_limit
|
||||
+ load TMP1, caml_backtrace_active
|
||||
+ bnez TMP1, 2f
|
||||
1: /* Cut stack at current trap handler */
|
||||
- mv sp, TRAP_PTR
|
||||
- load TMP1, 8(sp)
|
||||
- load TRAP_PTR, 0(sp)
|
||||
- addi sp, sp, 16
|
||||
- jr TMP1
|
||||
+ mv sp, TRAP_PTR
|
||||
+ load TMP1, 8(sp)
|
||||
+ load TRAP_PTR, 0(sp)
|
||||
+ addi sp, sp, 16
|
||||
+ jr TMP1
|
||||
2: /* Preserve exception bucket in callee-save register s2 */
|
||||
- mv s2, a0
|
||||
- load a1, caml_last_return_address
|
||||
- load a2, caml_bottom_of_stack
|
||||
- mv a3, TRAP_PTR
|
||||
- call caml_stash_backtrace
|
||||
- mv a0, s2
|
||||
- j 1b
|
||||
- .size caml_raise_exception, .-caml_raise_exception
|
||||
+ mv s2, a0
|
||||
+ load a1, caml_last_return_address
|
||||
+ load a2, caml_bottom_of_stack
|
||||
+ mv a3, TRAP_PTR
|
||||
+ call caml_stash_backtrace
|
||||
+ mv a0, s2
|
||||
+ j 1b
|
||||
+ .size caml_raise_exception, .-caml_raise_exception
|
||||
|
||||
/* Start the OCaml program */
|
||||
|
||||
- .align 2
|
||||
- .globl caml_start_program
|
||||
- .type caml_start_program, @function
|
||||
+ .align 2
|
||||
+ .globl caml_start_program
|
||||
+ .type caml_start_program, @function
|
||||
caml_start_program:
|
||||
|
||||
- la ARG, caml_program
|
||||
+ la ARG, caml_program
|
||||
/* Code shared with caml_callback* */
|
||||
/* Address of OCaml code to call is in ARG */
|
||||
/* Arguments to the OCaml code are in a0 ... a7 */
|
||||
.Ljump_to_caml:
|
||||
- /* Set up stack frame and save callee-save registers */
|
||||
- addi sp, sp, -0xd0
|
||||
- store ra, 0xc0(sp)
|
||||
- store s0, 0x0(sp)
|
||||
- store s1, 0x8(sp)
|
||||
- store s2, 0x10(sp)
|
||||
- store s3, 0x18(sp)
|
||||
- store s4, 0x20(sp)
|
||||
- store s5, 0x28(sp)
|
||||
- store s6, 0x30(sp)
|
||||
- store s7, 0x38(sp)
|
||||
- store s8, 0x40(sp)
|
||||
- store s9, 0x48(sp)
|
||||
- store s10, 0x50(sp)
|
||||
- store s11, 0x58(sp)
|
||||
- fsd fs0, 0x60(sp)
|
||||
- fsd fs1, 0x68(sp)
|
||||
- fsd fs2, 0x70(sp)
|
||||
- fsd fs3, 0x78(sp)
|
||||
- fsd fs4, 0x80(sp)
|
||||
- fsd fs5, 0x88(sp)
|
||||
- fsd fs6, 0x90(sp)
|
||||
- fsd fs7, 0x98(sp)
|
||||
- fsd fs8, 0xa0(sp)
|
||||
- fsd fs9, 0xa8(sp)
|
||||
- fsd fs10, 0xb0(sp)
|
||||
- fsd fs11, 0xb8(sp)
|
||||
- addi sp, sp, -32
|
||||
+ /* Set up stack frame and save callee-save registers */
|
||||
+ addi sp, sp, -0xd0
|
||||
+ store ra, 0xc0(sp)
|
||||
+ store s0, 0x0(sp)
|
||||
+ store s1, 0x8(sp)
|
||||
+ store s2, 0x10(sp)
|
||||
+ store s3, 0x18(sp)
|
||||
+ store s4, 0x20(sp)
|
||||
+ store s5, 0x28(sp)
|
||||
+ store s6, 0x30(sp)
|
||||
+ store s7, 0x38(sp)
|
||||
+ store s8, 0x40(sp)
|
||||
+ store s9, 0x48(sp)
|
||||
+ store s10, 0x50(sp)
|
||||
+ store s11, 0x58(sp)
|
||||
+ fsd fs0, 0x60(sp)
|
||||
+ fsd fs1, 0x68(sp)
|
||||
+ fsd fs2, 0x70(sp)
|
||||
+ fsd fs3, 0x78(sp)
|
||||
+ fsd fs4, 0x80(sp)
|
||||
+ fsd fs5, 0x88(sp)
|
||||
+ fsd fs6, 0x90(sp)
|
||||
+ fsd fs7, 0x98(sp)
|
||||
+ fsd fs8, 0xa0(sp)
|
||||
+ fsd fs9, 0xa8(sp)
|
||||
+ fsd fs10, 0xb0(sp)
|
||||
+ fsd fs11, 0xb8(sp)
|
||||
+ addi sp, sp, -32
|
||||
/* Setup a callback link on the stack */
|
||||
- load TMP1, caml_bottom_of_stack
|
||||
- store TMP1, 0(sp)
|
||||
- load TMP1, caml_last_return_address
|
||||
- store TMP1, 8(sp)
|
||||
- load TMP1, caml_gc_regs
|
||||
- store TMP1, 16(sp)
|
||||
- /* set up a trap frame */
|
||||
- addi sp, sp, -16
|
||||
- load TMP1, caml_exception_pointer
|
||||
- store TMP1, 0(sp)
|
||||
- lla TMP0, .Ltrap_handler
|
||||
- store TMP0, 8(sp)
|
||||
- mv TRAP_PTR, sp
|
||||
- load ALLOC_PTR, caml_young_ptr
|
||||
- load ALLOC_LIMIT, caml_young_limit
|
||||
- store x0, caml_last_return_address, TMP0
|
||||
- jalr ARG
|
||||
-.Lcaml_retaddr: /* pop trap frame, restoring caml_exception_pointer */
|
||||
- load TMP1, 0(sp)
|
||||
- store TMP1, caml_exception_pointer, TMP0
|
||||
- addi sp, sp, 16
|
||||
-.Lreturn_result: /* pop callback link, restoring global variables */
|
||||
- load TMP1, 0(sp)
|
||||
- store TMP1, caml_bottom_of_stack, TMP0
|
||||
- load TMP1, 8(sp)
|
||||
- store TMP1, caml_last_return_address, TMP0
|
||||
- load TMP1, 16(sp)
|
||||
- store TMP1, caml_gc_regs, TMP0
|
||||
- addi sp, sp, 32
|
||||
- /* Update allocation pointer */
|
||||
- store ALLOC_PTR, caml_young_ptr, TMP0
|
||||
- /* reload callee-save registers and return */
|
||||
- load ra, 0xc0(sp)
|
||||
- load s0, 0x0(sp)
|
||||
- load s1, 0x8(sp)
|
||||
- load s2, 0x10(sp)
|
||||
- load s3, 0x18(sp)
|
||||
- load s4, 0x20(sp)
|
||||
- load s5, 0x28(sp)
|
||||
- load s6, 0x30(sp)
|
||||
- load s7, 0x38(sp)
|
||||
- load s8, 0x40(sp)
|
||||
- load s9, 0x48(sp)
|
||||
- load s10, 0x50(sp)
|
||||
- load s11, 0x58(sp)
|
||||
- fld fs0, 0x60(sp)
|
||||
- fld fs1, 0x68(sp)
|
||||
- fld fs2, 0x70(sp)
|
||||
- fld fs3, 0x78(sp)
|
||||
- fld fs4, 0x80(sp)
|
||||
- fld fs5, 0x88(sp)
|
||||
- fld fs6, 0x90(sp)
|
||||
- fld fs7, 0x98(sp)
|
||||
- fld fs8, 0xa0(sp)
|
||||
- fld fs9, 0xa8(sp)
|
||||
- fld fs10, 0xb0(sp)
|
||||
- fld fs11, 0xb8(sp)
|
||||
- addi sp, sp, 0xd0
|
||||
- ret
|
||||
+ load TMP1, caml_bottom_of_stack
|
||||
+ store TMP1, 0(sp)
|
||||
+ load TMP1, caml_last_return_address
|
||||
+ store TMP1, 8(sp)
|
||||
+ load TMP1, caml_gc_regs
|
||||
+ store TMP1, 16(sp)
|
||||
+ /* set up a trap frame */
|
||||
+ addi sp, sp, -16
|
||||
+ load TMP1, caml_exception_pointer
|
||||
+ store TMP1, 0(sp)
|
||||
+ lla TMP0, .Ltrap_handler
|
||||
+ store TMP0, 8(sp)
|
||||
+ mv TRAP_PTR, sp
|
||||
+ load ALLOC_PTR, caml_young_ptr
|
||||
+ load ALLOC_LIMIT, caml_young_limit
|
||||
+ store x0, caml_last_return_address, TMP0
|
||||
+ jalr ARG
|
||||
+.Lcaml_retaddr: /* pop trap frame, restoring caml_exception_pointer */
|
||||
+ load TMP1, 0(sp)
|
||||
+ store TMP1, caml_exception_pointer, TMP0
|
||||
+ addi sp, sp, 16
|
||||
+.Lreturn_result: /* pop callback link, restoring global variables */
|
||||
+ load TMP1, 0(sp)
|
||||
+ store TMP1, caml_bottom_of_stack, TMP0
|
||||
+ load TMP1, 8(sp)
|
||||
+ store TMP1, caml_last_return_address, TMP0
|
||||
+ load TMP1, 16(sp)
|
||||
+ store TMP1, caml_gc_regs, TMP0
|
||||
+ addi sp, sp, 32
|
||||
+ /* Update allocation pointer */
|
||||
+ store ALLOC_PTR, caml_young_ptr, TMP0
|
||||
+ /* reload callee-save registers and return */
|
||||
+ load ra, 0xc0(sp)
|
||||
+ load s0, 0x0(sp)
|
||||
+ load s1, 0x8(sp)
|
||||
+ load s2, 0x10(sp)
|
||||
+ load s3, 0x18(sp)
|
||||
+ load s4, 0x20(sp)
|
||||
+ load s5, 0x28(sp)
|
||||
+ load s6, 0x30(sp)
|
||||
+ load s7, 0x38(sp)
|
||||
+ load s8, 0x40(sp)
|
||||
+ load s9, 0x48(sp)
|
||||
+ load s10, 0x50(sp)
|
||||
+ load s11, 0x58(sp)
|
||||
+ fld fs0, 0x60(sp)
|
||||
+ fld fs1, 0x68(sp)
|
||||
+ fld fs2, 0x70(sp)
|
||||
+ fld fs3, 0x78(sp)
|
||||
+ fld fs4, 0x80(sp)
|
||||
+ fld fs5, 0x88(sp)
|
||||
+ fld fs6, 0x90(sp)
|
||||
+ fld fs7, 0x98(sp)
|
||||
+ fld fs8, 0xa0(sp)
|
||||
+ fld fs9, 0xa8(sp)
|
||||
+ fld fs10, 0xb0(sp)
|
||||
+ fld fs11, 0xb8(sp)
|
||||
+ addi sp, sp, 0xd0
|
||||
+ ret
|
||||
.Ltrap_handler:
|
||||
- store TRAP_PTR, caml_exception_pointer, TMP0
|
||||
- ori a0, a0, 2
|
||||
- j .Lreturn_result
|
||||
- .size caml_start_program, .-caml_start_program
|
||||
+ store TRAP_PTR, caml_exception_pointer, TMP0
|
||||
+ ori a0, a0, 2
|
||||
+ j .Lreturn_result
|
||||
+ .size caml_start_program, .-caml_start_program
|
||||
|
||||
/* Callback from C to OCaml */
|
||||
|
||||
- .align 2
|
||||
- .globl caml_callback_exn
|
||||
- .type caml_callback_exn, @function
|
||||
+ .align 2
|
||||
+ .globl caml_callback_exn
|
||||
+ .type caml_callback_exn, @function
|
||||
caml_callback_exn:
|
||||
/* Initial shuffling of arguments (a0 = closure, a1 = first arg) */
|
||||
- mv TMP1, a0
|
||||
- mv a0, a1 /* a0 = first arg */
|
||||
- mv a1, TMP1 /* a1 = closure environment */
|
||||
- load ARG, 0(TMP1) /* code pointer */
|
||||
- j .Ljump_to_caml
|
||||
- .size caml_callback_exn, .-caml_callback_exn
|
||||
+ mv TMP1, a0
|
||||
+ mv a0, a1 /* a0 = first arg */
|
||||
+ mv a1, TMP1 /* a1 = closure environment */
|
||||
+ load ARG, 0(TMP1) /* code pointer */
|
||||
+ j .Ljump_to_caml
|
||||
+ .size caml_callback_exn, .-caml_callback_exn
|
||||
|
||||
- .align 2
|
||||
- .globl caml_callback2_exn
|
||||
- .type caml_callback2_exn, @function
|
||||
+ .align 2
|
||||
+ .globl caml_callback2_exn
|
||||
+ .type caml_callback2_exn, @function
|
||||
caml_callback2_exn:
|
||||
/* Initial shuffling of arguments (a0 = closure, a1 = arg1, a2 = arg2) */
|
||||
- mv TMP1, a0
|
||||
- mv a0, a1
|
||||
- mv a1, a2
|
||||
- mv a2, TMP1
|
||||
- la ARG, caml_apply2
|
||||
- j .Ljump_to_caml
|
||||
- .size caml_callback2_exn, .-caml_callback2_exn
|
||||
+ mv TMP1, a0
|
||||
+ mv a0, a1
|
||||
+ mv a1, a2
|
||||
+ mv a2, TMP1
|
||||
+ la ARG, caml_apply2
|
||||
+ j .Ljump_to_caml
|
||||
+ .size caml_callback2_exn, .-caml_callback2_exn
|
||||
|
||||
- .align 2
|
||||
- .globl caml_callback3_exn
|
||||
- .type caml_callback3_exn, @function
|
||||
+ .align 2
|
||||
+ .globl caml_callback3_exn
|
||||
+ .type caml_callback3_exn, @function
|
||||
caml_callback3_exn:
|
||||
/* Initial shuffling of argumnets */
|
||||
/* (a0 = closure, a1 = arg1, a2 = arg2, a3 = arg3) */
|
||||
- mv TMP1, a0
|
||||
- mv a0, a1
|
||||
- mv a1, a2
|
||||
- mv a2, a3
|
||||
- mv a3, TMP1
|
||||
- la ARG, caml_apply3
|
||||
- j .Ljump_to_caml
|
||||
- .size caml_callback3_exn, .-caml_callback3_exn
|
||||
+ mv TMP1, a0
|
||||
+ mv a0, a1
|
||||
+ mv a1, a2
|
||||
+ mv a2, a3
|
||||
+ mv a3, TMP1
|
||||
+ la ARG, caml_apply3
|
||||
+ j .Ljump_to_caml
|
||||
+ .size caml_callback3_exn, .-caml_callback3_exn
|
||||
|
||||
- .align 2
|
||||
- .globl caml_ml_array_bound_error
|
||||
- .type caml_ml_array_bound_error, @function
|
||||
+ .align 2
|
||||
+ .globl caml_ml_array_bound_error
|
||||
+ .type caml_ml_array_bound_error, @function
|
||||
caml_ml_array_bound_error:
|
||||
/* Load address of [caml_array_bound_error] in ARG */
|
||||
- la ARG, caml_array_bound_error
|
||||
+ la ARG, caml_array_bound_error
|
||||
/* Call that function */
|
||||
- j caml_c_call
|
||||
+ j caml_c_call
|
||||
|
||||
- .globl caml_system__code_end
|
||||
+ .globl caml_system__code_end
|
||||
caml_system__code_end:
|
||||
|
||||
/* GC roots for callback */
|
||||
|
||||
- .section .data
|
||||
- .align 3
|
||||
- .globl caml_system__frametable
|
||||
- .type caml_system__frametable, @object
|
||||
+ .section .data
|
||||
+ .align 3
|
||||
+ .globl caml_system__frametable
|
||||
+ .type caml_system__frametable, @object
|
||||
caml_system__frametable:
|
||||
- .quad 1 /* one descriptor */
|
||||
- .quad .Lcaml_retaddr /* return address into callback */
|
||||
- .short -1 /* negative frame size => use callback link */
|
||||
- .short 0 /* no roots */
|
||||
- .align 3
|
||||
- .size caml_system__frametable, .-caml_system__frametable
|
||||
+ .quad 1 /* one descriptor */
|
||||
+ .quad .Lcaml_retaddr /* return address into callback */
|
||||
+ .short -1 /* negative frame size => use callback link */
|
||||
+ .short 0 /* no roots */
|
||||
+ .align 3
|
||||
+ .size caml_system__frametable, .-caml_system__frametable
|
||||
--
|
||||
2.17.1
|
||||
|
25
0006-fix-caml_c_call-reload-caml_young_limit.patch
Normal file
25
0006-fix-caml_c_call-reload-caml_young_limit.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 207fbbc2616ee44e048dd5bb133e52f252cd1caf Mon Sep 17 00:00:00 2001
|
||||
From: Nicolas Ojeda Bar <n.oje.bar@gmail.com>
|
||||
Date: Sat, 2 Dec 2017 10:44:41 +0100
|
||||
Subject: [PATCH 6/8] fix caml_c_call: reload caml_young_limit
|
||||
|
||||
---
|
||||
asmrun/riscv.S | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/asmrun/riscv.S b/asmrun/riscv.S
|
||||
index 88d7ab924..121f8ba71 100644
|
||||
--- a/asmrun/riscv.S
|
||||
+++ b/asmrun/riscv.S
|
||||
@@ -187,7 +187,7 @@ caml_c_call:
|
||||
jalr ARG
|
||||
/* Reload alloc ptr and alloc limit */
|
||||
load ALLOC_PTR, caml_young_ptr
|
||||
- load TRAP_PTR, caml_exception_pointer
|
||||
+ load ALLOC_LIMIT, caml_young_limit
|
||||
/* Return */
|
||||
jr s2
|
||||
.size caml_c_call, .-caml_c_call
|
||||
--
|
||||
2.17.1
|
||||
|
67
0007-Adapt-to-4.07.patch
Normal file
67
0007-Adapt-to-4.07.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From a89427d52a20633be40056fe008b7eeec5ded7dd Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Nicol=C3=A1s=20Ojeda=20B=C3=A4r?= <n.oje.bar@gmail.com>
|
||||
Date: Tue, 15 May 2018 07:17:06 +0000
|
||||
Subject: [PATCH 7/8] Adapt to 4.07
|
||||
|
||||
---
|
||||
asmcomp/riscv/emit.mlp | 28 +++++++++++++++++-----------
|
||||
asmcomp/riscv/selection.ml | 2 +-
|
||||
2 files changed, 18 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/asmcomp/riscv/emit.mlp b/asmcomp/riscv/emit.mlp
|
||||
index 51165d0f1..718dca080 100644
|
||||
--- a/asmcomp/riscv/emit.mlp
|
||||
+++ b/asmcomp/riscv/emit.mlp
|
||||
@@ -461,19 +461,25 @@ let emit_instr i =
|
||||
` {emit_string name} {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}, {emit_label lbl}\n`
|
||||
| Iinttest_imm _ ->
|
||||
fatal_error "Emit.emit_instr (Iinttest_imm _)"
|
||||
- | Ifloattest(cmp, neg) ->
|
||||
- let neg = match cmp with
|
||||
- | Ceq -> ` feq.d {emit_reg reg_tmp1}, {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`; neg
|
||||
- | Cne -> ` feq.d {emit_reg reg_tmp1}, {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`; not neg
|
||||
- | Clt -> ` flt.d {emit_reg reg_tmp1}, {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`; neg
|
||||
- | Cgt -> ` flt.d {emit_reg reg_tmp1}, {emit_reg i.arg.(1)}, {emit_reg i.arg.(0)}\n`; neg
|
||||
- | Cle -> ` fle.d {emit_reg reg_tmp1}, {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`; neg
|
||||
- | Cge -> ` fle.d {emit_reg reg_tmp1}, {emit_reg i.arg.(1)}, {emit_reg i.arg.(0)}\n`; neg
|
||||
- in
|
||||
- if neg then
|
||||
+ | Ifloattest cmp ->
|
||||
+ begin match cmp with
|
||||
+ | CFeq | CFneq ->
|
||||
+ ` feq.d {emit_reg reg_tmp1}, {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`
|
||||
+ | CFlt | CFnlt ->
|
||||
+ ` flt.d {emit_reg reg_tmp1}, {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`
|
||||
+ | CFgt | CFngt ->
|
||||
+ ` flt.d {emit_reg reg_tmp1}, {emit_reg i.arg.(1)}, {emit_reg i.arg.(0)}\n`
|
||||
+ | CFle | CFnle ->
|
||||
+ ` fle.d {emit_reg reg_tmp1}, {emit_reg i.arg.(0)}, {emit_reg i.arg.(1)}\n`
|
||||
+ | CFge | CFnge ->
|
||||
+ ` fle.d {emit_reg reg_tmp1}, {emit_reg i.arg.(1)}, {emit_reg i.arg.(0)}\n`
|
||||
+ end;
|
||||
+ begin match cmp with
|
||||
+ | CFneq | CFnlt | CFngt | CFnle | CFnge ->
|
||||
` beqz {emit_reg reg_tmp1}, {emit_label lbl}\n`
|
||||
- else
|
||||
+ | CFeq | CFlt | CFgt | CFle | CFge ->
|
||||
` bnez {emit_reg reg_tmp1}, {emit_label lbl}\n`
|
||||
+ end
|
||||
| Ioddtest ->
|
||||
` andi {emit_reg reg_tmp1}, {emit_reg i.arg.(0)}, 1\n`;
|
||||
` bnez {emit_reg reg_tmp1}, {emit_label lbl}\n`
|
||||
diff --git a/asmcomp/riscv/selection.ml b/asmcomp/riscv/selection.ml
|
||||
index 092ca88aa..1f0af6abc 100644
|
||||
--- a/asmcomp/riscv/selection.ml
|
||||
+++ b/asmcomp/riscv/selection.ml
|
||||
@@ -61,7 +61,7 @@ method! select_condition = function
|
||||
| Cop(Ccmpa cmp, args, _) ->
|
||||
(Iinttest(Iunsigned cmp), Ctuple args)
|
||||
| Cop(Ccmpf cmp, args, _) ->
|
||||
- (Ifloattest(cmp, false), Ctuple args)
|
||||
+ (Ifloattest cmp, Ctuple args)
|
||||
| Cop(Cand, [arg; Cconst_int 1], _) ->
|
||||
(Ioddtest, arg)
|
||||
| arg ->
|
||||
--
|
||||
2.17.1
|
||||
|
40
0008-riscv-Emit-debug-info.patch
Normal file
40
0008-riscv-Emit-debug-info.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From af276d83f41cb9eb9f1e50a75a9be205c9b2fee6 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 5 Jun 2018 19:48:08 +0000
|
||||
Subject: [PATCH 8/8] riscv: Emit debug info.
|
||||
|
||||
---
|
||||
asmcomp/riscv/emit.mlp | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/asmcomp/riscv/emit.mlp b/asmcomp/riscv/emit.mlp
|
||||
index 718dca080..e42ee9770 100644
|
||||
--- a/asmcomp/riscv/emit.mlp
|
||||
+++ b/asmcomp/riscv/emit.mlp
|
||||
@@ -261,6 +261,7 @@ let tailrec_entry_point = ref 0
|
||||
(* Output the assembly code for an instruction *)
|
||||
|
||||
let emit_instr i =
|
||||
+ emit_debug_info i.dbg;
|
||||
match i.desc with
|
||||
Lend -> ()
|
||||
| Lop(Imove | Ispill | Ireload) ->
|
||||
@@ -560,6 +561,7 @@ let fundecl fundecl =
|
||||
emit_stack_adjustment (-n);
|
||||
if !contains_calls then store_ra n;
|
||||
`{emit_label !tailrec_entry_point}:\n`;
|
||||
+ emit_debug_info fundecl.fun_dbg;
|
||||
emit_all fundecl.fun_body;
|
||||
List.iter emit_call_gc !call_gc_sites;
|
||||
List.iter emit_call_bound_error !bound_error_sites;
|
||||
@@ -619,6 +621,7 @@ let data l =
|
||||
|
||||
let begin_assembly() =
|
||||
` .file \"\"\n`; (* PR#7073 *)
|
||||
+ reset_debug_info ();
|
||||
(* Emit the beginning of the segments *)
|
||||
let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
|
||||
` {emit_string data_space}\n`;
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 441ad77a0c89f4abdf104c668d579607f338a052 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 29 May 2012 20:44:18 +0100
|
||||
Subject: [PATCH 2/6] configure: Allow user defined C compiler flags.
|
||||
|
||||
---
|
||||
configure.ac | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index aa5f26f28..5153853b7 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -609,6 +609,10 @@ AS_CASE([$host],
|
||||
internal_cflags="$gcc_warnings"],
|
||||
[common_cflags="-O"])])
|
||||
|
||||
+# Allow CFLAGS and LDFLAGS to be added.
|
||||
+common_cflags="$common_cflags $CFLAGS"
|
||||
+cclibs="$cclibs $LDFLAGS"
|
||||
+
|
||||
internal_cppflags="-DCAML_NAME_SPACE $internal_cppflags"
|
||||
|
||||
# Enable SSE2 on x86 mingw to avoid using 80-bit registers.
|
||||
--
|
||||
2.32.0
|
||||
|
@ -1,43 +0,0 @@
|
||||
From 3318c5b805d8d6ae1d571f18f682c9f701b712e2 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 26 Apr 2019 16:16:29 +0100
|
||||
Subject: [PATCH 3/6] configure: Remove incorrect assumption about
|
||||
cross-compiling.
|
||||
|
||||
See https://github.com/ocaml/ocaml/issues/8647#issuecomment-487094390
|
||||
---
|
||||
configure.ac | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 5153853b7..4e97474a2 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -511,10 +511,11 @@ AS_IF(
|
||||
|
||||
# Are we building a cross-compiler
|
||||
|
||||
-AS_IF(
|
||||
- [test x"$host" = x"$target"],
|
||||
- [cross_compiler=false],
|
||||
- [cross_compiler=true])
|
||||
+#AS_IF(
|
||||
+# [test x"$host" = x"$target"],
|
||||
+# [cross_compiler=false],
|
||||
+# [cross_compiler=true])
|
||||
+cross_compiler=false
|
||||
|
||||
# Checks for programs
|
||||
|
||||
@@ -1021,7 +1022,7 @@ AS_CASE([$arch],
|
||||
|
||||
# Assembler
|
||||
|
||||
-AS_IF([test -n "$host_alias"], [toolpref="${host_alias}-"], [toolpref=""])
|
||||
+#AS_IF([test -n "$host_alias"], [toolpref="${host_alias}-"], [toolpref=""])
|
||||
|
||||
# We first compute default values for as and aspp
|
||||
# If values have been given by the user then they take precedence over
|
||||
--
|
||||
2.32.0
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 01d8e3f82adb382fb90af15879f722e824834c84 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 18 Jan 2020 11:31:27 +0000
|
||||
Subject: [PATCH 4/6] Remove configure from .gitattributes.
|
||||
|
||||
It's not a binary file.
|
||||
---
|
||||
.gitattributes | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
diff --git a/.gitattributes b/.gitattributes
|
||||
index 200eb49c6..d871764de 100644
|
||||
--- a/.gitattributes
|
||||
+++ b/.gitattributes
|
||||
@@ -29,10 +29,6 @@
|
||||
|
||||
/boot/menhir/parser.ml* -diff
|
||||
|
||||
-# configure is declared as binary so that it doesn't get included in diffs.
|
||||
-# This also means it will have the correct Unix line-endings, even on Windows.
|
||||
-/configure binary
|
||||
-
|
||||
# 'union' merge driver just unions textual content in case of conflict
|
||||
# http://krlmlr.github.io/using-gitattributes-to-avoid-merge-conflicts/
|
||||
/.mailmap merge=union
|
||||
--
|
||||
2.32.0
|
||||
|
@ -1,69 +0,0 @@
|
||||
From 122db7141d292d63cfbe2c7d7a4280cc73194ece Mon Sep 17 00:00:00 2001
|
||||
From: Xavier Leroy <xavierleroy@users.noreply.github.com>
|
||||
Date: Wed, 5 Aug 2020 11:17:52 +0200
|
||||
Subject: [PATCH 5/6] Fix type mismatches between definition and declaration
|
||||
(#9830)
|
||||
|
||||
The C global variable caml_fl_merge and the C function
|
||||
caml_spacetime_my_profinfo (bytecode version) were declared and
|
||||
defined with different types. This is undefined behavior and
|
||||
can cause link-time errors with link-time optimization (LTO).
|
||||
|
||||
Closes: #9825
|
||||
---
|
||||
runtime/major_gc.c | 4 ++--
|
||||
runtime/spacetime_byt.c | 7 ++++++-
|
||||
2 files changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/runtime/major_gc.c b/runtime/major_gc.c
|
||||
index 5e4f06bce..c8f5a3281 100644
|
||||
--- a/runtime/major_gc.c
|
||||
+++ b/runtime/major_gc.c
|
||||
@@ -63,7 +63,7 @@ uintnat caml_dependent_size, caml_dependent_allocated;
|
||||
double caml_extra_heap_resources;
|
||||
uintnat caml_fl_wsz_at_phase_change = 0;
|
||||
|
||||
-extern char *caml_fl_merge; /* Defined in freelist.c. */
|
||||
+extern value caml_fl_merge; /* Defined in freelist.c. */
|
||||
|
||||
static char *markhp, *chunk, *limit;
|
||||
static double p_backlog = 0.0; /* backlog for the gc speedup parameter */
|
||||
@@ -570,7 +570,7 @@ static void sweep_slice (intnat work)
|
||||
break;
|
||||
case Caml_blue:
|
||||
/* Only the blocks of the free-list are blue. See [freelist.c]. */
|
||||
- caml_fl_merge = Bp_hp (hp);
|
||||
+ caml_fl_merge = (value) Bp_hp (hp);
|
||||
break;
|
||||
default: /* gray or black */
|
||||
CAMLassert (Color_hd (hd) == Caml_black);
|
||||
diff --git a/runtime/spacetime_byt.c b/runtime/spacetime_byt.c
|
||||
index 2b0bf1dc2..b75fb0980 100644
|
||||
--- a/runtime/spacetime_byt.c
|
||||
+++ b/runtime/spacetime_byt.c
|
||||
@@ -12,8 +12,12 @@
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
+#define CAML_INTERNALS
|
||||
+
|
||||
#include "caml/fail.h"
|
||||
#include "caml/mlvalues.h"
|
||||
+#include "caml/io.h"
|
||||
+#include "caml/spacetime.h"
|
||||
|
||||
int caml_ensure_spacetime_dot_o_is_included = 42;
|
||||
|
||||
@@ -22,7 +26,8 @@ CAMLprim value caml_spacetime_only_works_for_native_code(value foo, ...)
|
||||
caml_failwith("Spacetime profiling only works for native code");
|
||||
}
|
||||
|
||||
-uintnat caml_spacetime_my_profinfo (void)
|
||||
+uintnat caml_spacetime_my_profinfo (spacetime_unwind_info_cache * cached,
|
||||
+ uintnat wosize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.32.0
|
||||
|
@ -1,103 +0,0 @@
|
||||
From 24a9db7784ddfcf0af2d2be2f51616ed960ae7e8 Mon Sep 17 00:00:00 2001
|
||||
From: Xavier Leroy <xavierleroy@users.noreply.github.com>
|
||||
Date: Fri, 5 Mar 2021 19:14:07 +0100
|
||||
Subject: [PATCH 6/6] Dynamically allocate the alternate signal stack (#10266)
|
||||
|
||||
In Glibc 2.34 and later, SIGSTKSZ may not be a compile-time constant.
|
||||
It is no longer possible to statically allocate the alternate signal
|
||||
stack for the main thread, as we've been doing for the last 25 years.
|
||||
|
||||
This commit implements dynamic allocation of the alternate signal stack
|
||||
even for the main thread. It reuses the code already in place to allocate
|
||||
the alternate signal stack for other threads.
|
||||
|
||||
Fixes: #10250.
|
||||
(cherry picked from commit fc9534746bf5d08a4c109f22e344cf49d5d46d54)
|
||||
---
|
||||
runtime/caml/signals.h | 2 +-
|
||||
runtime/signals_byt.c | 2 +-
|
||||
runtime/signals_nat.c | 25 ++++++++++++++-----------
|
||||
3 files changed, 16 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/runtime/caml/signals.h b/runtime/caml/signals.h
|
||||
index 7ec1ad3ba..98b75107b 100644
|
||||
--- a/runtime/caml/signals.h
|
||||
+++ b/runtime/caml/signals.h
|
||||
@@ -82,7 +82,7 @@ void caml_set_action_pending (void);
|
||||
value caml_do_pending_actions_exn (void);
|
||||
value caml_process_pending_actions_with_root (value extra_root); // raises
|
||||
int caml_set_signal_action(int signo, int action);
|
||||
-void caml_setup_stack_overflow_detection(void);
|
||||
+CAMLextern int caml_setup_stack_overflow_detection(void);
|
||||
|
||||
CAMLextern void (*caml_enter_blocking_section_hook)(void);
|
||||
CAMLextern void (*caml_leave_blocking_section_hook)(void);
|
||||
diff --git a/runtime/signals_byt.c b/runtime/signals_byt.c
|
||||
index 040de03c5..9bd2b20c6 100644
|
||||
--- a/runtime/signals_byt.c
|
||||
+++ b/runtime/signals_byt.c
|
||||
@@ -86,4 +86,4 @@ int caml_set_signal_action(int signo, int action)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-void caml_setup_stack_overflow_detection(void) {}
|
||||
+CAMLexport int caml_setup_stack_overflow_detection(void) { return 0; }
|
||||
diff --git a/runtime/signals_nat.c b/runtime/signals_nat.c
|
||||
index fc5a77f84..f56fce6b7 100644
|
||||
--- a/runtime/signals_nat.c
|
||||
+++ b/runtime/signals_nat.c
|
||||
@@ -195,8 +195,6 @@ DECLARE_SIGNAL_HANDLER(trap_handler)
|
||||
#error "CONTEXT_SP is required if HAS_STACK_OVERFLOW_DETECTION is defined"
|
||||
#endif
|
||||
|
||||
-static char sig_alt_stack[SIGSTKSZ];
|
||||
-
|
||||
/* Code compiled with ocamlopt never accesses more than
|
||||
EXTRA_STACK bytes below the stack pointer. */
|
||||
#define EXTRA_STACK 256
|
||||
@@ -282,28 +280,33 @@ void caml_init_signals(void)
|
||||
#endif
|
||||
|
||||
#ifdef HAS_STACK_OVERFLOW_DETECTION
|
||||
- {
|
||||
- stack_t stk;
|
||||
+ if (caml_setup_stack_overflow_detection() != -1) {
|
||||
struct sigaction act;
|
||||
- stk.ss_sp = sig_alt_stack;
|
||||
- stk.ss_size = SIGSTKSZ;
|
||||
- stk.ss_flags = 0;
|
||||
SET_SIGACT(act, segv_handler);
|
||||
act.sa_flags |= SA_ONSTACK | SA_NODEFER;
|
||||
sigemptyset(&act.sa_mask);
|
||||
- if (sigaltstack(&stk, NULL) == 0) { sigaction(SIGSEGV, &act, NULL); }
|
||||
+ sigaction(SIGSEGV, &act, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
-void caml_setup_stack_overflow_detection(void)
|
||||
+/* Allocate and select an alternate stack for handling signals,
|
||||
+ especially SIGSEGV signals.
|
||||
+ Each thread needs its own alternate stack.
|
||||
+ The alternate stack used to be statically-allocated for the main thread,
|
||||
+ but this is incompatible with Glibc 2.34 and newer, where SIGSTKSZ
|
||||
+ may not be a compile-time constant (issue #10250). */
|
||||
+
|
||||
+CAMLexport int caml_setup_stack_overflow_detection(void)
|
||||
{
|
||||
#ifdef HAS_STACK_OVERFLOW_DETECTION
|
||||
stack_t stk;
|
||||
stk.ss_sp = malloc(SIGSTKSZ);
|
||||
+ if (stk.ss_sp == NULL) return -1;
|
||||
stk.ss_size = SIGSTKSZ;
|
||||
stk.ss_flags = 0;
|
||||
- if (stk.ss_sp)
|
||||
- sigaltstack(&stk, NULL);
|
||||
+ return sigaltstack(&stk, NULL);
|
||||
+#else
|
||||
+ return 0;
|
||||
#endif
|
||||
}
|
||||
--
|
||||
2.32.0
|
||||
|
6
gating.yaml
Normal file
6
gating.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-8
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
@ -17,21 +17,17 @@
|
||||
|
||||
# These are all the architectures that the tests run on. The tests
|
||||
# take a long time to run, so don't run them on slow machines.
|
||||
%global test_arches aarch64 %{power64} riscv64 x86_64
|
||||
%global test_arches aarch64 %{power64} x86_64
|
||||
# These are the architectures for which the tests must pass otherwise
|
||||
# the build will fail.
|
||||
#global test_arches_required aarch64 ppc64le x86_64
|
||||
%global test_arches_required NONE
|
||||
%global test_arches_required aarch64 x86_64
|
||||
|
||||
# Architectures where parallel builds fail.
|
||||
#global no_parallel_build_arches aarch64
|
||||
|
||||
#global rcver +git
|
||||
%global rcver %{nil}
|
||||
#%global no_parallel_build_arches aarch64
|
||||
|
||||
Name: ocaml
|
||||
Version: 4.11.1
|
||||
Release: 5%{?dist}.2
|
||||
Version: 4.07.0
|
||||
Release: 3%{?dist}
|
||||
|
||||
Summary: OCaml compiler and programming environment
|
||||
|
||||
@ -39,8 +35,7 @@ License: QPL and (LGPLv2+ with exceptions)
|
||||
|
||||
URL: http://www.ocaml.org
|
||||
|
||||
Source0: https://caml.inria.fr/pub/distrib/ocaml-4.11/ocaml-%{version}.tar.xz
|
||||
#Source0: https://github.com/ocaml/ocaml/archive/%%{version}.tar.gz
|
||||
Source0: http://caml.inria.fr/pub/distrib/ocaml-4.07/ocaml-%{version}.tar.xz
|
||||
|
||||
# IMPORTANT NOTE:
|
||||
#
|
||||
@ -51,40 +46,49 @@ Source0: https://caml.inria.fr/pub/distrib/ocaml-4.11/ocaml-%{version}.ta
|
||||
#
|
||||
# https://pagure.io/fedora-ocaml
|
||||
#
|
||||
# Current branch: fedora-34-4.11.1
|
||||
# Current branch: fedora-29-4.07.0
|
||||
#
|
||||
# ALTERNATIVELY add a patch to the end of the list (leaving the
|
||||
# existing patches unchanged) adding a comment to note that it should
|
||||
# be incorporated into the git repo at a later time.
|
||||
#
|
||||
|
||||
# Fedora-specific downstream patches.
|
||||
Patch0001: 0001-Don-t-add-rpaths-to-libraries.patch
|
||||
Patch0002: 0002-configure-Allow-user-defined-C-compiler-flags.patch
|
||||
Patch0003: 0003-configure-Remove-incorrect-assumption-about-cross-co.patch
|
||||
Patch0004: 0004-Remove-configure-from-.gitattributes.patch
|
||||
Patch0002: 0002-ocamlbyteinfo-ocamlplugininfo-Useful-utilities-from-.patch
|
||||
Patch0003: 0003-configure-Allow-user-defined-C-compiler-flags.patch
|
||||
|
||||
# Fix compilation with LTO (upstream, but not in 4.11 branch).
|
||||
Patch0005: 0005-Fix-type-mismatches-between-definition-and-declarati.patch
|
||||
# Out of tree patch for RISC-V support.
|
||||
# https://github.com/nojb/riscv-ocaml
|
||||
Patch0004: 0004-Add-RISC-V-backend.patch
|
||||
Patch0005: 0005-Copyright-untabify.patch
|
||||
Patch0006: 0006-fix-caml_c_call-reload-caml_young_limit.patch
|
||||
Patch0007: 0007-Adapt-to-4.07.patch
|
||||
|
||||
# Upstream patch for non-constant SIGSTKSZ in glibc 2.34
|
||||
Patch0006: 0006-Dynamically-allocate-the-alternate-signal-stack-1026.patch
|
||||
# RISC-V patch to add debuginfo (DWARF) generation.
|
||||
# Sent upstream 2018-06-05.
|
||||
Patch0008: 0008-riscv-Emit-debug-info.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: git
|
||||
BuildRequires: gcc
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: binutils-devel
|
||||
BuildRequires: ncurses-devel
|
||||
BuildRequires: gdbm-devel
|
||||
BuildRequires: emacs
|
||||
BuildRequires: gawk
|
||||
BuildRequires: perl-interpreter
|
||||
BuildRequires: util-linux
|
||||
BuildRequires: /usr/bin/annocheck
|
||||
BuildRequires: libICE-devel
|
||||
BuildRequires: libSM-devel
|
||||
BuildRequires: libX11-devel
|
||||
BuildRequires: libXaw-devel
|
||||
BuildRequires: libXext-devel
|
||||
BuildRequires: libXft-devel
|
||||
BuildRequires: libXmu-devel
|
||||
BuildRequires: libXrender-devel
|
||||
BuildRequires: libXt-devel
|
||||
BuildRequires: chrpath
|
||||
|
||||
# ocamlopt runs gcc to link binaries. Because Fedora includes
|
||||
# hardening flags automatically, redhat-rpm-config is also required.
|
||||
Requires: gcc
|
||||
Requires: redhat-rpm-config
|
||||
|
||||
# Because we pass -c flag to ocaml-find-requires (to avoid circular
|
||||
# dependencies) we also have to explicitly depend on the right version
|
||||
@ -131,6 +135,15 @@ Requires: ocaml = %{version}-%{release}
|
||||
Source code for OCaml libraries.
|
||||
|
||||
|
||||
%package x11
|
||||
Summary: X11 support for OCaml
|
||||
Requires: ocaml-runtime = %{version}-%{release}
|
||||
Requires: libX11-devel
|
||||
|
||||
%description x11
|
||||
X11 support for OCaml.
|
||||
|
||||
|
||||
%package ocamldoc
|
||||
Summary: Documentation generator for OCaml
|
||||
Requires: ocaml = %{version}-%{release}
|
||||
@ -140,9 +153,20 @@ Provides: ocamldoc
|
||||
Documentation generator for OCaml.
|
||||
|
||||
|
||||
%package emacs
|
||||
Summary: Emacs mode for OCaml
|
||||
Requires: ocaml = %{version}-%{release}
|
||||
Requires: emacs(bin)
|
||||
|
||||
%description emacs
|
||||
Emacs mode for OCaml.
|
||||
|
||||
|
||||
%package docs
|
||||
Summary: Documentation for OCaml
|
||||
Requires: ocaml = %{version}-%{release}
|
||||
Requires(post): /sbin/install-info
|
||||
Requires(preun): /sbin/install-info
|
||||
|
||||
|
||||
%description docs
|
||||
@ -168,52 +192,44 @@ may not be portable between versions.
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -S git -n %{name}-%{version}%{rcver}
|
||||
# Patches touch configure.ac, so rebuild it:
|
||||
autoconf --force
|
||||
%setup -q -T -b 0 -n %{name}-%{version}
|
||||
%autopatch -p1
|
||||
|
||||
|
||||
%build
|
||||
%ifnarch %{no_parallel_build_arches}
|
||||
make="%make_build"
|
||||
make="make %{?_smp_mflags}"
|
||||
%else
|
||||
unset MAKEFLAGS
|
||||
make=make
|
||||
%endif
|
||||
|
||||
# We set --libdir to the unusual directory because we want OCaml to
|
||||
# install its libraries and other files into a subdirectory.
|
||||
#
|
||||
# Force --host because of:
|
||||
# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/2O4HBOK6PTQZAFAVIRDVMZGG2PYB2QHM/
|
||||
# (see also https://github.com/ocaml/ocaml/issues/8647)
|
||||
#
|
||||
# OC_CFLAGS/OC_LDFLAGS control what flags OCaml passes to the linker
|
||||
# when doing final linking of OCaml binaries. Setting these is
|
||||
# necessary to ensure that generated binaries have Fedora hardening
|
||||
# features.
|
||||
%configure \
|
||||
OC_CFLAGS="$CFLAGS" \
|
||||
OC_LDFLAGS="$LDFLAGS" \
|
||||
--libdir=%{_libdir}/ocaml \
|
||||
--host=`./build-aux/config.guess`
|
||||
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
|
||||
./configure \
|
||||
-bindir %{_bindir} \
|
||||
-libdir %{_libdir}/ocaml \
|
||||
-x11lib %{_libdir} \
|
||||
-x11include %{_includedir} \
|
||||
-mandir %{_mandir}/man1 \
|
||||
-no-curses
|
||||
$make world
|
||||
%if %{native_compiler}
|
||||
$make opt
|
||||
$make opt.opt
|
||||
%endif
|
||||
make -C emacs ocamltags
|
||||
|
||||
# Currently these tools are supplied by Debian, but are expected
|
||||
# to go upstream at some point.
|
||||
includes="-nostdlib -I stdlib -I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver -I otherlibs/unix -I otherlibs/str -I otherlibs/dynlink"
|
||||
boot/ocamlrun ./ocamlc $includes dynlinkaux.cmo ocamlbyteinfo.ml -o ocamlbyteinfo
|
||||
# ocamlplugininfo doesn't compile because it needs 'dynheader' (type
|
||||
# decl) and I have no idea where that comes from
|
||||
#cp otherlibs/dynlink/natdynlink.ml .
|
||||
#boot/ocamlrun ./ocamlopt $includes unix.cmxa str.cmxa natdynlink.ml ocamlplugininfo.ml -o ocamlplugininfo
|
||||
|
||||
|
||||
%check
|
||||
%ifarch %{ocaml_native_compiler}
|
||||
# For information only, compile a binary and dump the annocheck data
|
||||
# from it. Useful so we know if hardening is being enabled, but don't
|
||||
# fail because not every hardening feature can be enabled here.
|
||||
echo 'print_endline "hello, world"' > hello.ml
|
||||
./ocamlopt.opt -verbose -I stdlib hello.ml -o hello ||:
|
||||
annocheck -v hello ||:
|
||||
%endif
|
||||
|
||||
%ifarch %{test_arches}
|
||||
cd testsuite
|
||||
|
||||
@ -226,33 +242,46 @@ make -j1 all ||:
|
||||
|
||||
|
||||
%install
|
||||
%make_install
|
||||
make install \
|
||||
BINDIR=$RPM_BUILD_ROOT%{_bindir} \
|
||||
LIBDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml \
|
||||
MANDIR=$RPM_BUILD_ROOT%{_mandir}
|
||||
perl -pi -e "s|^$RPM_BUILD_ROOT||" $RPM_BUILD_ROOT%{_libdir}/ocaml/ld.conf
|
||||
|
||||
(
|
||||
# install emacs files
|
||||
cd emacs;
|
||||
make install \
|
||||
BINDIR=$RPM_BUILD_ROOT%{_bindir} \
|
||||
EMACSDIR=$RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
|
||||
make install-ocamltags BINDIR=$RPM_BUILD_ROOT%{_bindir}
|
||||
)
|
||||
|
||||
echo %{version} > $RPM_BUILD_ROOT%{_libdir}/ocaml/fedora-ocaml-release
|
||||
|
||||
# Remove rpaths from stublibs .so files.
|
||||
chrpath --delete $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs/*.so
|
||||
|
||||
install -m 0755 ocamlbyteinfo $RPM_BUILD_ROOT%{_bindir}
|
||||
#install -m 0755 ocamlplugininfo $RPM_BUILD_ROOT%{_bindir}
|
||||
|
||||
find $RPM_BUILD_ROOT -name .ignore -delete
|
||||
|
||||
# Remove .cmt and .cmti files, for now. We could package them later.
|
||||
# See also: http://www.ocamlpro.com/blog/2012/08/20/ocamlpro-and-4.00.0.html
|
||||
find $RPM_BUILD_ROOT \( -name '*.cmt' -o -name '*.cmti' \) -a -delete
|
||||
|
||||
# Remove this file. It's only created in certain situations and it's
|
||||
# unclear why it is created at all.
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
|
||||
|
||||
|
||||
%files
|
||||
%doc LICENSE
|
||||
%{_bindir}/ocaml
|
||||
|
||||
%{_bindir}/ocamlbyteinfo
|
||||
%{_bindir}/ocamlcmt
|
||||
%{_bindir}/ocamldebug
|
||||
#{_bindir}/ocaml-instr-graph
|
||||
#{_bindir}/ocaml-instr-report
|
||||
%{_bindir}/ocaml-instr-graph
|
||||
%{_bindir}/ocaml-instr-report
|
||||
#%{_bindir}/ocamlplugininfo
|
||||
%{_bindir}/ocamlyacc
|
||||
|
||||
# symlink to either .byte or .opt version
|
||||
@ -317,13 +346,15 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
|
||||
%{_libdir}/ocaml/*.mli
|
||||
%{_libdir}/ocaml/libcamlrun_shared.so
|
||||
%{_libdir}/ocaml/objinfo_helper
|
||||
%{_libdir}/ocaml/threads/*.mli
|
||||
%{_libdir}/ocaml/vmthreads/*.mli
|
||||
%{_libdir}/ocaml/vmthreads/*.a
|
||||
%if %{native_compiler}
|
||||
%{_libdir}/ocaml/threads/*.a
|
||||
%{_libdir}/ocaml/threads/*.cmxa
|
||||
%{_libdir}/ocaml/threads/*.cmx
|
||||
%endif
|
||||
%{_libdir}/ocaml/caml
|
||||
%exclude %{_libdir}/ocaml/graphicsX11.mli
|
||||
|
||||
|
||||
%files runtime
|
||||
@ -336,13 +367,17 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
|
||||
%{_libdir}/ocaml/*.cmo
|
||||
%{_libdir}/ocaml/*.cmi
|
||||
%{_libdir}/ocaml/*.cma
|
||||
%{_libdir}/ocaml/camlheaderd
|
||||
%{_libdir}/ocaml/camlheaderi
|
||||
%{_libdir}/ocaml/stublibs
|
||||
%{_libdir}/ocaml/target_camlheaderd
|
||||
%{_libdir}/ocaml/target_camlheaderi
|
||||
%dir %{_libdir}/ocaml/vmthreads
|
||||
%{_libdir}/ocaml/vmthreads/*.cmi
|
||||
%{_libdir}/ocaml/vmthreads/*.cma
|
||||
%dir %{_libdir}/ocaml/threads
|
||||
%{_libdir}/ocaml/threads/*.cmi
|
||||
%{_libdir}/ocaml/threads/*.cma
|
||||
%{_libdir}/ocaml/fedora-ocaml-release
|
||||
%exclude %{_libdir}/ocaml/graphicsX11.cmi
|
||||
|
||||
|
||||
%files source
|
||||
@ -350,6 +385,12 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
|
||||
%{_libdir}/ocaml/*.ml
|
||||
|
||||
|
||||
%files x11
|
||||
%doc LICENSE
|
||||
%{_libdir}/ocaml/graphicsX11.cmi
|
||||
%{_libdir}/ocaml/graphicsX11.mli
|
||||
|
||||
|
||||
%files ocamldoc
|
||||
%doc LICENSE
|
||||
%doc ocamldoc/Changes.txt
|
||||
@ -362,6 +403,12 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
|
||||
%{_mandir}/man3/*
|
||||
|
||||
|
||||
%files emacs
|
||||
%doc emacs/README
|
||||
%{_datadir}/emacs/site-lisp/*
|
||||
%{_bindir}/ocamltags
|
||||
|
||||
|
||||
%files compiler-libs
|
||||
%doc LICENSE
|
||||
%dir %{_libdir}/ocaml/compiler-libs
|
||||
@ -378,121 +425,8 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Mar 11 2022 Richard W.M. Jones <rjones@redhat.com> - 4.11.1-5.2
|
||||
- Rebuild for EPEL
|
||||
resolves: rhbz#2060850
|
||||
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 4.11.1-4.2
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
||||
* Fri Aug 6 2021 Florian Weimer <fweimer@redhat.com> - 4.11.1-3.2
|
||||
- Rebuild to pick up new build flags from redhat-rpm-config (#1984652)
|
||||
|
||||
* Wed Jun 23 2021 Richard W.M. Jones <rjones@redhat.com> - 4.11.1-3.el9.1
|
||||
- Upstream patch for non-constant SIGSTKSZ in glibc 2.34
|
||||
|
||||
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 4.11.1-3
|
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.11.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Tue Sep 01 2020 Richard W.M. Jones <rjones@redhat.com> - 4.11.1-1
|
||||
- OCaml 4.11.1 release (RHBZ#1870368#c26).
|
||||
|
||||
* Fri Aug 21 2020 Richard W.M. Jones <rjones@redhat.com> - 4.11.0-1
|
||||
- OCaml 4.11.0 release (RHBZ#1870368).
|
||||
|
||||
* Tue Aug 04 2020 Richard W.M. Jones <rjones@redhat.com> - 4.11.0-0.9.dev2
|
||||
- Bump and rebuild to fix DWARF versioning issues.
|
||||
- Enable LTO again.
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.11.0-0.7.dev2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue Jul 14 2020 Tom Stellard <tstellar@redhat.com> - 4.11.0-0.6.dev2
|
||||
- Use make macros
|
||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
||||
|
||||
* Wed Jul 01 2020 Jeff Law <law@redhat.com> - 4.11.0-0.5.dev2.fc33
|
||||
- Disable LTO
|
||||
|
||||
* Mon May 04 2020 Richard W.M. Jones <rjones@redhat.com> - 4.11.0-0.4.dev2.fc33
|
||||
- Move to OCaml 4.11.0+dev2-2020-04-22.
|
||||
- Backport upstream RISC-V backend from 4.12 + fixes.
|
||||
- Enable tests on riscv64.
|
||||
- Disable ocaml-instr-* tools on riscv64.
|
||||
|
||||
* Tue Apr 21 2020 Richard W.M. Jones <rjones@redhat.com> - 4.11.0-0.3.pre.fc33
|
||||
- Add fixes for various issues found in the previous build.
|
||||
|
||||
* Fri Apr 17 2020 Richard W.M. Jones <rjones@redhat.com> - 4.11.0-0.2.pre.fc33
|
||||
- Move to OCaml 4.11.0 pre-release with support for RISC-V.
|
||||
|
||||
* Sat Apr 11 2020 Richard W.M. Jones <rjones@redhat.com> - 4.10.0-4.fc33
|
||||
- Fix RISC-V backend.
|
||||
|
||||
* Thu Apr 02 2020 Richard W.M. Jones <rjones@redhat.com> - 4.10.0-3.fc33
|
||||
- Update all OCaml dependencies for RPM 4.16.
|
||||
|
||||
* Thu Feb 27 2020 Richard W.M. Jones <rjones@redhat.com> - 4.10.0-2.fc33
|
||||
- Add dist tag.
|
||||
|
||||
* Tue Feb 25 2020 Richard W.M. Jones <rjones@redhat.com> - 4.10.0-1
|
||||
- OCaml 4.10.0 final.
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.10.0-0.beta1.0.1
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Sat Jan 18 2020 Richard W.M. Jones <rjones@redhat.com> - 4.10.0-0.beta1
|
||||
- OCaml 4.10.0+beta1.
|
||||
|
||||
* Tue Jan 07 2020 Richard W.M. Jones <rjones@redhat.com> - 4.09.0-13
|
||||
- Bump release and rebuild.
|
||||
|
||||
* Tue Jan 07 2020 Richard W.M. Jones <rjones@redhat.com> - 4.09.0-4
|
||||
- OCaml 4.09.0 for riscv64
|
||||
|
||||
* Tue Dec 10 2019 Richard W.M. Jones <rjones@redhat.com> - 4.09.0-3
|
||||
- Require redhat-rpm-config to get hardening flags when linking.
|
||||
|
||||
* Thu Dec 05 2019 Richard W.M. Jones <rjones@redhat.com> - 4.09.0-2
|
||||
- OCaml 4.09.0 final.
|
||||
- Use autosetup, remove old setup line.
|
||||
- Remove ocamloptp binaries.
|
||||
- Rename target_camlheader[di] -> camlheader[di] files.
|
||||
- Remove vmthreads - old threading library which is no longer built.
|
||||
- Remove x11 subpackage which is obsolete.
|
||||
- Further fixes to CFLAGS and annobin.
|
||||
|
||||
* Fri Aug 16 2019 Richard W.M. Jones <rjones@redhat.com> - 4.08.1-1
|
||||
- OCaml 4.08.1 final.
|
||||
|
||||
* Tue Jul 30 2019 Richard W.M. Jones <rjones@redhat.com> - 4.08.1-0.rc2.1
|
||||
- OCaml 4.08.1+rc2.
|
||||
- Include fix for miscompilation of off_t on 32 bit architectures.
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.08.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Thu Jun 27 2019 Richard W.M. Jones <rjones@redhat.com> - 4.08.0-1
|
||||
- OCaml 4.08.0 (RHBZ#1673688).
|
||||
|
||||
* Fri Apr 26 2019 Richard W.M. Jones <rjones@redhat.com> - 4.08.0-0.beta3.1
|
||||
- OCaml 4.08.0 beta 3 (RHBZ#1673688).
|
||||
- emacs subpackage has been dropped (from upstream):
|
||||
https://github.com/ocaml/ocaml/pull/2078#issuecomment-443322613
|
||||
https://github.com/Chris00/caml-mode
|
||||
- Remove ocamlbyteinfo and ocamlpluginfo, neither can be compiled.
|
||||
- Disable tests on all architectures, temporarily hopefully.
|
||||
- Package threads/*.mli files.
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.07.0-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Aug 17 2018 Richard W.M. Jones <rjones@redhat.com> - 4.07.0-3
|
||||
- Bootstrap from previously build Fedora compiler by default.
|
||||
* Tue Jul 31 2018 Richard W.M. Jones <rjones@redhat.com> - 4.07.0-3
|
||||
- Disable unreliable tests on ppc64le.
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.07.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
Loading…
Reference in New Issue
Block a user