diff --git a/0001-Don-t-add-rpaths-to-libraries.patch b/0001-Don-t-add-rpaths-to-libraries.patch index 8a126a1..2f9e58c 100644 --- a/0001-Don-t-add-rpaths-to-libraries.patch +++ b/0001-Don-t-add-rpaths-to-libraries.patch @@ -1,7 +1,7 @@ From 14d63e7a96ab39598f7c42b8513c914253afb173 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 1/4] Don't add rpaths to libraries. +Subject: [PATCH 1/7] Don't add rpaths to libraries. --- tools/Makefile | 4 ++-- diff --git a/0002-configure-Allow-user-defined-C-compiler-flags.patch b/0002-configure-Allow-user-defined-C-compiler-flags.patch index fbadf53..dee5644 100644 --- a/0002-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0002-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,7 +1,7 @@ From 65456b148ad6532a6b0086ba5812b67c0371e768 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 2/4] configure: Allow user defined C compiler flags. +Subject: [PATCH 2/7] configure: Allow user defined C compiler flags. --- configure.ac | 4 ++++ diff --git a/0003-configure-Remove-incorrect-assumption-about-cross-co.patch b/0003-configure-Remove-incorrect-assumption-about-cross-co.patch index 9da35dc..3c49bdd 100644 --- a/0003-configure-Remove-incorrect-assumption-about-cross-co.patch +++ b/0003-configure-Remove-incorrect-assumption-about-cross-co.patch @@ -1,7 +1,7 @@ From 0b1b91841a3a227321f8e155ed932893e285b429 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 26 Apr 2019 16:16:29 +0100 -Subject: [PATCH 3/4] configure: Remove incorrect assumption about +Subject: [PATCH 3/7] configure: Remove incorrect assumption about cross-compiling. See https://github.com/ocaml/ocaml/issues/8647#issuecomment-487094390 diff --git a/0004-Remove-configure-from-.gitattributes.patch b/0004-Remove-configure-from-.gitattributes.patch index 7360765..6058177 100644 --- a/0004-Remove-configure-from-.gitattributes.patch +++ b/0004-Remove-configure-from-.gitattributes.patch @@ -1,7 +1,7 @@ From 0b805df7403257a71b9852deb2f468aac16133b0 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 18 Jan 2020 11:31:27 +0000 -Subject: [PATCH 4/4] Remove configure from .gitattributes. +Subject: [PATCH 4/7] Remove configure from .gitattributes. It's not a binary file. --- diff --git a/0005-Merge-pull-request-9457-from-dra27-fix-mod_use.patch b/0005-Merge-pull-request-9457-from-dra27-fix-mod_use.patch new file mode 100644 index 0000000..e2c4d9b --- /dev/null +++ b/0005-Merge-pull-request-9457-from-dra27-fix-mod_use.patch @@ -0,0 +1,174 @@ +From 2e40ed7452896a5ad043ca1297112d2a5bf6189b Mon Sep 17 00:00:00 2001 +From: David Allsopp +Date: Mon, 20 Apr 2020 16:13:26 +0100 +Subject: [PATCH 5/7] Merge pull request #9457 from dra27/fix-mod_use + +Fix #mod_use in toplevel + +(cherry picked from commit f4dc3003d579e45f6ddeb6ffceb4c283a9e15bc7) +--- + Changes | 2 +- + testsuite/tests/tool-toplevel/mod.ml | 1 + + testsuite/tests/tool-toplevel/mod_use.ml | 9 +++++++++ + toplevel/opttoploop.ml | 19 +++++++++++-------- + toplevel/toploop.ml | 19 +++++++++++-------- + 5 files changed, 33 insertions(+), 17 deletions(-) + create mode 100644 testsuite/tests/tool-toplevel/mod.ml + create mode 100644 testsuite/tests/tool-toplevel/mod_use.ml + +diff --git a/Changes b/Changes +index f16158f12..a65573604 100644 +--- a/Changes ++++ b/Changes +@@ -164,7 +164,7 @@ Working version + points to the grammar. + (Andreas Abel, review by Xavier Leroy) + +-- #9283: add a new toplevel directive `#use_output ""` to ++- #9283, #9455, #9457: add a new toplevel directive `#use_output ""` to + run a command and evaluate its output. + (Jérémie Dimino, review by David Allsopp) + +diff --git a/testsuite/tests/tool-toplevel/mod.ml b/testsuite/tests/tool-toplevel/mod.ml +new file mode 100644 +index 000000000..cd298427b +--- /dev/null ++++ b/testsuite/tests/tool-toplevel/mod.ml +@@ -0,0 +1 @@ ++let answer = 42 +diff --git a/testsuite/tests/tool-toplevel/mod_use.ml b/testsuite/tests/tool-toplevel/mod_use.ml +new file mode 100644 +index 000000000..e068ffc3a +--- /dev/null ++++ b/testsuite/tests/tool-toplevel/mod_use.ml +@@ -0,0 +1,9 @@ ++(* TEST ++ files = "mod.ml" ++ * expect ++*) ++ ++#mod_use "mod.ml" ++[%%expect {| ++module Mod : sig val answer : int end ++|}];; +diff --git a/toplevel/opttoploop.ml b/toplevel/opttoploop.ml +index cd4210bbe..ad9a2569e 100644 +--- a/toplevel/opttoploop.ml ++++ b/toplevel/opttoploop.ml +@@ -449,7 +449,7 @@ let preprocess_phrase ppf phr = + if !Clflags.dump_source then Pprintast.top_phrase ppf phr; + phr + +-let use_channel ppf wrap_mod ic name filename = ++let use_channel ppf ~wrap_in_module ic name filename = + let lb = Lexing.from_channel ic in + Location.init lb filename; + (* Skip initial #! line if any *) +@@ -461,7 +461,7 @@ let use_channel ppf wrap_mod ic name filename = + (fun ph -> + let ph = preprocess_phrase ppf ph in + if not (execute_phrase !use_print_results ppf ph) then raise Exit) +- (if wrap_mod then ++ (if wrap_in_module then + parse_mod_use_file name lb + else + !parse_use_file lb); +@@ -485,27 +485,30 @@ let use_output ppf command = + | 0 -> + let ic = open_in_bin fn in + Misc.try_finally ~always:(fun () -> close_in ic) +- (fun () -> use_channel ppf false ic "" "(command-output)") ++ (fun () -> ++ use_channel ppf ~wrap_in_module:false ic "" "(command-output)") + | n -> + fprintf ppf "Command exited with code %d.@." n; + false) + +-let use_file ppf wrap_mode name = ++let use_file ppf ~wrap_in_module name = + match name with + | "" -> +- use_channel ppf wrap_mode stdin name "(stdin)" ++ use_channel ppf ~wrap_in_module stdin name "(stdin)" + | _ -> + match Load_path.find name with + | filename -> + let ic = open_in_bin filename in + Misc.try_finally ~always:(fun () -> close_in ic) +- (fun () -> use_channel ppf false ic name filename) ++ (fun () -> use_channel ppf ~wrap_in_module ic name filename) + | exception Not_found -> + fprintf ppf "Cannot find file %s.@." name; + false + +-let mod_use_file ppf name = use_file ppf true name +-let use_file ppf name = use_file ppf false name ++let mod_use_file ppf name = ++ use_file ppf ~wrap_in_module:true name ++let use_file ppf name = ++ use_file ppf ~wrap_in_module:false name + + let use_silently ppf name = + protect_refs [ R (use_print_results, false) ] (fun () -> use_file ppf name) +diff --git a/toplevel/toploop.ml b/toplevel/toploop.ml +index 02f629f9d..09e550796 100644 +--- a/toplevel/toploop.ml ++++ b/toplevel/toploop.ml +@@ -394,7 +394,7 @@ let preprocess_phrase ppf phr = + if !Clflags.dump_source then Pprintast.top_phrase ppf phr; + phr + +-let use_channel ppf wrap_mod ic name filename = ++let use_channel ppf ~wrap_in_module ic name filename = + let lb = Lexing.from_channel ic in + Warnings.reset_fatal (); + Location.init lb filename; +@@ -408,7 +408,7 @@ let use_channel ppf wrap_mod ic name filename = + (fun ph -> + let ph = preprocess_phrase ppf ph in + if not (execute_phrase !use_print_results ppf ph) then raise Exit) +- (if wrap_mod then ++ (if wrap_in_module then + parse_mod_use_file name lb + else + !parse_use_file lb); +@@ -431,27 +431,30 @@ let use_output ppf command = + | 0 -> + let ic = open_in_bin fn in + Misc.try_finally ~always:(fun () -> close_in ic) +- (fun () -> use_channel ppf false ic "" "(command-output)") ++ (fun () -> ++ use_channel ppf ~wrap_in_module:false ic "" "(command-output)") + | n -> + fprintf ppf "Command exited with code %d.@." n; + false) + +-let use_file ppf wrap_mode name = ++let use_file ppf ~wrap_in_module name = + match name with + | "" -> +- use_channel ppf wrap_mode stdin name "(stdin)" ++ use_channel ppf ~wrap_in_module stdin name "(stdin)" + | _ -> + match Load_path.find name with + | filename -> + let ic = open_in_bin filename in + Misc.try_finally ~always:(fun () -> close_in ic) +- (fun () -> use_channel ppf false ic name filename) ++ (fun () -> use_channel ppf ~wrap_in_module ic name filename) + | exception Not_found -> + fprintf ppf "Cannot find file %s.@." name; + false + +-let mod_use_file ppf name = use_file ppf true name +-let use_file ppf name = use_file ppf false name ++let mod_use_file ppf name = ++ use_file ppf ~wrap_in_module:true name ++let use_file ppf name = ++ use_file ppf ~wrap_in_module:false name + + let use_silently ppf name = + protect_refs [ R (use_print_results, false) ] (fun () -> use_file ppf name) +-- +2.24.1 + diff --git a/0006-Merge-pull-request-9463-from-lthls-fix_int64_cmm_typ.patch b/0006-Merge-pull-request-9463-from-lthls-fix_int64_cmm_typ.patch new file mode 100644 index 0000000..96e74b2 --- /dev/null +++ b/0006-Merge-pull-request-9463-from-lthls-fix_int64_cmm_typ.patch @@ -0,0 +1,134 @@ +From 13bec130864d682032f3b3086764487c26076093 Mon Sep 17 00:00:00 2001 +From: Gabriel Scherer +Date: Mon, 20 Apr 2020 11:34:15 +0200 +Subject: [PATCH 6/7] Merge pull request #9463 from lthls/fix_int64_cmm_typ + +Fix Cmm type of unboxed integers in Clet_mut + +(cherry picked from commit 702e34fbe56f6f03db086efe42148395c5e395ff) +--- + Changes | 6 ++- + asmcomp/cmmgen.ml | 15 ++++---- + testsuite/tests/lib-int64/issue9460.ml | 37 +++++++++++++++++++ + testsuite/tests/lib-int64/issue9460.reference | 1 + + 4 files changed, 49 insertions(+), 10 deletions(-) + create mode 100644 testsuite/tests/lib-int64/issue9460.ml + create mode 100644 testsuite/tests/lib-int64/issue9460.reference + +diff --git a/Changes b/Changes +index a65573604..5f92e00c1 100644 +--- a/Changes ++++ b/Changes +@@ -66,8 +66,10 @@ Working version + - #9280: Micro-optimise allocations on amd64 to save a register. + (Stephen Dolan, review by Xavier Leroy) + +-- #9316: Use typing information from Clambda for mutable Cmm variables. +- (Stephen Dolan, review by Vincent Laviron, Guillaume Bury and Xavier Leroy) ++- #9316, #9443, #9463: Use typing information from Clambda ++ for mutable Cmm variables. ++ (Stephen Dolan, review by Vincent Laviron, Guillaume Bury, Xavier Leroy, ++ and Gabriel Scherer; temporary bug report by Richard Jones) + + - #9426: build the Mingw ports with higher levels of GCC optimization + (Xavier Leroy, review by Sébastien Hinderer) +diff --git a/asmcomp/cmmgen.ml b/asmcomp/cmmgen.ml +index 6e1c924dc..ec9697177 100644 +--- a/asmcomp/cmmgen.ml ++++ b/asmcomp/cmmgen.ml +@@ -247,6 +247,11 @@ let box_int dbg bi arg = + + (* Boxed numbers *) + ++let typ_of_boxed_number = function ++ | Boxed_float _ -> Cmm.typ_float ++ | Boxed_integer (Pint64, _) when size_int = 4 -> [|Int;Int|] ++ | Boxed_integer _ -> Cmm.typ_int ++ + let equal_unboxed_integer ui1 ui2 = + match ui1, ui2 with + | Pnativeint, Pnativeint -> true +@@ -687,11 +692,6 @@ and transl_catch env nfail ids body handler dbg = + in + let env_body = add_notify_catch nfail report env in + let body = transl env_body body in +- let typ_of_bn = function +- | Boxed_float _ -> Cmm.typ_float +- | Boxed_integer (Pint64, _) when size_int = 4 -> [|Int;Int|] +- | Boxed_integer _ -> Cmm.typ_int +- in + let new_env, rewrite, ids = + List.fold_right + (fun (id, _kind, u) (env, rewrite, ids) -> +@@ -704,7 +704,7 @@ and transl_catch env nfail ids body handler dbg = + let unboxed_id = V.create_local (VP.name id) in + add_unboxed_id (VP.var id) unboxed_id bn env, + (unbox_number Debuginfo.none bn) :: rewrite, +- (VP.create unboxed_id, typ_of_bn bn) :: ids ++ (VP.create unboxed_id, typ_of_boxed_number bn) :: ids + ) + ids (env, [], []) + in +@@ -1165,8 +1165,7 @@ and transl_let env str kind id exp body = + transl (add_unboxed_id (VP.var id) unboxed_id boxed_number env) body in + begin match str, boxed_number with + | Immutable, _ -> Clet (v, cexp, body) +- | Mutable, Boxed_float _ -> Clet_mut (v, typ_float, cexp, body) +- | Mutable, Boxed_integer _ -> Clet_mut (v, typ_int, cexp, body) ++ | Mutable, bn -> Clet_mut (v, typ_of_boxed_number bn, cexp, body) + end + + and make_catch ncatch body handler dbg = match body with +diff --git a/testsuite/tests/lib-int64/issue9460.ml b/testsuite/tests/lib-int64/issue9460.ml +new file mode 100644 +index 000000000..aacbe6189 +--- /dev/null ++++ b/testsuite/tests/lib-int64/issue9460.ml +@@ -0,0 +1,37 @@ ++(* TEST ++*) ++ ++(* See https://github.com/ocaml/ocaml/issues/9460 ++ This test comes from Richard Jones ++ at ++ https://github.com/libguestfs/libnbd/blob/0475bfe04a527051c0a37af59a733c4c8554e427/ocaml/tests/test_400_pread.ml#L21-L36 ++*) ++let test_result = ++ let b = Bytes.create 16 in ++ for i = 0 to 16/8-1 do ++ let i64 = ref (Int64.of_int (i*8)) in ++ for j = 0 to 7 do ++ let c = Int64.shift_right_logical !i64 56 in ++ let c = Int64.to_int c in ++ let c = Char.chr c in ++ Bytes.unsafe_set b (i*8+j) c; ++ i64 := Int64.shift_left !i64 8 ++ done ++ done; ++ (Bytes.to_string b) ;; ++ ++let expected = ++ "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\008" ++ ++let () = ++ assert (test_result = expected) ++ ++(* Reproduction case by Jeremy Yallop in ++ https://github.com/ocaml/ocaml/pull/9463#issuecomment-615831765 ++*) ++let () = ++ let x = ref Int64.max_int in ++ assert (!x = Int64.max_int) ++ ++let () = ++ print_endline "OK" +diff --git a/testsuite/tests/lib-int64/issue9460.reference b/testsuite/tests/lib-int64/issue9460.reference +new file mode 100644 +index 000000000..d86bac9de +--- /dev/null ++++ b/testsuite/tests/lib-int64/issue9460.reference +@@ -0,0 +1 @@ ++OK +-- +2.24.1 + diff --git a/0007-x86-asm-handle-unit-names-with-special-characters-94.patch b/0007-x86-asm-handle-unit-names-with-special-characters-94.patch new file mode 100644 index 0000000..9ecfab9 --- /dev/null +++ b/0007-x86-asm-handle-unit-names-with-special-characters-94.patch @@ -0,0 +1,55 @@ +From 946b5c2563dbf7d8969781e6b05d9fc531cd65a2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nicol=C3=A1s=20Ojeda=20B=C3=A4r?= +Date: Sun, 19 Apr 2020 11:17:00 +0200 +Subject: [PATCH 7/7] x86 asm: handle unit names with special characters + (#9465) + +(cherry picked from commit ec6690fb53b6caced797e1a7a083a787ff8bd97c) +--- + asmcomp/amd64/emit.mlp | 2 +- + testsuite/tests/asmcomp/0-!@#%.compilers.reference | 2 ++ + testsuite/tests/asmcomp/0-!@#%.ml | 10 ++++++++++ + 3 files changed, 13 insertions(+), 1 deletion(-) + create mode 100644 testsuite/tests/asmcomp/0-!@#%.compilers.reference + create mode 100644 testsuite/tests/asmcomp/0-!@#%.ml + +diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp +index 2e9e3a86d..d9c5eb6e6 100644 +--- a/asmcomp/amd64/emit.mlp ++++ b/asmcomp/amd64/emit.mlp +@@ -1146,7 +1146,7 @@ let end_assembly() = + }; + + if system = S_linux then begin +- let frametable = Compilenv.make_symbol (Some "frametable") in ++ let frametable = emit_symbol (Compilenv.make_symbol (Some "frametable")) in + D.size frametable (ConstSub (ConstThis, ConstLabel frametable)) + end; + +diff --git a/testsuite/tests/asmcomp/0-!@#%.compilers.reference b/testsuite/tests/asmcomp/0-!@#%.compilers.reference +new file mode 100644 +index 000000000..7df9a5456 +--- /dev/null ++++ b/testsuite/tests/asmcomp/0-!@#%.compilers.reference +@@ -0,0 +1,2 @@ ++File "0-!@#%.ml", line 1: ++Warning 24: bad source file name: "0-!@#%" is not a valid module name. +diff --git a/testsuite/tests/asmcomp/0-!@#%.ml b/testsuite/tests/asmcomp/0-!@#%.ml +new file mode 100644 +index 000000000..9f24bc382 +--- /dev/null ++++ b/testsuite/tests/asmcomp/0-!@#%.ml +@@ -0,0 +1,10 @@ ++(* TEST *) ++ ++(* We could not include the following characters the file name: ++ ++ - '$' : this character is interpreted specially by [ocamltest] (as it uses ++ [Buffer.add_substitute] on the filenames). ++ ++ - '^' : this character causes problems under Windows if not properly ++ quoted. In particular, flexlink needed to be adapted. ++*) +-- +2.24.1 + diff --git a/ocaml.spec b/ocaml.spec index 934b801..34175e6 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -31,7 +31,7 @@ Name: ocaml Version: 4.11.0 -Release: 0.2.pre%{?dist} +Release: 0.3.pre%{?dist} Summary: OCaml compiler and programming environment @@ -66,6 +66,11 @@ 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 +# All of these fixes are upstream in 4.11. +Patch0005: 0005-Merge-pull-request-9457-from-dra27-fix-mod_use.patch +Patch0006: 0006-Merge-pull-request-9463-from-lthls-fix_int64_cmm_typ.patch +Patch0007: 0007-x86-asm-handle-unit-names-with-special-characters-94.patch + BuildRequires: git BuildRequires: gcc BuildRequires: autoconf @@ -368,6 +373,9 @@ find $RPM_BUILD_ROOT \( -name '*.cmt' -o -name '*.cmti' \) -a -delete %changelog +* Tue Apr 21 2020 Richard W.M. Jones - 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 - 4.11.0-0.2.pre.fc33 - Move to OCaml 4.11.0 pre-release with support for RISC-V.