From a433439c107b2c295d22003187a95935db16aeee Mon Sep 17 00:00:00 2001 From: Jerry James Date: Wed, 4 Oct 2023 20:56:33 -0600 Subject: [PATCH 01/31] Version 5.1.0 Other changes: - Add LicenseRef-Fedora-Public-Domain to the runtime License field - New ocaml-rpm-macros subpackage - Depend on libzstd-devel for compressed marshaling - Disable LTO --- 0001-Don-t-add-rpaths-to-libraries.patch | 25 + ...t-version-number-after-tagging-5.0.0.patch | 86 --- ...st-11814-from-gasche-clarify-DLS.new.patch | 66 -- ...-Allow-user-defined-C-compiler-flags.patch | 45 ++ 0003-Add-KC-Sivaramakrishnan-as-author.patch | 31 - ...elivery-of-effect-related-exceptions.patch | 34 + ...ters-tests-to-avoid-false-positive-w.patch | 696 ++++++++++++++++++ ...unused-variables-in-yacc-reader.c-11.patch | 39 - ...st-11860-from-Octachron-index_for_st.patch | 68 -- ...g-in-folder-with-space-in-name-11590.patch | 42 -- ...nused-Makefile-variables-in-workflow.patch | 45 -- ...variable-from-runtime-Makefile-merge.patch | 33 - ...-Provide-a-default-for-OCAMLDEPFLAGS.patch | 24 - 0010-Report-all-post-build-failures.patch | 41 -- ...emoval-of-FORCE_INSTRUMENTED_RUNTIME.patch | 24 - ...s-alert-when-compiling-stdlib-docume.patch | 27 - ...st-12285-from-smorimoto-update-depre.patch | 70 -- ...st-12286-from-smorimoto-replace-set-.patch | 40 - 0015-Don-t-add-rpaths-to-libraries.patch | 27 - ...-Allow-user-defined-C-compiler-flags.patch | 27 - 0017-Fix-skiplist-test-failure-12346.patch | 39 - macros.ocaml-rpm | 69 ++ ocaml.spec | 127 ++-- ocaml_files.py | 451 ++++++++++++ sources | 2 +- 25 files changed, 1397 insertions(+), 781 deletions(-) create mode 100644 0001-Don-t-add-rpaths-to-libraries.patch delete mode 100644 0001-increment-version-number-after-tagging-5.0.0.patch delete mode 100644 0002-Merge-pull-request-11814-from-gasche-clarify-DLS.new.patch create mode 100644 0002-configure-Allow-user-defined-C-compiler-flags.patch delete mode 100644 0003-Add-KC-Sivaramakrishnan-as-author.patch create mode 100644 0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch create mode 100644 0004-Update-framepointers-tests-to-avoid-false-positive-w.patch delete mode 100644 0004-removed-set-but-unused-variables-in-yacc-reader.c-11.patch delete mode 100644 0005-Merge-pull-request-11860-from-Octachron-index_for_st.patch delete mode 100644 0006-Allow-installing-in-folder-with-space-in-name-11590.patch delete mode 100644 0007-Detect-unused-Makefile-variables-in-workflow.patch delete mode 100644 0008-Fix-incorrect-variable-from-runtime-Makefile-merge.patch delete mode 100644 0009-Provide-a-default-for-OCAMLDEPFLAGS.patch delete mode 100644 0010-Report-all-post-build-failures.patch delete mode 100644 0011-Finish-off-removal-of-FORCE_INSTRUMENTED_RUNTIME.patch delete mode 100644 0012-suppress-spurious-alert-when-compiling-stdlib-docume.patch delete mode 100644 0013-Merge-pull-request-12285-from-smorimoto-update-depre.patch delete mode 100644 0014-Merge-pull-request-12286-from-smorimoto-replace-set-.patch delete mode 100644 0015-Don-t-add-rpaths-to-libraries.patch delete mode 100644 0016-configure-Allow-user-defined-C-compiler-flags.patch delete mode 100644 0017-Fix-skiplist-test-failure-12346.patch create mode 100644 macros.ocaml-rpm create mode 100644 ocaml_files.py diff --git a/0001-Don-t-add-rpaths-to-libraries.patch b/0001-Don-t-add-rpaths-to-libraries.patch new file mode 100644 index 0000000..344a528 --- /dev/null +++ b/0001-Don-t-add-rpaths-to-libraries.patch @@ -0,0 +1,25 @@ +From 03435cc789bfb783c1d5566e8abd387eea1b9155 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. + +--- + configure.ac | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 7c7d9a814c..d5040c279c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1106,8 +1106,6 @@ AS_IF([test x"$enable_shared" != "xno"], + [[*-*-openbsd7.[3-9]|*-*-openbsd[89].*]], + [mkdll_flags="${mkdll_flags} -Wl,--no-execute-only"]) + oc_ldflags="$oc_ldflags -Wl,-E" +- rpath="-Wl,-rpath," +- mksharedlibrpath="-Wl,-rpath," + natdynlinkopts="-Wl,-E" + supports_shared_libraries=true], + [mkdll='shared-libs-not-available']) +-- +2.41.0 + diff --git a/0001-increment-version-number-after-tagging-5.0.0.patch b/0001-increment-version-number-after-tagging-5.0.0.patch deleted file mode 100644 index 8103ef0..0000000 --- a/0001-increment-version-number-after-tagging-5.0.0.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 8741f4d88801e478e0ab7f871dc7dbcf9d7cc8f4 Mon Sep 17 00:00:00 2001 -From: Florian Angeletti -Date: Thu, 15 Dec 2022 14:28:32 +0100 -Subject: [PATCH 01/17] increment version number after tagging 5.0.0 - ---- - VERSION | 2 +- - build-aux/ocaml_version.m4 | 6 +++--- - configure | Bin 617024 -> 617302 bytes - ocaml-variants.opam | 6 +++--- - 4 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/VERSION b/VERSION -index fc40ac52d7..314f8ec760 100644 ---- a/VERSION -+++ b/VERSION -@@ -1,4 +1,4 @@ --5.0.0 -+5.0.1+dev0-2022-12-15 - - # Starting with OCaml 4.14, although the version string that appears above is - # still correct and this file can thus still be used to figure it out, -diff --git a/build-aux/ocaml_version.m4 b/build-aux/ocaml_version.m4 -index ba48c00277..78049eaab0 100644 ---- a/build-aux/ocaml_version.m4 -+++ b/build-aux/ocaml_version.m4 -@@ -25,7 +25,7 @@ - # The following macro, OCAML__DEVELOPMENT_VERSION, should be either - # [true] of [false]. - --m4_define([OCAML__DEVELOPMENT_VERSION], [false]) -+m4_define([OCAML__DEVELOPMENT_VERSION], [true]) - - # The three following components (major, minor and patch level) MUST be - # integers. They MUST NOT be left-padded with zeros and all of them, -@@ -33,10 +33,10 @@ m4_define([OCAML__DEVELOPMENT_VERSION], [false]) - - m4_define([OCAML__VERSION_MAJOR], [5]) - m4_define([OCAML__VERSION_MINOR], [0]) --m4_define([OCAML__VERSION_PATCHLEVEL], [0]) -+m4_define([OCAML__VERSION_PATCHLEVEL], [1]) - # Note that the OCAML__VERSION_EXTRA string defined below is always empty - # for officially-released versions of OCaml. --m4_define([OCAML__VERSION_EXTRA], []) -+m4_define([OCAML__VERSION_EXTRA], [dev0-2022-12-15]) - - # The OCAML__VERSION_EXTRA_PREFIX macro defined below should be a - # single character: -diff --git a/configure b/configure -index 19764d19a9b8fb1a9f01868f8f7863733a4c4ecd..f54df41388272a49e583ca20f325508c5b814eff 100755 -GIT binary patch -delta 558 -zcmX?bMfKV>)eSNnf`-~DsbvPbMg~Skx`sexx>=UvgA=CkWIk^hOwrBS-boQyg!>lT -z^I#D^w|=RVFoum>>61UO%Wj^0>LnI?x7YGA-j2jHYkHy%qwMsubVfN$x$RTa8SPkv -zFfE!a6)I(ITT)b-%EjgH?C9$gALQ!e>KN=A?-~&jgcdML -zn(EW}a~M6D47nz63=t8qMU&s2pTqc^h0$<&pcn(`ObkI${VGs4{AT -zl=Ds(C}Lzq($6>DyNHn&(|gk&sxgYT=M^ymF%u9o12N0?ydu`PGG?IP+Aq9d1!A`C -q7hbSOxPU~a14U%Fd+Kt$%*A3FFo1ow*U#pd&5kL#U3xKx>Tv-4Xq`R) - -delta 271 -zcmcb1P4&PP)eSNnj0T%^IX*Zs8cf#nmH~32y^|t<)Vam>JU~ir!%`_`1FrPRAJ}C# -ze?IjRsBZgPUdG#zj0V#$>M+Vq|CY`u2NYAyV6m!Fq9{ZtO4CrI(b5D`Y(?UuQW&sl)xDHbt0O)n~9be#S` -zl~Hqge<33;n}VqU5P+mi`GP}&JpJ4iVw6nv4D<}z1B)4fmcP84Jkj -x_Tw*EftYRk@t5ooE?}YQKq1-f_IeyIbAdJiec-dbbq>dDcA(P@mvE>a2LKy+Taf?& - -diff --git a/ocaml-variants.opam b/ocaml-variants.opam -index 5928f357f2..a0876e02c9 100644 ---- a/ocaml-variants.opam -+++ b/ocaml-variants.opam -@@ -1,9 +1,9 @@ - opam-version: "2.0" --version: "5.0.0" -+version: "5.0.1+trunk" - license: "LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception" --synopsis: "Official release of OCaml 5.0.0" -+synopsis: "OCaml development version" - depends: [ -- "ocaml" {= "5.0.0" & post} -+ "ocaml" {= "5.0.1" & post} - "base-unix" {post} - "base-bigarray" {post} - "base-threads" {post} --- -2.41.0 - diff --git a/0002-Merge-pull-request-11814-from-gasche-clarify-DLS.new.patch b/0002-Merge-pull-request-11814-from-gasche-clarify-DLS.new.patch deleted file mode 100644 index 6a68fc4..0000000 --- a/0002-Merge-pull-request-11814-from-gasche-clarify-DLS.new.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 925bf9a6d828d7548751f9a21892cad6209fc950 Mon Sep 17 00:00:00 2001 -From: Gabriel Scherer -Date: Fri, 16 Dec 2022 09:41:13 +0100 -Subject: [PATCH 02/17] Merge pull request #11814 from - gasche/clarify-DLS.new_key-doc - -clarify the doc of Domain.DLS.new_key - -(cherry picked from commit be210179503c4a82b72dd4762560e13c408d37b7) ---- - stdlib/domain.mli | 37 ++++++++++++++++++++++++++++++------- - 1 file changed, 30 insertions(+), 7 deletions(-) - -diff --git a/stdlib/domain.mli b/stdlib/domain.mli -index 7763043aa5..2d79b3b0c3 100644 ---- a/stdlib/domain.mli -+++ b/stdlib/domain.mli -@@ -96,15 +96,38 @@ module DLS : sig - - val new_key : ?split_from_parent:('a -> 'a) -> (unit -> 'a) -> 'a key - (** [new_key f] returns a new key bound to initialiser [f] for accessing -- domain-local variables. -+, domain-local variables. - -- If [split_from_parent] is provided, spawning a domain will derive the -- child value (for this key) from the parent value. -+ If [split_from_parent] is not provided, the value for a new -+ domain will be computed on-demand by the new domain: the first -+ [get] call will call the initializer [f] and store that value. - -- Note that the [split_from_parent] call is computed in the parent -- domain, and is always computed regardless of whether the child domain -- will use it. If the splitting function is expensive or requires -- client-side computation, consider using ['a Lazy.t key]. -+ If [split_from_parent] is provided, spawning a domain will -+ derive the child value (for this key) from the parent -+ value. This computation happens in the parent domain and it -+ always happens, regardless of whether the child domain will -+ use it. -+ If the splitting function is expensive or requires -+ child-side computation, consider using ['a Lazy.t key]: -+ -+ {[ -+ let init () = ... -+ -+ let split_from_parent parent_value = -+ ... parent-side computation ...; -+ lazy ( -+ ... child-side computation ... -+ ) -+ -+ let key = Domain.DLS.new_key ~split_from_parent init -+ -+ let get () = Lazy.force (Domain.DLS.get key) -+ ]} -+ -+ In this case a part of the computation happens on the child -+ domain; in particular, it can access [parent_value] -+ concurrently with the parent domain, which may require -+ explicit synchronization to avoid data races. - *) - - val get : 'a key -> 'a --- -2.41.0 - diff --git a/0002-configure-Allow-user-defined-C-compiler-flags.patch b/0002-configure-Allow-user-defined-C-compiler-flags.patch new file mode 100644 index 0000000..0d70a04 --- /dev/null +++ b/0002-configure-Allow-user-defined-C-compiler-flags.patch @@ -0,0 +1,45 @@ +From d9bcdb9d0a27e10350b1ca90df43b401656324f1 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. + +--- + configure.ac | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index d5040c279c..4cbba04557 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -759,6 +759,10 @@ AS_CASE([$host], + internal_cflags="$cc_warnings"], + [common_cflags="-O"])]) + ++# Allow CFLAGS and LDFLAGS to be added. ++common_cflags="$common_cflags $CFLAGS" ++cclibs="$cclibs $LDFLAGS" ++ + # Enable SSE2 on x86 mingw to avoid using 80-bit registers. + AS_CASE([$host], + [i686-*-mingw32*], +@@ -2325,7 +2329,7 @@ AC_CONFIG_COMMANDS_PRE([ + [mkexedebugflag="${mkexe_ldflags_prefix}${mkexedebugflag}"]) + mkdll_ldflags="" + AS_IF([test -n "${LDFLAGS}"], +- [for flag in ${LDFLAGS}; do ++ [for flag in "${LDFLAGS}"; do + mkdll_ldflags="${mkdll_ldflags} ${mkexe_ldflags_prefix}${flag}" + done + mkdll_ldflags_exp="$mkdll_ldflags"]) +@@ -2351,7 +2355,7 @@ ${mkdll_ldflags}" + ],[ + mkdll_ldflags='$(OC_DLL_LDFLAGS) $(LDFLAGS)' + mkdll_ldflags_exp="${oc_dll_ldflags}" +- AS_IF([test -n ${LDFLAGS}], ++ AS_IF([test -n "${LDFLAGS}"], + [mkdll_ldflags_exp="$mkdll_ldflags_exp $LDFLAGS"]) + mkexe_ldflags="\$(OC_LDFLAGS) \$(LDFLAGS)" + mkexe_ldflags_exp="${oc_ldflags} ${LDFLAGS}" +-- +2.41.0 + diff --git a/0003-Add-KC-Sivaramakrishnan-as-author.patch b/0003-Add-KC-Sivaramakrishnan-as-author.patch deleted file mode 100644 index 3186f31..0000000 --- a/0003-Add-KC-Sivaramakrishnan-as-author.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 83ef99f67fda11b268098a271f56b990e295bbc2 Mon Sep 17 00:00:00 2001 -From: Xavier Leroy -Date: Tue, 20 Dec 2022 10:48:41 +0100 -Subject: [PATCH 03/17] Add KC Sivaramakrishnan as author - -For the two new chapters "Parallel programming" and "Memory model". - -Follow-up to #11280. - -(cherry picked from commit e6340ced8ca1d46f11eaea8e0474d1eb2142fe1c) ---- - manual/src/allfiles.etex | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/manual/src/allfiles.etex b/manual/src/allfiles.etex -index 6600943f54..3e07555b85 100644 ---- a/manual/src/allfiles.etex -+++ b/manual/src/allfiles.etex -@@ -12,7 +12,8 @@ - release \ocamlversion \\[1cm] - \Large Documentation and user's manual \\[1cm] - \large Xavier Leroy, \\ -- Damien Doligez, Alain Frisch, Jacques Garrigue, Didier Rémy and Jérôme Vouillon \\[1cm] -+ Damien Doligez, Alain Frisch, Jacques Garrigue, \\ -+ Didier Rémy, KC Sivaramakrishnan and Jérôme Vouillon \\[1cm] - \today \\ - ~ - \vfill --- -2.41.0 - diff --git a/0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch b/0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch new file mode 100644 index 0000000..6d40ec0 --- /dev/null +++ b/0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch @@ -0,0 +1,34 @@ +From 352789925e44f012fbddc5dfae63abd15a447577 Mon Sep 17 00:00:00 2001 +From: Miod Vallat +Date: Mon, 4 Sep 2023 13:50:30 -0600 +Subject: [PATCH 3/4] Fix x86_64 delivery of effect-related exceptions + +--- + runtime/amd64.S | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/runtime/amd64.S b/runtime/amd64.S +index 7e6f95c680..24dfa7111b 100644 +--- a/runtime/amd64.S ++++ b/runtime/amd64.S +@@ -902,6 +902,7 @@ LBL(112): + movq Caml_state(current_stack), %rsi + SWITCH_OCAML_STACKS + /* No parent stack. Raise Effect.Unhandled. */ ++ ENTER_FUNCTION + movq %rax, C_ARG_1 + LEA_VAR(caml_raise_unhandled_effect, %rax) + jmp LBL(caml_c_call) +@@ -946,7 +947,8 @@ CFI_STARTPROC + UPDATE_BASE_POINTER(%rcx) + SWITCH_OCAML_STACKS + jmp *(%rbx) +-2: LEA_VAR(caml_raise_continuation_already_resumed, %rax) ++2: ENTER_FUNCTION ++ LEA_VAR(caml_raise_continuation_already_resumed, %rax) + jmp LBL(caml_c_call) + CFI_ENDPROC + ENDFUNCTION(G(caml_resume)) +-- +2.41.0 + diff --git a/0004-Update-framepointers-tests-to-avoid-false-positive-w.patch b/0004-Update-framepointers-tests-to-avoid-false-positive-w.patch new file mode 100644 index 0000000..2025d57 --- /dev/null +++ b/0004-Update-framepointers-tests-to-avoid-false-positive-w.patch @@ -0,0 +1,696 @@ +From 210f9b439b264fb6ab16802f468992086a4af58c Mon Sep 17 00:00:00 2001 +From: Fabrice Buoro +Date: Fri, 10 Mar 2023 09:36:22 -0700 +Subject: [PATCH 4/4] Update framepointers tests to avoid false positive with + inlined C functions + +--- + testsuite/tests/frame-pointers/c_call.ml | 14 +- + .../tests/frame-pointers/c_call.reference | 9 - + testsuite/tests/frame-pointers/c_call.run | 4 - + testsuite/tests/frame-pointers/c_call_.c | 14 +- + testsuite/tests/frame-pointers/effects.ml | 12 +- + .../tests/frame-pointers/effects.reference | 15 -- + testsuite/tests/frame-pointers/effects.run | 4 - + .../tests/frame-pointers/exception_handler.ml | 4 +- + .../exception_handler.reference | 12 -- + .../frame-pointers/exception_handler.run | 4 - + .../tests/frame-pointers/filter-locations.sh | 23 --- + testsuite/tests/frame-pointers/fp_backtrace.c | 186 +++++++++++------- + testsuite/tests/frame-pointers/reperform.ml | 4 +- + .../tests/frame-pointers/reperform.reference | 3 - + testsuite/tests/frame-pointers/reperform.run | 4 - + .../tests/frame-pointers/stack_realloc.ml | 4 +- + .../frame-pointers/stack_realloc.reference | 3 - + .../tests/frame-pointers/stack_realloc.run | 4 - + .../tests/frame-pointers/stack_realloc2.ml | 4 +- + .../frame-pointers/stack_realloc2.reference | 3 - + .../tests/frame-pointers/stack_realloc2.run | 4 - + 21 files changed, 144 insertions(+), 190 deletions(-) + delete mode 100644 testsuite/tests/frame-pointers/c_call.run + delete mode 100644 testsuite/tests/frame-pointers/effects.run + delete mode 100644 testsuite/tests/frame-pointers/exception_handler.run + delete mode 100755 testsuite/tests/frame-pointers/filter-locations.sh + delete mode 100644 testsuite/tests/frame-pointers/reperform.run + delete mode 100644 testsuite/tests/frame-pointers/stack_realloc.run + delete mode 100644 testsuite/tests/frame-pointers/stack_realloc2.run + +diff --git a/testsuite/tests/frame-pointers/c_call.ml b/testsuite/tests/frame-pointers/c_call.ml +index 7d48b4947d..f552b0df8f 100644 +--- a/testsuite/tests/frame-pointers/c_call.ml ++++ b/testsuite/tests/frame-pointers/c_call.ml +@@ -7,20 +7,20 @@ all_modules = "${readonly_files} c_call. + + *) + +-external fp_backtrace : unit -> unit = "fp_backtrace" +-external fp_backtrace_no_alloc : unit -> unit = "fp_backtrace" [@@noalloc] +-external fp_backtrace_many_args : int -> int -> int -> int -> int -> int -> int +- -> int -> int -> int -> int -> unit = ++external fp_backtrace : string -> unit = "fp_backtrace" ++external fp_backtrace_no_alloc : string -> unit = "fp_backtrace" [@@noalloc] ++external fp_backtrace_many_args : string -> int -> int -> int -> int -> int ++ -> int -> int -> int -> int -> int -> int -> unit = + "fp_backtrace_many_args_argv" "fp_backtrace_many_args" + + let[@inline never] f () = + (* Check backtrace through caml_c_call_stack_args *) +- fp_backtrace_many_args 1 2 3 4 5 6 7 8 9 10 11; ++ fp_backtrace_many_args Sys.argv.(0) 1 2 3 4 5 6 7 8 9 10 11; + (* Check backtrace through caml_c_call. + * Also check that caml_c_call_stack_args correctly restores rbp register *) +- fp_backtrace (); ++ fp_backtrace Sys.argv.(0); + (* Check caml_c_call correctly restores rbp register *) +- fp_backtrace_no_alloc (); ++ fp_backtrace_no_alloc Sys.argv.(0); + 42 + + let () = ignore (f ()) +diff --git a/testsuite/tests/frame-pointers/c_call.reference b/testsuite/tests/frame-pointers/c_call.reference +index 92fb40a238..23095e7431 100644 +--- a/testsuite/tests/frame-pointers/c_call.reference ++++ b/testsuite/tests/frame-pointers/c_call.reference +@@ -3,19 +3,10 @@ caml_c_call_stack_args + camlC_call.f + camlC_call.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main + caml_c_call + camlC_call.f + camlC_call.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main + camlC_call.f + camlC_call.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main +diff --git a/testsuite/tests/frame-pointers/c_call.run b/testsuite/tests/frame-pointers/c_call.run +deleted file mode 100644 +index e96b5ea13a..0000000000 +--- a/testsuite/tests/frame-pointers/c_call.run ++++ /dev/null +@@ -1,4 +0,0 @@ +-#!/bin/sh +- +-${program} 2>&1 \ +- | ${test_source_directory}/filter-locations.sh ${program} >${output} +diff --git a/testsuite/tests/frame-pointers/c_call_.c b/testsuite/tests/frame-pointers/c_call_.c +index 634c4dd937..a75100b213 100644 +--- a/testsuite/tests/frame-pointers/c_call_.c ++++ b/testsuite/tests/frame-pointers/c_call_.c +@@ -16,10 +16,10 @@ + #include + #include "caml/mlvalues.h" + +-void fp_backtrace(void); ++void fp_backtrace(value); + +-value fp_backtrace_many_args(value a, value b, value c, value d, value e, +- value f, value g, value h, value i, value j, value k) ++value fp_backtrace_many_args(value argv0, value a, value b, value c, ++ value d, value e, value f, value g, value h, value i, value j, value k) + { + assert(Int_val(a) == 1); + assert(Int_val(b) == 2); +@@ -33,15 +33,15 @@ value fp_backtrace_many_args(value a, value b, value c, value d, value e, + assert(Int_val(j) == 10); + assert(Int_val(k) == 11); + +- fp_backtrace(); ++ fp_backtrace(argv0); + + return Val_unit; + } + +-value fp_bactrace_many_args_argv(value *argv, int argc) ++value fp_bactrace_many_args_argv(value argv0, value *argv, int argc) + { + assert(argc == 11); + +- return fp_backtrace_many_args(argv[0], argv[1], argv[2], argv[3], argv[4], +- argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]); ++ return fp_backtrace_many_args(argv0, argv[0], argv[1], argv[2], argv[3], ++ argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]); + } +diff --git a/testsuite/tests/frame-pointers/effects.ml b/testsuite/tests/frame-pointers/effects.ml +index 2aa7012606..ac304683fe 100644 +--- a/testsuite/tests/frame-pointers/effects.ml ++++ b/testsuite/tests/frame-pointers/effects.ml +@@ -11,26 +11,26 @@ open Printf + open Effect + open Effect.Deep + +-external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc] ++external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc] + + type _ t += E : int -> int t + + let[@inline never] f () = + printf "# computation f\n%!"; +- fp_backtrace (); ++ fp_backtrace Sys.argv.(0); + printf "# perform effect (E 0)\n%!"; + let v = perform (E 0) in + printf "# perform returns %d\n%!" v; +- fp_backtrace (); ++ fp_backtrace Sys.argv.(0); + v + 1 + + let h (type a) (eff : a t) : ((a, 'b) continuation -> 'b) option = + let[@inline never] h_effect_e v k = + printf "# caught effect (E %d). continuing...\n%!" v; +- fp_backtrace (); ++ fp_backtrace Sys.argv.(0); + let v = continue k (v + 1) in + printf "# continue returns %d\n%!" v; +- fp_backtrace (); ++ fp_backtrace Sys.argv.(0); + v + 1 + in + match eff with +@@ -41,7 +41,7 @@ let h (type a) (eff : a t) : ((a, 'b) continuation -> 'b) option = + let v = + let[@inline never] v_retc v = + printf "# done %d\n%!" v; +- fp_backtrace (); ++ fp_backtrace Sys.argv.(0); + v + 1 + in + match_with f () +diff --git a/testsuite/tests/frame-pointers/effects.reference b/testsuite/tests/frame-pointers/effects.reference +index c8bd0a391a..8ae3fc26df 100644 +--- a/testsuite/tests/frame-pointers/effects.reference ++++ b/testsuite/tests/frame-pointers/effects.reference +@@ -3,39 +3,24 @@ camlEffects.f + caml_runstack + camlEffects.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main + # perform effect (E 0) + # caught effect (E 0). continuing... + camlEffects.h_effect_e + camlEffects.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main + # perform returns 1 + camlEffects.f + caml_runstack + camlEffects.h_effect_e + camlEffects.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main + # done 2 + camlEffects.v_retc + camlEffects.h_effect_e + camlEffects.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main + # continue returns 3 + camlEffects.h_effect_e + camlEffects.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main + # result=4 +diff --git a/testsuite/tests/frame-pointers/effects.run b/testsuite/tests/frame-pointers/effects.run +deleted file mode 100644 +index e96b5ea13a..0000000000 +--- a/testsuite/tests/frame-pointers/effects.run ++++ /dev/null +@@ -1,4 +0,0 @@ +-#!/bin/sh +- +-${program} 2>&1 \ +- | ${test_source_directory}/filter-locations.sh ${program} >${output} +diff --git a/testsuite/tests/frame-pointers/exception_handler.ml b/testsuite/tests/frame-pointers/exception_handler.ml +index 6bf5bf470d..19773f78de 100644 +--- a/testsuite/tests/frame-pointers/exception_handler.ml ++++ b/testsuite/tests/frame-pointers/exception_handler.ml +@@ -8,7 +8,7 @@ + *) + + (* https://github.com/ocaml/ocaml/pull/11031 *) +-external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc] ++external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc] + + exception Exn1 + exception Exn2 +@@ -38,7 +38,7 @@ let[@inline never] handler () = + let _ = Sys.opaque_identity x0 in + let _ = Sys.opaque_identity x1 in + let _ = Sys.opaque_identity x2 in +- fp_backtrace () ++ fp_backtrace Sys.argv.(0) + + let[@inline never] nested i = + begin +diff --git a/testsuite/tests/frame-pointers/exception_handler.reference b/testsuite/tests/frame-pointers/exception_handler.reference +index 513ca488b9..e012fb6d4f 100644 +--- a/testsuite/tests/frame-pointers/exception_handler.reference ++++ b/testsuite/tests/frame-pointers/exception_handler.reference +@@ -2,27 +2,15 @@ camlException_handler.handler + camlException_handler.bare + camlException_handler.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main + camlException_handler.handler + camlException_handler.bare + camlException_handler.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main + camlException_handler.handler + camlException_handler.nested + camlException_handler.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main + camlException_handler.handler + camlException_handler.nested + camlException_handler.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main +diff --git a/testsuite/tests/frame-pointers/exception_handler.run b/testsuite/tests/frame-pointers/exception_handler.run +deleted file mode 100644 +index e96b5ea13a..0000000000 +--- a/testsuite/tests/frame-pointers/exception_handler.run ++++ /dev/null +@@ -1,4 +0,0 @@ +-#!/bin/sh +- +-${program} 2>&1 \ +- | ${test_source_directory}/filter-locations.sh ${program} >${output} +diff --git a/testsuite/tests/frame-pointers/filter-locations.sh b/testsuite/tests/frame-pointers/filter-locations.sh +deleted file mode 100755 +index 31c7fc3189..0000000000 +--- a/testsuite/tests/frame-pointers/filter-locations.sh ++++ /dev/null +@@ -1,23 +0,0 @@ +-#!/bin/sh +- +-set -eu +- +-program="${1}" +-# https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed/29626460#29626460 +-program_escaped=$(echo ${program} | sed 's/[^^\\]/[&]/g; s/\^/\\^/g; s/\\/\\\\/g') +-regex_backtrace='^.*(\(.*\)+0x[[:xdigit:]]*)[0x[[:xdigit:]]*]$' +-regex_trim_fun='^\(caml.*\)_[[:digit:]]*$' +- +-# - Ignore backtrace not coming from the program binary +-# - Discard the number suffix from OCaml function name +-# - Remove strange '[0x.....]' entries inserted by some implementation +-# of backtrace_symbols_fd +-# - Keep the other lines +-sed -e \ +- "/${regex_backtrace}/ { +- /^${program_escaped}/ ! d +- s/${regex_backtrace}/\1/ +- s/${regex_trim_fun}/\1/ +- s;caml_\(main\|startup\);caml_main/caml_startup; +- }" \ +- -e '/^\[0x/d' +diff --git a/testsuite/tests/frame-pointers/fp_backtrace.c b/testsuite/tests/frame-pointers/fp_backtrace.c +index a521218a38..cef7ccd9f2 100644 +--- a/testsuite/tests/frame-pointers/fp_backtrace.c ++++ b/testsuite/tests/frame-pointers/fp_backtrace.c +@@ -1,10 +1,17 @@ + #include +-#include +-#include +-#include ++#include ++#include + #include ++#include ++#include + +-#define ARRSIZE(a) (sizeof(a) / sizeof(*(a))) ++#include "caml/mlvalues.h" ++ ++#define ARR_SIZE(a) (sizeof(a) / sizeof(*(a))) ++ ++#define RE_FUNC_NAME "^.*\\((.+)\\+0x[[:xdigit:]]+\\) \\[0x[[:xdigit:]]+\\]$" ++#define RE_TRIM_FUNC "(caml.*)_[[:digit:]]+" ++#define CAML_ENTRY "caml_program" + + typedef struct frame_info + { +@@ -12,99 +19,138 @@ typedef struct frame_info + void* retaddr; /* rip */ + } frame_info; + +-jmp_buf resume_buf; + ++/* ++ * A backtrace symbol looks like: ++ * ./path/to/binary(camlModule_fn_123+0xAABBCC) [0xAABBCCDDEE] ++ */ ++static const char* backtrace_symbol(const struct frame_info* fi) ++{ ++ char** symbols = backtrace_symbols(&fi->retaddr, 1); ++ if (!symbols) { ++ perror("backtrace_symbols"); ++ return NULL; ++ } ++ ++ const char* symbol = strdup(symbols[0]); ++ free(symbols); ++ return symbol; ++} + +-static void signal_handler(int signum) ++static bool is_from_executable(const char* symbol, const char* execname) + { +- /* Should be safe to be called from a signal handler. +- * See 21.2.1 "Performing a nonlocal goto from a signal handler" from +- * The Linux Programming Interface, Michael Kerrisk */ +- siglongjmp(resume_buf, 1); ++ return strncmp(symbol, execname, strlen(execname)) == 0; + } + +-static int install_signal_handlers(const int signals[], struct sigaction +- handlers[], int count) ++static regmatch_t func_name_from_symbol(const char* symbol) + { +- for (int i = 0; i < count; i++) { +- struct sigaction action = { 0 }; +- action.sa_handler = signal_handler; +- sigemptyset(&action.sa_mask); +- action.sa_flags = 0; +- +- if (sigaction(signals[i], &action, &handlers[i]) != 0) { +- perror("sigaction"); +- return -1; +- } ++ regex_t regex; ++ regmatch_t match[2] = { {-1, -1}, {-1, -1}}; ++ char errbuf[128]; ++ int err; ++ ++ err = regcomp(®ex, RE_FUNC_NAME, REG_EXTENDED); ++ if (err) { ++ regerror(err, ®ex, errbuf, ARR_SIZE(errbuf)); ++ fprintf(stderr, "regcomp: %s\n", errbuf); ++ return match[0]; + } +- return 0; ++ ++ err = regexec(®ex, symbol, ARR_SIZE(match), match, 0); ++ if (err == REG_NOMATCH) ++ return match[0]; ++ ++ return match[1]; + } + +-static int restore_signal_handlers(const int signals[], struct sigaction +- handlers[], int count) ++static bool is_caml_entry(const char* symbol, const regmatch_t* funcname) + { +- for (int i = 0; i < count; i++) { +- if (sigaction(signals[i], &handlers[i], NULL) != 0) { +- perror("sigaction"); +- return -1; +- } +- } +- return 0; ++ //regoff_t len = funcname->rm_eo - funcname->rm_so; ++ //return strnstr(symbol + funcname->rm_so, CAML_ENTRY, len) == 0; ++ return strstr(symbol + funcname->rm_so, CAML_ENTRY) != NULL; + } + +-static int safe_read(const struct frame_info* fi, struct frame_info** prev, +- void** retaddr) ++static regmatch_t trim_func_name(const char* symbol, const regmatch_t* funcname) + { +- /* Signals to ignore while attempting to read frame_info members */ +- const int signals[] = { SIGSEGV, SIGBUS }; +- /* Store original signal handers */ +- struct sigaction handlers[ARRSIZE(signals)] = { 0 }; +- int ret = 0; +- +- if (install_signal_handlers(signals, handlers, ARRSIZE(signals)) != 0) +- return -1; +- +- if (!sigsetjmp(resume_buf, 1)) { +- *prev = fi->prev; +- *retaddr = fi->retaddr; +- } else { +- ret = -1; ++ regex_t regex; ++ regmatch_t match[2] = { {-1, -1}, {-1, -1}}; ++ char errbuf[128]; ++ int err; ++ ++ err = regcomp(®ex, RE_TRIM_FUNC, REG_EXTENDED); ++ if (err) { ++ regerror(err, ®ex, errbuf, ARR_SIZE(errbuf)); ++ fprintf(stderr, "regcomp: %s\n", errbuf); ++ return match[0]; + } + +- if (restore_signal_handlers(signals, handlers, ARRSIZE(signals)) != 0) +- return -1; ++ match[0] = *funcname; ++ err = regexec(®ex, symbol, ARR_SIZE(match), match, REG_STARTEND); ++ if (err == REG_NOMATCH) { ++ /* match[0] has already been overwritten to hold the function full name for ++ regexec */ ++ return match[1]; ++ } + +- return ret; ++ return match[1]; + } + +-static void print_location(void* addr) ++static void print_symbol(const char* symbol, const regmatch_t* match) + { +- if (!addr) +- return; ++ regoff_t off = match->rm_so; ++ regoff_t len = match->rm_eo - match->rm_so; + +- /* This requires the binary to be linked with '-rdynamic' */ +- backtrace_symbols_fd(&addr, 1, STDOUT_FILENO); ++ fprintf(stdout, "%.*s\n", len, symbol + off); ++ fflush(stdout); + } + +-void fp_backtrace(void) ++void fp_backtrace(value argv0) + { +- struct frame_info *fi; +- struct frame_info* next; +- void* retaddr; ++ const char* execname = String_val(argv0); ++ struct frame_info* next = NULL; ++ const char* symbol = NULL; + +- fi = __builtin_frame_address(0); +- retaddr = __builtin_extract_return_addr(__builtin_return_address(0)); +- +- for (; fi; fi = next) { +- if (safe_read(fi, &next, &retaddr) != 0) +- return; +- +- print_location(retaddr); ++ for (struct frame_info* fi = __builtin_frame_address(0); fi; fi = next) { ++ next = fi->prev; + + /* Detect the simplest kind of infinite loop */ + if (fi == next) { +- printf("fp_backtrace: loop detected\n"); +- return; ++ fprintf(stderr, "fp_backtrace: loop detected\n"); ++ break; + } ++ ++ symbol = backtrace_symbol(fi); ++ if (!symbol) ++ continue; ++ ++ /* Skip entries not from the test */ ++ if (!is_from_executable(symbol, execname)) ++ goto skip; ++ ++ /* Exctract the full function name */ ++ regmatch_t funcname = func_name_from_symbol(symbol); ++ if (funcname.rm_so == -1) ++ goto skip; ++ ++ /* Trim numeric suffix from caml functions */ ++ regmatch_t functrimmed = trim_func_name(symbol, &funcname); ++ ++ /* Use the trimmed caml name if available, otherwise use the full function ++ name */ ++ const regmatch_t* match = (functrimmed.rm_so != -1) ? ++ &functrimmed : &funcname; ++ ++ print_symbol(symbol, match); ++ ++ /* Stop the backtrace at caml_program */ ++ if (is_caml_entry(symbol, &funcname)) ++ break; ++ ++skip: ++ free((void*)symbol); ++ symbol = NULL; + } ++ ++ if (symbol) ++ free((void*)symbol); + } +diff --git a/testsuite/tests/frame-pointers/reperform.ml b/testsuite/tests/frame-pointers/reperform.ml +index ec5393907c..7a3b09162b 100644 +--- a/testsuite/tests/frame-pointers/reperform.ml ++++ b/testsuite/tests/frame-pointers/reperform.ml +@@ -11,7 +11,7 @@ + open Effect + open Effect.Deep + +-external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc] ++external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc] + + type _ Effect.t += E : unit t + | F : unit t +@@ -22,7 +22,7 @@ let rec foo n = + if n = 5 then begin + perform E; + print_endline "# resumed..."; +- fp_backtrace () ++ fp_backtrace Sys.argv.(0) + end; + foo (n + 1) + n + end +diff --git a/testsuite/tests/frame-pointers/reperform.reference b/testsuite/tests/frame-pointers/reperform.reference +index 9ac6681d4b..e215f77169 100644 +--- a/testsuite/tests/frame-pointers/reperform.reference ++++ b/testsuite/tests/frame-pointers/reperform.reference +@@ -15,6 +15,3 @@ camlReperform.bar + caml_runstack + camlReperform.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main +diff --git a/testsuite/tests/frame-pointers/reperform.run b/testsuite/tests/frame-pointers/reperform.run +deleted file mode 100644 +index e96b5ea13a..0000000000 +--- a/testsuite/tests/frame-pointers/reperform.run ++++ /dev/null +@@ -1,4 +0,0 @@ +-#!/bin/sh +- +-${program} 2>&1 \ +- | ${test_source_directory}/filter-locations.sh ${program} >${output} +diff --git a/testsuite/tests/frame-pointers/stack_realloc.ml b/testsuite/tests/frame-pointers/stack_realloc.ml +index fc4e9e9d3b..cacc43c216 100644 +--- a/testsuite/tests/frame-pointers/stack_realloc.ml ++++ b/testsuite/tests/frame-pointers/stack_realloc.ml +@@ -13,7 +13,7 @@ open Effect.Deep + + type _ t += E : int -> int t + +-external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc] ++external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc] + external c_fun : unit -> int = "c_fun" + + let[@inline never][@local never] f x = x +@@ -42,7 +42,7 @@ let[@inline never] consume_stack () = + + let[@inline never] callback () = + consume_stack (); +- fp_backtrace (); ++ fp_backtrace Sys.argv.(0); + 0 + + let _ = Callback.register "callback" callback +diff --git a/testsuite/tests/frame-pointers/stack_realloc.reference b/testsuite/tests/frame-pointers/stack_realloc.reference +index 016a03550a..e61d4104e0 100644 +--- a/testsuite/tests/frame-pointers/stack_realloc.reference ++++ b/testsuite/tests/frame-pointers/stack_realloc.reference +@@ -7,6 +7,3 @@ camlStack_realloc.f_comp + caml_runstack + camlStack_realloc.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main +diff --git a/testsuite/tests/frame-pointers/stack_realloc.run b/testsuite/tests/frame-pointers/stack_realloc.run +deleted file mode 100644 +index e96b5ea13a..0000000000 +--- a/testsuite/tests/frame-pointers/stack_realloc.run ++++ /dev/null +@@ -1,4 +0,0 @@ +-#!/bin/sh +- +-${program} 2>&1 \ +- | ${test_source_directory}/filter-locations.sh ${program} >${output} +diff --git a/testsuite/tests/frame-pointers/stack_realloc2.ml b/testsuite/tests/frame-pointers/stack_realloc2.ml +index a4aea249ea..b2a602fa4a 100644 +--- a/testsuite/tests/frame-pointers/stack_realloc2.ml ++++ b/testsuite/tests/frame-pointers/stack_realloc2.ml +@@ -13,7 +13,7 @@ open Effect.Deep + + type _ t += E : int -> int t + +-external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc] ++external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc] + external c_fun : unit -> int = "c_fun" + + let[@inline never][@local never] f x = x +@@ -41,7 +41,7 @@ let[@inline never] consume_stack () = + ignore (gobbler count) + + let[@inline never] callback () = +- fp_backtrace (); ++ fp_backtrace Sys.argv.(0); + 0 + + let _ = Callback.register "callback" callback +diff --git a/testsuite/tests/frame-pointers/stack_realloc2.reference b/testsuite/tests/frame-pointers/stack_realloc2.reference +index ae492abd88..0051f3bad0 100644 +--- a/testsuite/tests/frame-pointers/stack_realloc2.reference ++++ b/testsuite/tests/frame-pointers/stack_realloc2.reference +@@ -7,6 +7,3 @@ camlStack_realloc2.f_comp + caml_runstack + camlStack_realloc2.entry + caml_program +-caml_start_program +-caml_main/caml_startup +-main +diff --git a/testsuite/tests/frame-pointers/stack_realloc2.run b/testsuite/tests/frame-pointers/stack_realloc2.run +deleted file mode 100644 +index e96b5ea13a..0000000000 +--- a/testsuite/tests/frame-pointers/stack_realloc2.run ++++ /dev/null +@@ -1,4 +0,0 @@ +-#!/bin/sh +- +-${program} 2>&1 \ +- | ${test_source_directory}/filter-locations.sh ${program} >${output} +-- +2.41.0 + diff --git a/0004-removed-set-but-unused-variables-in-yacc-reader.c-11.patch b/0004-removed-set-but-unused-variables-in-yacc-reader.c-11.patch deleted file mode 100644 index 846f0be..0000000 --- a/0004-removed-set-but-unused-variables-in-yacc-reader.c-11.patch +++ /dev/null @@ -1,39 +0,0 @@ -From ea8b79eda165722d04b369f1811a5aa80ab5acc6 Mon Sep 17 00:00:00 2001 -From: SSHz -Date: Sun, 27 Nov 2022 14:46:16 +0000 -Subject: [PATCH 04/17] removed set but unused variables in yacc/reader.c - (#11758) - -(cherry picked from commit 0114f62d3ed056254ac25192f724e92a2ff6c448) ---- - yacc/reader.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/yacc/reader.c b/yacc/reader.c -index 7377967994..7a0b888961 100644 ---- a/yacc/reader.c -+++ b/yacc/reader.c -@@ -1049,12 +1049,10 @@ void read_declarations(void) - void output_token_type(void) - { - bucket * bp; -- int n; - - fprintf(interface_file, "type token =\n"); - if (!rflag) ++outline; - fprintf(output_file, "type token =\n"); -- n = 0; - for (bp = first_symbol; bp; bp = bp->next) { - if (bp->class == TERM && bp->true_token) { - fprintf(interface_file, " | %s", bp->name); -@@ -1068,7 +1066,6 @@ void output_token_type(void) - fprintf(interface_file, "\n"); - if (!rflag) ++outline; - fprintf(output_file, "\n"); -- n++; - } - } - fprintf(interface_file, "\n"); --- -2.41.0 - diff --git a/0005-Merge-pull-request-11860-from-Octachron-index_for_st.patch b/0005-Merge-pull-request-11860-from-Octachron-index_for_st.patch deleted file mode 100644 index 8421941..0000000 --- a/0005-Merge-pull-request-11860-from-Octachron-index_for_st.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 848e28fc6f3f3c9802b23c00f2d77f568c761667 Mon Sep 17 00:00:00 2001 -From: Gabriel Scherer -Date: Tue, 3 Jan 2023 17:41:12 +0100 -Subject: [PATCH 05/17] Merge pull request #11860 from - Octachron/index_for_stdlib - -documentation: sort modules alphabetically - -fixes #11857 - -(cherry picked from commit 14004c6d4bedadb7215ded2c77230270e52307ff) ---- - api_docgen/Makefile.docfiles | 24 +++++++++++++++--------- - 1 file changed, 15 insertions(+), 9 deletions(-) - -diff --git a/api_docgen/Makefile.docfiles b/api_docgen/Makefile.docfiles -index 0c2412b192..f12830b1ec 100644 ---- a/api_docgen/Makefile.docfiles -+++ b/api_docgen/Makefile.docfiles -@@ -26,10 +26,6 @@ define capitalize - $(foreach m,$(1),$(call capitalize_one,$m)) - endef - --define sort --$(shell $(OCAMLDEP) -sort $(1)) --endef -- - runtime_events_MLIS := runtime_events.mli - str_MLIS := str.mli - unix_MLIS := unix.mli unixLabels.mli -@@ -62,10 +58,8 @@ endif - libref_TEXT=Ocaml_operators Format_tutorial - libref_C=$(call capitalize,$(libref)) - --PARSING_MLIS := $(call sort, \ -- $(notdir $(wildcard $(ROOTDIR)/parsing/*.mli))\ --) --UTILS_MLIS := $(call sort,$(notdir $(wildcard $(ROOTDIR)/utils/*.mli))) -+PARSING_MLIS := $(notdir $(wildcard $(ROOTDIR)/parsing/*.mli)) -+UTILS_MLIS := $(notdir $(wildcard $(ROOTDIR)/utils/*.mli)) - DRIVER_MLIS := pparse.mli - - compilerlibref_MLIS= \ -@@ -76,8 +70,20 @@ compilerlibref=$(compilerlibref_MLIS:%.mli=%) - compilerlibref_TEXT=Compiler_libs - compilerlibref_C=$(call capitalize,$(compilerlibref)) - --ALL_LIBREF= $(libref_TEXT:%=libref/%) $(libref:%=libref/%) -+ALL_LIBREF= \ -+ $(sort $(libref_TEXT:%=libref/%)) \ -+ $(sort $(filter-out libref/camlinternal%, $(libref:%=libref/%))) \ -+ $(sort $(filter libref/camlinternal%, $(libref:%=libref/%))) -+ - ALL_COMPILERLIBREF= \ - $(compilerlibref_TEXT:%=compilerlibref/%) \ - $(compilerlibref:%=compilerlibref/%) -+# Note that the output of $(wildcard ...) is sorted alphabetically. -+# The compilerlibs index will be thus be sorted first by category: -+# - text documentation -+# - parsing modules -+# - utils modules -+# - driver modules -+# And then alphabetically inside each category. -+ - ALL_DOC= $(ALL_LIBREF) $(ALL_COMPILERLIBREF) --- -2.41.0 - diff --git a/0006-Allow-installing-in-folder-with-space-in-name-11590.patch b/0006-Allow-installing-in-folder-with-space-in-name-11590.patch deleted file mode 100644 index ed6c490..0000000 --- a/0006-Allow-installing-in-folder-with-space-in-name-11590.patch +++ /dev/null @@ -1,42 +0,0 @@ -From a3cd42bc03ed0fc706bb7364fdb14b29b1925600 Mon Sep 17 00:00:00 2001 -From: David Allsopp -Date: Wed, 4 Jan 2023 16:33:28 +0000 -Subject: [PATCH 06/17] Allow installing in folder with space in name (#11590) - -- fix(build): Repair make install (in man/Makefile) ---- - Changes | 8 ++++++++ - man/Makefile | 4 ++-- - 2 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/Changes b/Changes -index 776f6e7a45..438c0f3ec2 100644 ---- a/Changes -+++ b/Changes -@@ -1,3 +1,11 @@ -+OCaml 5.0 maintenance version -+----------------------------- -+ -+### Build system: -+ -+- #11590: Allow installing to a destination path containing spaces. -+ (Élie Brami, review by Sébastien Hinderer and David Allsopp) -+ - OCaml 5.0 (16 December 2022) - ---------------------------- - -diff --git a/man/Makefile b/man/Makefile -index 36d3126563..10cc8bbe41 100644 ---- a/man/Makefile -+++ b/man/Makefile -@@ -22,5 +22,5 @@ MANPAGES = $(addsuffix .1,\ - - .PHONY: install - install: -- $(MKDIR) $(INSTALL_PROGRAMS_MAN_DIR) -- $(INSTALL_DATA) $(MANPAGES) $(INSTALL_PROGRAMS_MAN_DIR) -+ $(MKDIR) '$(INSTALL_PROGRAMS_MAN_DIR)' -+ $(INSTALL_DATA) $(MANPAGES) '$(INSTALL_PROGRAMS_MAN_DIR)' --- -2.41.0 - diff --git a/0007-Detect-unused-Makefile-variables-in-workflow.patch b/0007-Detect-unused-Makefile-variables-in-workflow.patch deleted file mode 100644 index 0af534d..0000000 --- a/0007-Detect-unused-Makefile-variables-in-workflow.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 44f4015f9a649e164b332e6ab1302139191d4a4f Mon Sep 17 00:00:00 2001 -From: David Allsopp -Date: Wed, 3 Mar 2021 12:24:36 +0000 -Subject: [PATCH 07/17] Detect unused Makefile variables in workflow - ---- - tools/ci/actions/runner.sh | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/tools/ci/actions/runner.sh b/tools/ci/actions/runner.sh -index ede27f710a..26123b40d1 100755 ---- a/tools/ci/actions/runner.sh -+++ b/tools/ci/actions/runner.sh -@@ -21,6 +21,8 @@ PREFIX=~/local - MAKE="make $MAKE_ARG" - SHELL=dash - -+MAKE_WARN="$MAKE --warn-undefined-variables" -+ - export PATH=$PREFIX/bin:$PATH - - Configure () { -@@ -60,9 +62,18 @@ EOF - } - - Build () { -- $MAKE world.opt -+ if [ "$(uname)" = 'Darwin' ]; then -+ script -q build.log $MAKE_WARN -+ else -+ script --return --command "$MAKE_WARN" build.log -+ fi - echo Ensuring that all names are prefixed in the runtime - ./tools/check-symbol-names runtime/*.a otherlibs/*/lib*.a -+ if grep -Fq ' warning: undefined variable ' build.log; then -+ echo Undefined Makefile variables detected -+ exit 1 -+ fi -+ rm build.log - } - - Test () { --- -2.41.0 - diff --git a/0008-Fix-incorrect-variable-from-runtime-Makefile-merge.patch b/0008-Fix-incorrect-variable-from-runtime-Makefile-merge.patch deleted file mode 100644 index 504a5fd..0000000 --- a/0008-Fix-incorrect-variable-from-runtime-Makefile-merge.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 2eccdd3cd78624b0f2664d6152afbcae167f6f8b Mon Sep 17 00:00:00 2001 -From: David Allsopp -Date: Mon, 20 Feb 2023 20:27:58 +0000 -Subject: [PATCH 08/17] Fix incorrect variable from runtime/Makefile merge - -Wrong CPPFLAGS used when assembling with ASPP. ---- - Makefile | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/Makefile b/Makefile -index bb2c245eab..3ea3296c7f 100644 ---- a/Makefile -+++ b/Makefile -@@ -952,6 +952,15 @@ ASPP_ERROR = \ - runtime/%.o: runtime/%.S - $(ASPP) $(OC_ASPPFLAGS) -o $@ $< || $(ASPP_ERROR) - -+# $(OC_DEBUG_CPPFLAGS) and $(OC_INSTR_CPPFLAGS) are still used in the two -+# recipes just below instead of the correct $(ocamlrund_CPPFLAGS) and -+# $(ocamlruni_CPPFLAGS). This has been fixed on trunk, but in the -+# 5.0 maintenance branch here we just define default values for those OC_* -+# variables to avoid an undefined-variable warning, preserving exactly the -+# (somewhat strange) behaviour of the 5.0.0 release. -+OC_DEBUG_CPPFLAGS ?= -+OC_INSTR_CPPFLAGS ?= -+ - runtime/%.d.o: runtime/%.S - $(ASPP) $(OC_ASPPFLAGS) $(OC_DEBUG_CPPFLAGS) -o $@ $< || $(ASPP_ERROR) - --- -2.41.0 - diff --git a/0009-Provide-a-default-for-OCAMLDEPFLAGS.patch b/0009-Provide-a-default-for-OCAMLDEPFLAGS.patch deleted file mode 100644 index cdb8e60..0000000 --- a/0009-Provide-a-default-for-OCAMLDEPFLAGS.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 5f3f8bf734bdc02adc69cf92f066547bd71e8a25 Mon Sep 17 00:00:00 2001 -From: David Allsopp -Date: Mon, 20 Feb 2023 20:31:31 +0000 -Subject: [PATCH 09/17] Provide a default for $(OCAMLDEPFLAGS) - ---- - Makefile.common | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Makefile.common b/Makefile.common -index 536e2a28ca..e2a9176a5c 100644 ---- a/Makefile.common -+++ b/Makefile.common -@@ -169,6 +169,7 @@ endef # PROGRAM_SYNONYM - # should take place *before* Makefile.common is included. - - OCAMLDEP ?= $(BEST_OCAMLDEP) -+OCAMLDEPFLAGS ?= - OC_OCAMLDEPFLAGS = -slash - OC_OCAMLDEPDIRS = - OCAMLDEP_CMD = $(OCAMLDEP) $(OC_OCAMLDEPFLAGS) \ --- -2.41.0 - diff --git a/0010-Report-all-post-build-failures.patch b/0010-Report-all-post-build-failures.patch deleted file mode 100644 index 952529f..0000000 --- a/0010-Report-all-post-build-failures.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 7f4569e22c2a19d51324c44a2954b10427df2cd8 Mon Sep 17 00:00:00 2001 -From: David Allsopp -Date: Tue, 21 Feb 2023 14:44:21 +0000 -Subject: [PATCH 10/17] Report all post-build failures - -Rather than just reporting un-prefixed symbol names, also report -undefined variables. ---- - tools/ci/actions/runner.sh | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/tools/ci/actions/runner.sh b/tools/ci/actions/runner.sh -index 26123b40d1..6e5a30f73a 100755 ---- a/tools/ci/actions/runner.sh -+++ b/tools/ci/actions/runner.sh -@@ -67,13 +67,19 @@ Build () { - else - script --return --command "$MAKE_WARN" build.log - fi -- echo Ensuring that all names are prefixed in the runtime -- ./tools/check-symbol-names runtime/*.a otherlibs/*/lib*.a -+ failed=0 - if grep -Fq ' warning: undefined variable ' build.log; then - echo Undefined Makefile variables detected -- exit 1 -+ failed=1 - fi - rm build.log -+ echo Ensuring that all names are prefixed in the runtime -+ if ! ./tools/check-symbol-names runtime/*.a otherlibs/*/lib*.a ; then -+ failed=1 -+ fi -+ if ((failed)); then -+ exit 1 -+ fi - } - - Test () { --- -2.41.0 - diff --git a/0011-Finish-off-removal-of-FORCE_INSTRUMENTED_RUNTIME.patch b/0011-Finish-off-removal-of-FORCE_INSTRUMENTED_RUNTIME.patch deleted file mode 100644 index 543afca..0000000 --- a/0011-Finish-off-removal-of-FORCE_INSTRUMENTED_RUNTIME.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0f6dc503bf3814e5547ffb4e9d6ea0a75ffd1ec0 Mon Sep 17 00:00:00 2001 -From: David Allsopp -Date: Wed, 22 Feb 2023 10:47:00 +0000 -Subject: [PATCH 11/17] Finish off removal of FORCE_INSTRUMENTED_RUNTIME - ---- - utils/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/utils/Makefile b/utils/Makefile -index 0fcbc59ce5..efd8574fa5 100644 ---- a/utils/Makefile -+++ b/utils/Makefile -@@ -90,7 +90,6 @@ config_main.ml: config.mlp $(ROOTDIR)/Makefile.config Makefile config.common.ml - $(call SUBST,FUNCTION_SECTIONS) \ - $(call SUBST,CC_HAS_DEBUG_PREFIX_MAP) \ - $(call SUBST,AS_HAS_DEBUG_PREFIX_MAP) \ -- $(call SUBST,FORCE_INSTRUMENTED_RUNTIME) \ - $< > $@ - cat config.common.ml >> $@ - --- -2.41.0 - diff --git a/0012-suppress-spurious-alert-when-compiling-stdlib-docume.patch b/0012-suppress-spurious-alert-when-compiling-stdlib-docume.patch deleted file mode 100644 index d0416ba..0000000 --- a/0012-suppress-spurious-alert-when-compiling-stdlib-docume.patch +++ /dev/null @@ -1,27 +0,0 @@ -From ffb2022797986324213891a59c02af46269b5c17 Mon Sep 17 00:00:00 2001 -From: Damien Doligez -Date: Mon, 17 Apr 2023 11:36:32 +0200 -Subject: [PATCH 12/17] suppress spurious alert when compiling stdlib - documentation - -(cherry picked from commit 5c0fb8e23865fdbf151bdbe15d91176903c284d3) ---- - api_docgen/ocamldoc/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/api_docgen/ocamldoc/Makefile b/api_docgen/ocamldoc/Makefile -index 1b3d5f57f7..b6419ae50d 100644 ---- a/api_docgen/ocamldoc/Makefile -+++ b/api_docgen/ocamldoc/Makefile -@@ -44,7 +44,7 @@ $(libref:%=build/libref/%.odoc): build/libref/%.odoc: %.mli | build/libref - $(OCAMLDOC_RUN) -nostdlib -hide Stdlib -lib Stdlib \ - -pp \ - "$(AWK) -v ocamldoc=true -f ../../stdlib/expand_module_aliases.awk" \ -- $(DOC_STDLIB_INCLUDES) -hide-warnings $< -dump $@ -+ $(DOC_STDLIB_INCLUDES) -hide-warnings -alert -all $< -dump $@ - - $(compilerlibref:%=build/compilerlibref/%.odoc):\ - build/compilerlibref/%.odoc: %.mli | build/compilerlibref --- -2.41.0 - diff --git a/0013-Merge-pull-request-12285-from-smorimoto-update-depre.patch b/0013-Merge-pull-request-12285-from-smorimoto-update-depre.patch deleted file mode 100644 index 519c245..0000000 --- a/0013-Merge-pull-request-12285-from-smorimoto-update-depre.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 4cc4eb8b0d71c64c5252d6764f4c4b0aa6020995 Mon Sep 17 00:00:00 2001 -From: David Allsopp -Date: Sat, 3 Jun 2023 18:02:24 +0100 -Subject: [PATCH 13/17] Merge pull request #12285 from - smorimoto/update-deprecated-actions - -Update deprecated GitHub Actions - -(cherry picked from commit eadb05a504e0738f246a7dc846a442793005a27a) ---- - .github/workflows/build.yml | 8 ++++---- - .github/workflows/hygiene.yml | 2 +- - 2 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml -index ae0fcace20..933c14a926 100644 ---- a/.github/workflows/build.yml -+++ b/.github/workflows/build.yml -@@ -18,7 +18,7 @@ jobs: - manual_changed: ${{ steps.manual.outputs.manual_changed }} - steps: - - name: Checkout -- uses: actions/checkout@v2 -+ uses: actions/checkout@v3 - - name: Check for manual changes - id: manual - run: >- -@@ -45,7 +45,7 @@ jobs: - git config --local --unset http.https://github.com/.extraheader - tar --zstd -cf /tmp/sources.tar.zstd . - - name: Upload Artifact -- uses: actions/upload-artifact@v2 -+ uses: actions/upload-artifact@v3 - with: - name: compiler - path: /tmp/sources.tar.zstd -@@ -57,7 +57,7 @@ jobs: - runs-on: ubuntu-latest - steps: - - name: Download Artifact -- uses: actions/download-artifact@v2 -+ uses: actions/download-artifact@v3 - with: - name: compiler - - name: Unpack Artifact -@@ -137,7 +137,7 @@ jobs: - - debug-s4096 - steps: - - name: Download artifact -- uses: actions/download-artifact@v2 -+ uses: actions/download-artifact@v3 - with: - name: compiler - - name: Unpack Artifact -diff --git a/.github/workflows/hygiene.yml b/.github/workflows/hygiene.yml -index e89efd2f47..3b2e10795f 100644 ---- a/.github/workflows/hygiene.yml -+++ b/.github/workflows/hygiene.yml -@@ -17,7 +17,7 @@ jobs: - # context variable. - if: failure() - -- - uses: actions/checkout@v2 -+ - uses: actions/checkout@v3 - with: - fetch-depth: 50 - --- -2.41.0 - diff --git a/0014-Merge-pull-request-12286-from-smorimoto-replace-set-.patch b/0014-Merge-pull-request-12286-from-smorimoto-replace-set-.patch deleted file mode 100644 index c29b0c7..0000000 --- a/0014-Merge-pull-request-12286-from-smorimoto-replace-set-.patch +++ /dev/null @@ -1,40 +0,0 @@ -From af3a67cd06e07825c63b70a038cf90481039b1ed Mon Sep 17 00:00:00 2001 -From: David Allsopp -Date: Fri, 9 Jun 2023 21:47:51 +0100 -Subject: [PATCH 14/17] Merge pull request #12286 from - smorimoto/replace-set-output - -Replace the set-output command with the GITHUB_OUTPUT environment file - -(cherry picked from commit 50054a632a5ac3bb4199276617d358e3fa4a108b) ---- - tools/ci/actions/check-manual-modified.sh | 2 +- - tools/ci/actions/runner.sh | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tools/ci/actions/check-manual-modified.sh b/tools/ci/actions/check-manual-modified.sh -index dc8b6bd809..c5826c1fd0 100755 ---- a/tools/ci/actions/check-manual-modified.sh -+++ b/tools/ci/actions/check-manual-modified.sh -@@ -32,4 +32,4 @@ else - fi - - echo "Manual altered: $result" --echo "::set-output name=manual_changed::$result" -+echo "manual_changed=$result" >>"$GITHUB_OUTPUT" -diff --git a/tools/ci/actions/runner.sh b/tools/ci/actions/runner.sh -index 6e5a30f73a..295e58a83e 100755 ---- a/tools/ci/actions/runner.sh -+++ b/tools/ci/actions/runner.sh -@@ -159,7 +159,7 @@ ReportBuildStatus () { - else - STATUS='success' - fi -- echo "::set-output name=build-status::$STATUS" -+ echo "build-status=$STATUS" >>"$GITHUB_OUTPUT" - exit $CODE - } - --- -2.41.0 - diff --git a/0015-Don-t-add-rpaths-to-libraries.patch b/0015-Don-t-add-rpaths-to-libraries.patch deleted file mode 100644 index 74c6dfa..0000000 --- a/0015-Don-t-add-rpaths-to-libraries.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0e07dfdb530734ef4db351ecc24c6363e36916ec Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 15/17] Don't add rpaths to libraries. - ---- - utils/config.mlp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/utils/config.mlp b/utils/config.mlp -index 7e1848f433..811d9134dd 100644 ---- a/utils/config.mlp -+++ b/utils/config.mlp -@@ -42,8 +42,8 @@ let native_c_compiler = - c_compiler ^ " " ^ ocamlopt_cflags ^ " " ^ ocamlopt_cppflags - let native_c_libraries = "%%NATIVECCLIBS%%" - let native_pack_linker = "%%PACKLD%%" --let default_rpath = "%%RPATH%%" --let mksharedlibrpath = "%%MKSHAREDLIBRPATH%%" -+let default_rpath = "" -+let mksharedlibrpath = "" - let ar = "%%ARCMD%%" - let supports_shared_libraries = %%SUPPORTS_SHARED_LIBRARIES%% - let mkdll, mkexe, mkmaindll = --- -2.41.0 - diff --git a/0016-configure-Allow-user-defined-C-compiler-flags.patch b/0016-configure-Allow-user-defined-C-compiler-flags.patch deleted file mode 100644 index a3d322a..0000000 --- a/0016-configure-Allow-user-defined-C-compiler-flags.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 9d3722c87ab15dfbc4e1a934e09ddc8253712d9c Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 16/17] configure: Allow user defined C compiler flags. - ---- - configure.ac | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/configure.ac b/configure.ac -index a7974b0426..8068de3cfc 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -670,6 +670,10 @@ AS_CASE([$host], - internal_cflags="$cc_warnings"], - [common_cflags="-O"])]) - -+# Allow CFLAGS and LDFLAGS to be added. -+common_cflags="$common_cflags $CFLAGS" -+cclibs="$cclibs $LDFLAGS" -+ - # Enable SSE2 on x86 mingw to avoid using 80-bit registers. - AS_CASE([$host], - [i686-*-mingw32], --- -2.41.0 - diff --git a/0017-Fix-skiplist-test-failure-12346.patch b/0017-Fix-skiplist-test-failure-12346.patch deleted file mode 100644 index 87219e7..0000000 --- a/0017-Fix-skiplist-test-failure-12346.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 74b0eee42f616cb05c640c0ceac0cc391e4a7ef1 Mon Sep 17 00:00:00 2001 -From: Jerry James -Date: Fri, 7 Jul 2023 07:07:09 -0600 -Subject: [PATCH 17/17] Fix skiplist test failure (#12346) - -Fix -Wmaybe-uninitialized warning in skiplist test -Fix -Wunused-variable warning in skiplist test - -Co-authored-by: Xavier Leroy -(cherry picked from commit 3027e3308d685af03caf4f605b4bec55b04ed28e) -(cherry picked from commit 9aa7761060a7c40d11237599382b892dbcb79cb5) ---- - testsuite/tests/lf_skiplist/stubs.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/testsuite/tests/lf_skiplist/stubs.c b/testsuite/tests/lf_skiplist/stubs.c -index 991483e408..acc0eaf9cf 100644 ---- a/testsuite/tests/lf_skiplist/stubs.c -+++ b/testsuite/tests/lf_skiplist/stubs.c -@@ -64,7 +64,7 @@ static int get_len(struct lf_skipcell *p, struct lf_skipcell *end) { - static uintnat count_marks(struct lf_skiplist *sk) { - uintnat r = 0; - struct lf_skipcell *p = sk->head; -- uintptr_t succ; -+ uintptr_t succ = 0; - - while (p) { - for (int k = p->top_level; k >= 0; k--) { -@@ -135,7 +135,6 @@ inline static uintnat calc_right(uintnat id,uintnat turn,uintnat ndoms) { return - CAMLprim value insert_skiplist(value turn_val,value ndoms_val,value domain_id_val) { - CAMLparam3(turn_val,ndoms_val,domain_id_val); - uintnat domain_id = Long_val(domain_id_val); -- uintnat ndoms = Long_val(ndoms_val); - uintnat turn = Long_val(turn_val); - uintnat k = calc_key(domain_id,turn) ; - uintnat v = calc_value(domain_id) ; --- -2.41.0 - diff --git a/macros.ocaml-rpm b/macros.ocaml-rpm new file mode 100644 index 0000000..ac94c48 --- /dev/null +++ b/macros.ocaml-rpm @@ -0,0 +1,69 @@ +# Make %files lists from an installed tree of files. +# Options: +# -s: separate packaging; every subdirectory of %%{ocamldir}, except stublibs, +# is placed in its own package. This option requires the existence of opam +# *.install files in the build tree. +# -n: suppress creation of a devel subpackage. +%ocaml_files(sn) %{python3} /usr/lib/rpm/redhat/ocaml_files.py %{-s} %{-n} %{buildroot} %{ocamldir} + +# Internal macro holding the common parts of ocaml_install and dune_install +%ocaml_install_common(sn) %{expand: +rm -rf %{buildroot}%{_prefix}/doc +mlis=$(find %{buildroot}%{_libdir}/ocaml -name '*.mli') +rm -f ${mlis//.mli/.ml} +%ocaml_files %{-s} %{-n}} + +# Install files listed in opam *.install files. +# Options: +# -s: separate packaging; every subdirectory of %%{ocamldir}, except stublibs, +# is placed in its own package. +# -n: suppress creation of a devel subpackage. +%ocaml_install(sn) %{expand: +%{python3} /usr/lib/rpm/redhat/ocaml_files.py -i %{-s} %{-n} %{buildroot} %{ocamldir} +%ocaml_install_common %{-s} %{-n}} + +# Add smp_mflags to arguments if no -j release option is given. +# Add --release to arguments if no -p or --release option is given. +# Add --verbose to arguments if it is not given. +%dune_add_flags(-) %{lua: + has_j = false + has_p = false + has_v = false + for _, flag in pairs(arg) do + if flag:find("^-j") then + has_j = true + elseif flag:find("^-p") or flag:find("^--release)") then + has_p = true + elseif flag:find("^--verbose") then + has_v = true + end + end + if not has_j then + table.insert(arg, 1, rpm.expand("%{?_smp_mflags}")) + end + if not has_p then + table.insert(arg, 1, "--release") + end + if not has_v then + table.insert(arg, 1, "--verbose") + end + print(table.concat(arg, " ")) +} + +# Build with dune +%dune_build(-) dune build %{dune_add_flags %*} + +# Run tests with dune +%dune_check(-) dune runtest %{dune_add_flags %*} + +# Install with dune +# Options: +# -s: separate packaging; every subdirectory of %%{ocamldir}, except stublibs, +# is placed in its own package. +# -n: suppress creation of a devel subpackage. +%dune_install(sn) %{expand: +dune install --destdir=%{buildroot} %{dune_add_flags %*} +if [ -d _build/default/_doc/_html ]; then + find _build/default/_doc/_html -name .dune-keep -delete +fi +%ocaml_install_common %{-s} %{-n}} diff --git a/ocaml.spec b/ocaml.spec index 78683d0..2669eac 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -1,6 +1,12 @@ # Don't add -Wl,-dT, %undefine _package_note_flags +# OCaml 5.1 broke building with LTO. A file prims.c is generated with primitive +# function declarations, all with "void" for their parameter list. This does +# not match the real definitions, leading to lots of -Wlto-type-mismatch +# warnings. These change the output of the tests, leading to many failed tests. +%global _lto_cflags %{nil} + # OCaml has a bytecode backend that works on anything with a C # compiler, and a native code backend available on a subset of # architectures. A further subset of architectures support native @@ -23,7 +29,7 @@ ExcludeArch: %{ix86} # 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} riscv64 s390x 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 @@ -36,8 +42,8 @@ ExcludeArch: %{ix86} %global rcver %{nil} Name: ocaml -Version: 5.0.0 -Release: 4%{?dist} +Version: 5.1.0 +Release: 1%{?dist} Summary: OCaml compiler and programming environment @@ -46,6 +52,8 @@ License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception URL: https://www.ocaml.org Source0: https://github.com/ocaml/ocaml/archive/%{version}/%{name}-%{version}.tar.gz +Source1: macros.ocaml-rpm +Source2: ocaml_files.py # IMPORTANT NOTE: # @@ -56,44 +64,33 @@ Source0: https://github.com/ocaml/ocaml/archive/%{version}/%{name}-%{vers # # https://pagure.io/fedora-ocaml # -# Current branch: fedora-39-5.0.0 +# Current branch: fedora-40-5.1.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. -# Patches added after 5.0.0 was released. -Patch: 0001-increment-version-number-after-tagging-5.0.0.patch -Patch: 0002-Merge-pull-request-11814-from-gasche-clarify-DLS.new.patch -Patch: 0003-Add-KC-Sivaramakrishnan-as-author.patch -Patch: 0004-removed-set-but-unused-variables-in-yacc-reader.c-11.patch -Patch: 0005-Merge-pull-request-11860-from-Octachron-index_for_st.patch -Patch: 0006-Allow-installing-in-folder-with-space-in-name-11590.patch -Patch: 0007-Detect-unused-Makefile-variables-in-workflow.patch -Patch: 0008-Fix-incorrect-variable-from-runtime-Makefile-merge.patch -Patch: 0009-Provide-a-default-for-OCAMLDEPFLAGS.patch -Patch: 0010-Report-all-post-build-failures.patch -Patch: 0011-Finish-off-removal-of-FORCE_INSTRUMENTED_RUNTIME.patch -Patch: 0012-suppress-spurious-alert-when-compiling-stdlib-docume.patch -Patch: 0013-Merge-pull-request-12285-from-smorimoto-update-depre.patch -Patch: 0014-Merge-pull-request-12286-from-smorimoto-replace-set-.patch +# Patches added after 5.1.0 was released. # Fedora-specific patches -Patch: 0015-Don-t-add-rpaths-to-libraries.patch -Patch: 0016-configure-Allow-user-defined-C-compiler-flags.patch - -# Fix skiplist test failure -# https://github.com/ocaml/ocaml/pull/12346 -Patch: 0017-Fix-skiplist-test-failure-12346.patch +Patch: 0001-Don-t-add-rpaths-to-libraries.patch +Patch: 0002-configure-Allow-user-defined-C-compiler-flags.patch +# https://github.com/ocaml/ocaml/pull/12530 +Patch: 0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch +# https://github.com/ocaml/ocaml/pull/11594 +Patch: 0004-Update-framepointers-tests-to-avoid-false-positive-w.patch BuildRequires: make BuildRequires: git BuildRequires: gcc BuildRequires: autoconf BuildRequires: gawk +BuildRequires: hardlink +BuildRequires: parallel BuildRequires: perl-interpreter BuildRequires: util-linux BuildRequires: /usr/bin/annocheck +BuildRequires: pkgconfig(libzstd) # Documentation requirements BuildRequires: asciidoc @@ -101,17 +98,19 @@ BuildRequires: python3-pygments # ocamlopt runs gcc to link binaries. Because Fedora includes # hardening flags automatically, redhat-rpm-config is also required. +# Compressed marshaling requires libzstd-devel. Requires: gcc Requires: redhat-rpm-config +Requires: libzstd-devel%{?_isa} # Because we pass -c flag to ocaml-find-requires (to avoid circular # dependencies) we also have to explicitly depend on the right version # of ocaml-runtime. Requires: ocaml-runtime%{?_isa} = %{version}-%{release} -# Force ocaml-srpm-macros to be at the latest version, since OCaml 5.0 +# Force ocaml-srpm-macros to be at the latest version, since OCaml 5.1 # has a different set of native code generators than previous versions. -Requires: ocaml-srpm-macros >= 8 +Requires: ocaml-srpm-macros >= 9 # Bundles an MD5 implementation in runtime/caml/md5.h and runtime/md5.c Provides: bundled(md5-plumb) @@ -137,6 +136,10 @@ and a comprehensive library. %package runtime +# LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception: the project as a whole +# LicenseRef-Fedora-Public-Domain: the MD5 implementation in runtime/caml/md5.h +# and runtime/md5.c +License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception AND LicenseRef-Fedora-Public-Domain Summary: OCaml runtime environment Requires: util-linux Provides: ocaml(runtime) = %{version} @@ -197,6 +200,20 @@ Note that this exposes internal details of the OCaml compiler which may not be portable between versions. +%package rpm-macros +# LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception: the project as a whole +# BSD-3-Clause: ocaml_files.py +License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception AND BSD-3-Clause +Summary: RPM macros for building OCaml packages +BuildArch: noarch +Requires: ocaml = %{version}-%{release} +Requires: python3 + + +%description rpm-macros +This package contains macros that are useful for building OCaml RPMs. + + %prep %autosetup -S git -n %{name}-%{version}%{rcver} # Patches touch configure.ac, so rebuild it: @@ -214,6 +231,9 @@ make=make # Set ocamlmklib default flags to include Fedora linker flags sed -i '/ld_opts/s|\[\]|["%{build_ldflags}"]|' tools/ocamlmklib.ml +# Expose a dependency on the math library +sed -i '/^EXTRACAMLFLAGS=/aLINKOPTS=-cclib -lm' otherlibs/unix/Makefile + # Don't use %%configure macro because it sets --build, --host which # breaks some incorrect assumptions made by OCaml's configure.ac # @@ -295,58 +315,54 @@ echo %{version} > $RPM_BUILD_ROOT%{_libdir}/ocaml/fedora-ocaml-release # Remove the installed documentation. We will install it using %%doc rm -rf $RPM_BUILD_ROOT%{_docdir}/ocaml +mkdir -p $RPM_BUILD_ROOT%{rpmmacrodir} +install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{rpmmacrodir}/macros.ocaml-rpm + +mkdir -p $RPM_BUILD_ROOT%{_rpmconfigdir}/redhat +install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_rpmconfigdir}/redhat + +# Link, rather than copy, identical binaries +hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs + %files %license LICENSE %{_bindir}/ocaml %{_bindir}/ocamlcmt +%{_bindir}/ocamlcp %{_bindir}/ocamldebug +%{_bindir}/ocamlmklib +%{_bindir}/ocamlmktop +%{_bindir}/ocamlprof %{_bindir}/ocamlyacc # symlink to either .byte or .opt version %{_bindir}/ocamlc -%{_bindir}/ocamlcp %{_bindir}/ocamldep %{_bindir}/ocamllex -%{_bindir}/ocamlmklib -%{_bindir}/ocamlmktop %{_bindir}/ocamlobjinfo -%{_bindir}/ocamloptp -%{_bindir}/ocamlprof # bytecode versions %{_bindir}/ocamlc.byte -%{_bindir}/ocamlcp.byte %{_bindir}/ocamldep.byte %{_bindir}/ocamllex.byte -%{_bindir}/ocamlmklib.byte -%{_bindir}/ocamlmktop.byte %{_bindir}/ocamlobjinfo.byte -%{_bindir}/ocamloptp.byte -%{_bindir}/ocamlprof.byte %if %{native_compiler} # native code versions %{_bindir}/ocamlc.opt -%{_bindir}/ocamlcp.opt %{_bindir}/ocamldep.opt %{_bindir}/ocamllex.opt -%{_bindir}/ocamlmklib.opt -%{_bindir}/ocamlmktop.opt %{_bindir}/ocamlobjinfo.opt -%{_bindir}/ocamloptp.opt -%{_bindir}/ocamlprof.opt -%endif - -%if %{native_compiler} -%{_bindir}/ocamlopt -%{_bindir}/ocamlopt.byte -%{_bindir}/ocamlopt.opt %endif %if %{native_compiler} %{_bindir}/ocamlnat +%{_bindir}/ocamlopt +%{_bindir}/ocamlopt.byte +%{_bindir}/ocamlopt.opt +%{_bindir}/ocamloptp %endif %{_libdir}/ocaml/camlheader @@ -398,9 +414,6 @@ rm -rf $RPM_BUILD_ROOT%{_docdir}/ocaml %{_libdir}/ocaml/dynlink/META %{_libdir}/ocaml/dynlink/*.cmi %{_libdir}/ocaml/dynlink/*.cma -%dir %{_libdir}/ocaml/ocamlmktop -%{_libdir}/ocaml/ocamlmktop/*.cmo -%{_libdir}/ocaml/ocamlmktop/*.cmi %dir %{_libdir}/ocaml/profiling %{_libdir}/ocaml/profiling/*.cmo %{_libdir}/ocaml/profiling/*.cmi @@ -448,7 +461,19 @@ rm -rf $RPM_BUILD_ROOT%{_docdir}/ocaml %{_libdir}/ocaml/compiler-libs +%files rpm-macros +%{rpmmacrodir}/macros.ocaml-rpm +%{_rpmconfigdir}/redhat/ocaml_files.py + + %changelog +* Wed Oct 4 2023 Jerry James - 5.1.0-1 +- Version 5.1.0 +- Add LicenseRef-Fedora-Public-Domain to the runtime License field +- New ocaml-rpm-macros subpackage +- Depend on libzstd-devel for compressed marshaling +- Disable LTO + * Thu Jul 20 2023 Fedora Release Engineering - 5.0.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/ocaml_files.py b/ocaml_files.py new file mode 100644 index 0000000..cf4afd1 --- /dev/null +++ b/ocaml_files.py @@ -0,0 +1,451 @@ +# Copyright 2022-3, Jerry James +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the +# distribution. +# 3. Neither the name of Red Hat nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import argparse +import os +import shutil +import string +import sys +from collections.abc import Iterable, Iterator +from enum import Enum, auto +from typing import Callable, final + +# Version of this script +version=2 + +# +# BUILDROOT CATEGORIZATION +# + +# Directories to ignore when generating %dir entries +root_dirs: set[str] = { + '/', + '/etc', + '/usr', + '/usr/bin', + '/usr/lib', + '/usr/lib/ocaml', + '/usr/lib/ocaml/caml', + '/usr/lib/ocaml/stublibs', + '/usr/lib/ocaml/threads', + '/usr/lib64', + '/usr/lib64/ocaml', + '/usr/lib64/ocaml/caml', + '/usr/lib64/ocaml/stublibs', + '/usr/lib64/ocaml/threads', + '/usr/libexec', + '/usr/sbin', + '/usr/share', + '/usr/share/doc' +} + +def find_buildroot_toplevel(buildroot: str) -> list[str]: + """Find toplevel files and directories in the buildroot. + + :param str buildroot: path to the buildroot + :return: a list of toplevel files and directories in the buildroot + """ + bfiles: list[str] = [] + for path, dirs, files in os.walk(buildroot): + for i in range(len(dirs) - 1, -1, -1): + d = os.path.join(path, dirs[i])[len(buildroot):] + if d not in root_dirs and not d.startswith('/usr/share/man'): + bfiles.append(d) + del dirs[i] + for f in files: + realfile = os.path.join(path, f)[len(buildroot):] + if realfile.startswith('/usr/share/man'): + bfiles.append(realfile + '*') + else: + bfiles.append(realfile) + return bfiles + +# File suffixes that go into a devel subpackage +dev_suffixes: set[str] = { + 'a', 'cmo', 'cmt', 'cmti', 'cmx', 'cmxa', 'h', 'idl', 'ml', 'mli', 'o' +} + +def is_devel_file(filname: str) -> bool: + """Determine whether a file belongs to a devel subpackage. + + :param str filname: the filename to check + :return: True if the file belongs to a devel subpackage, else False + """ + return (filname == 'dune-package' or filname == 'opam' or + (os.path.splitext(filname)[1][1:] in dev_suffixes + and not filname.endswith('_top_init.ml'))) + +def find_buildroot_all(buildroot: str, devel: bool, add_star: bool) -> list[set[str]]: + """Find all files and directories in the buildroot and optionally + categorize them as 'main' or 'devel'. + + :param Namespace args: parsed command line arguments + :param bool devel: True to split into 'main' and 'devel', False otherwise + :param bool add_star: True to add a star to man page filenames + :return: a list of files and directories, in this order: main files, + main directories, devel files, and devel directories + """ + bfiles: list[set[str]] = [set(), set(), set()] + bdirs: set[str] = set() + for path, dirs, files in os.walk(buildroot): + for d in dirs: + realdir = os.path.join(path, d)[len(buildroot):] + if realdir not in root_dirs and not realdir.startswith('/usr/share/man'): + bdirs.add(realdir) + for f in files: + realfile = os.path.join(path, f)[len(buildroot):] + if devel and is_devel_file(os.path.basename(realfile)): + bfiles[2].add(realfile) + else: + if add_star and realfile.startswith('/usr/share/man'): + bfiles[0].add(realfile + '*') + else: + bfiles[0].add(realfile) + parentdir = os.path.dirname(realfile) + if parentdir in bdirs: + bfiles[1].add(parentdir) + bdirs.remove(parentdir) + # Catch intermediate directories, as in ocaml-mtime + parentdir = os.path.dirname(parentdir) + if parentdir in bdirs: + bfiles[1].add(parentdir) + bdirs.remove(parentdir) + bfiles.append(bdirs) + return bfiles + +# +# INSTALL FILE LEXER AND PARSER +# + +class TokenType(Enum): + """The types of tokens that can appear in an opam *.install file.""" + ERROR = auto() + COLON = auto() + LBRACE = auto() + RBRACE = auto() + LBRACK = auto() + RBRACK = auto() + STRING = auto() + FIELD = auto() + +@final +class InstallFileLexer(Iterator[tuple[TokenType, str]]): + """Convert an opam *.install file into a sequence of tokens.""" + __slots__ = ['index', 'text'] + + def __init__(self, filname: str) -> None: + """Create an opam *.install file lexer. + + :param str filname: the name of the file to read from + """ + self.index = 0 + with open(filname, 'r') as f: + # Limit reads to 4 MB in case this file is bogus. + # Most install files are under 4K. + self.text = f.read(4194304) + + def skip_whitespace(self) -> None: + """Skip over whitespace in the input.""" + while self.index < len(self.text) and \ + (self.text[self.index] == '#' or + self.text[self.index] in string.whitespace): + if self.text[self.index] == '#': + while (self.index < len(self.text) and + self.text[self.index] != '\n' and + self.text[self.index] != '\r'): + self.index += 1 + else: + self.index += 1 + + def __next__(self) -> tuple[TokenType, str]: + """Get the next token from the opam *.install file. + + :return: a pair containing the type and text of the next token + """ + self.skip_whitespace() + if self.index < len(self.text): + ch = self.text[self.index] + if ch == ':': + self.index += 1 + return (TokenType.COLON, ch) + if ch == '{': + self.index += 1 + return (TokenType.LBRACE, ch) + if ch == '}': + self.index += 1 + return (TokenType.RBRACE, ch) + if ch == '[': + self.index += 1 + return (TokenType.LBRACK, ch) + if ch == ']': + self.index += 1 + return (TokenType.RBRACK, ch) + if ch == '"': + start = self.index + 1 + end = start + while end < len(self.text) and self.text[end] != '"': + end += 2 if self.text[end] == '\\' else 1 + self.index = end + 1 + return (TokenType.STRING, self.text[start:end]) + if ch in string.ascii_letters: + start = self.index + end = start + 1 + while (end < len(self.text) and + (self.text[end] == '_' or + self.text[end] in string.ascii_letters)): + end += 1 + self.index = end + return (TokenType.FIELD, self.text[start:end]) + return (TokenType.ERROR, ch) + else: + raise StopIteration + +@final +class InstallFileParser(Iterable[tuple[str, bool, str, str]]): + """Parse opam *.install files.""" + + __slots__ = ['pkgname', 'lexer', 'libdir'] + + def __init__(self, filname: str, libdir: str) -> None: + """Initialize an OCaml .install file parser. + + :param str filname: name of the .install file to parse + :param str libdir: the OCaml library directory + """ + self.pkgname = os.path.splitext(os.path.basename(filname))[0] + self.lexer = InstallFileLexer(filname) + self.libdir = libdir + + def __iter__(self) -> Iterator[tuple[str, bool, str, str]]: + """Parse a .install file. + If there are any parse errors, we assume this file is not really an + opam .install file and abandon the parse. + """ + # Map opam installer names to directories + opammap: dict[str, str] = { + 'lib': os.path.join(self.libdir, self.pkgname), + 'lib_root': self.libdir, + 'libexec': os.path.join(self.libdir, self.pkgname), + 'libexec_root': self.libdir, + 'bin': '/usr/bin', + 'sbin': '/usr/sbin', + 'toplevel': os.path.join(self.libdir, 'toplevel'), + 'share': os.path.join('/usr/share', self.pkgname), + 'share_root': '/usr/share', + 'etc': os.path.join('/etc', self.pkgname), + 'doc': os.path.join('/usr/doc', self.pkgname), + 'stublibs': os.path.join(self.libdir, 'stublibs'), + 'man': '/usr/share/man' + } + + # Parse the file + try: + toktyp, token = next(self.lexer) + while toktyp == TokenType.FIELD: + libname = token + toktyp, token = next(self.lexer) + if toktyp != TokenType.COLON: + return + + toktyp, token = next(self.lexer) + if toktyp != TokenType.LBRACK: + return + + directory = opammap.get(libname) + if not directory: + return + + toktyp, token = next(self.lexer) + while toktyp == TokenType.STRING: + source = token + optional = source[0] == '?' + if optional: + source = source[1:] + nexttp, nexttk = next(self.lexer) + if nexttp == TokenType.LBRACE: + nexttp, nexttk = next(self.lexer) + if nexttp == TokenType.STRING: + filname = os.path.join(directory, nexttk) + bracetp, bractk = next(self.lexer) + if bracetp != TokenType.RBRACE: + return + nexttp, nexttk = next(self.lexer) + else: + return + elif libname == 'man': + index = token.rfind('.') + if index < 0: + return + mandir = os.path.join(directory, 'man' + token[index+1:]) + filname = os.path.join(mandir, os.path.basename(token)) + else: + filname = os.path.join(directory, os.path.basename(token)) + toktyp, token = nexttp, nexttk + yield (self.pkgname, optional, source, filname) + + if toktyp != TokenType.RBRACK: + return + toktyp, token = next(self.lexer) + except StopIteration: + return + +def install_files(buildroot: str, libdir: str) -> None: + """Install the files listed in opam .install files in the buildroot. + + For some projects, there are install files in both the project root + directory and somewhere under "_build", so be careful not to parse the same + install file twice. + + :param str buildroot: path to the buildroot + :param str libdir: the OCaml library directory + """ + install_files = set() + for path, dirs, files in os.walk('.'): + for f in files: + if f.endswith('.install') and f not in install_files: + install_files.add(f) + parser = InstallFileParser(os.path.join(path, f), libdir) + for _, optional, source, filname in parser: + if not optional or os.path.exists(source): + installpath = os.path.join(buildroot, filname[1:]) + os.makedirs(os.path.dirname(installpath), exist_ok=True) + shutil.copy2(source, installpath) + +def get_package_map(buildroot: str, libdir: str, devel: bool) -> dict[str, set[str]]: + """Create a map from package names to installed files from the opam .install + files in the buildroot. + + For some projects, there are install files in both the project root + directory and somewhere under "_build", so be careful not to parse the same + install file twice.""" + + pmap: dict[str, set[str]] = dict() + install_files = set() + + def add_pkg(pkgname: str, filname: str) -> None: + """Add a mapping from a package name to a filename. + + :param str pkgname: the package that acts as the map key + :param str filname: the filename to add to the package set + """ + if pkgname not in pmap: + pmap[pkgname] = set() + pmap[pkgname].add(filname) + + installed = find_buildroot_all(buildroot, devel, False) + for path, dirs, files in os.walk('.'): + for f in files: + if f.endswith('.install') and f not in install_files: + install_files.add(f) + parser = InstallFileParser(os.path.join(path, f), libdir) + for pkgname, _, _, filname in parser: + if filname in installed[0]: + if filname.startswith('/usr/share/man'): + add_pkg(pkgname, filname + '*') + else: + add_pkg(pkgname, filname) + dirname = os.path.dirname(filname) + if dirname in installed[1]: + add_pkg(pkgname, '%dir ' + dirname) + installed[1].remove(dirname) + elif filname in installed[2]: + if filname.startswith('/usr/share/man'): + add_pkg(pkgname + '-devel', filname + '*') + else: + add_pkg(pkgname + '-devel', filname) + dirname = os.path.dirname(filname) + if dirname in installed[3]: + add_pkg(pkgname + '-devel', '%dir ' + dirname) + installed[3].remove(dirname) + return pmap + +# +# MAIN INTERFACE +# + +def ocaml_files(no_devel: bool, separate: bool, install: bool, buildroot: str, + libdir: str) -> None: + """Generate %files lists from an installed buildroot. + + :param bool no_devel: False to split files into a main package and a devel + package + :param bool separate: True to place each OCaml module in an RPM package + :param bool install: True to install files, False to generate %files + :param str buildroot: the installed buildroot + :param str libdir: the OCaml library directory + """ + if install: + install_files(buildroot, libdir) + elif separate: + pkgmap = get_package_map(buildroot, libdir, not no_devel) + for pkg in pkgmap: + with open('.ofiles-' + pkg, 'w') as f: + for entry in pkgmap[pkg]: + f.write(entry + '\n') + elif no_devel: + with open('.ofiles', 'w') as f: + for entry in find_buildroot_toplevel(buildroot): + f.write(entry + '\n') + else: + files = find_buildroot_all(buildroot, True, True) + with open('.ofiles', 'w') as f: + for entry in files[0]: + f.write(entry + '\n') + for entry in files[1]: + f.write('%dir ' + entry + '\n') + with open('.ofiles-devel', 'w') as f: + for entry in files[2]: + f.write(entry + '\n') + for entry in files[3]: + f.write('%dir ' + entry + '\n') + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Support for building OCaml RPM packages') + parser.add_argument('-i', '--install', + action='store_true', + default=False, + help='install files instead of generating %files') + parser.add_argument('-n', '--no-devel', + action='store_true', + default=False, + help='suppress creation of a devel subpackage') + parser.add_argument('-s', '--separate', + action='store_true', + default=False, + help='separate packaging. Each OCaml module is in a distinct RPM package. All modules are in a single RPM package by default.') + parser.add_argument('-v', '--version', + action='version', + version=f'%(prog)s {str(version)}') + parser.add_argument('buildroot', help='RPM build root') + parser.add_argument('libdir', help='OCaml library directory') + args = parser.parse_args() + ocaml_files(args.no_devel, + args.separate, + args.install, + args.buildroot, + args.libdir) diff --git a/sources b/sources index 3a87a72..1da2f82 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ocaml-5.0.0.tar.gz) = c0cd445bdc2de5d45aae9aea78aab116807cc6782efbcb624a5843e2c0821ccb1e307cc23724f9636918495305cadc75abf04395cd9ede28597774ab60948167 +SHA512 (ocaml-5.1.0.tar.gz) = 814ea71de656eadc59a658ad3b6c4d786815c348ab883b1cdb22d5d0f99d11768f5646f03725f6b44c3b8f4ffeb71e89dadaea157711a7afbe86f23846fc5b52 From c37874e2662370f4998145cbc1a39eb7bcfb809e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 5 Oct 2023 09:58:44 +0100 Subject: [PATCH 02/31] Add upstream patch added after 5.1.0 --- 0001-Fix-variance-composition-12623.patch | 176 ++++++++++++++++++ ...> 0002-Don-t-add-rpaths-to-libraries.patch | 6 +- ...-Allow-user-defined-C-compiler-flags.patch | 6 +- ...elivery-of-effect-related-exceptions.patch | 6 +- ...ters-tests-to-avoid-false-positive-w.patch | 38 ++-- ocaml.spec | 14 +- 6 files changed, 213 insertions(+), 33 deletions(-) create mode 100644 0001-Fix-variance-composition-12623.patch rename 0001-Don-t-add-rpaths-to-libraries.patch => 0002-Don-t-add-rpaths-to-libraries.patch (79%) rename 0002-configure-Allow-user-defined-C-compiler-flags.patch => 0003-configure-Allow-user-defined-C-compiler-flags.patch (89%) rename 0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch => 0004-Fix-x86_64-delivery-of-effect-related-exceptions.patch (84%) rename 0004-Update-framepointers-tests-to-avoid-false-positive-w.patch => 0005-Update-framepointers-tests-to-avoid-false-positive-w.patch (97%) diff --git a/0001-Fix-variance-composition-12623.patch b/0001-Fix-variance-composition-12623.patch new file mode 100644 index 0000000..34db2ab --- /dev/null +++ b/0001-Fix-variance-composition-12623.patch @@ -0,0 +1,176 @@ +From 4c03e721b4c53240a9091790acb401b27e72dce0 Mon Sep 17 00:00:00 2001 +From: Florian Angeletti +Date: Wed, 4 Oct 2023 10:05:44 +0200 +Subject: [PATCH 1/5] Fix variance composition (#12623) + +Possible positive occurrence under possible negative occurrence were +forgotten, making the typechecker accepts the absurd statement + + type -'a n + type +'a p + type +'a ko = 'a p n + +(cherry picked from commit 1a9c45317b2c6c9ca9b4cb95fe4891f9f1a2820e) +--- + Changes | 8 +++ + boot/ocamlc | Bin 3051798 -> 3051796 bytes + boot/ocamllex | Bin 391863 -> 391861 bytes + testsuite/tests/typing-misc/variance.ml | 87 ++++++++++++++++++++++++ + typing/types.ml | 2 +- + 5 files changed, 96 insertions(+), 1 deletion(-) + +diff --git a/Changes b/Changes +index 20b7b8ee22..dccdc9baba 100644 +--- a/Changes ++++ b/Changes +@@ -1,3 +1,11 @@ ++OCaml 5.1.1 ++----------- ++ ++### Bug fixes: ++ ++- #12623, fix the computation of variance composition ++ (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer) ++ + OCaml 5.1.0 (14 September 2023) + ------------------------------- + +diff --git a/boot/ocamlc b/boot/ocamlc +index f3b2cba8df84a5f1326c7fe7bdf12b85159f65b3..4db4d848dbc3c2411a9e6160e9d932dd7ba35a34 100755 +GIT binary patch +delta 244 +zcmZ9=y)pw)7zW@yD_A75h=~7x4sq6QNTHKLLz5Y;l1i^m@y)Byq%e*dP4>M3jS*A| +zH=r=XOm0DACarO5#nU`Dd{Ng71+*IApk>g1RMp&zydf97QqRy1Wtle;50Y`&VqB`Jh%WZf=l2sxB{+% +zYvB4LHS4)A&pSWz{Q8@xo}b$HKl;!&)oPSPN%{2bA~uz{vSZ>slkC18)N0Mv{`SAV +Z)LrdtIGaw{*=p;q`M6Wx_O}_8{s6iiTe|=N + +delta 266 +zcmbQTXcyx&AZ}=3Y+-6)ZeeL*ZDDI+Z{cX+Y~gC*ZsBR+ZQ*O--y(2h;q(<<0zA`W +z77B1oUvN>3W%_}I0zB=17775dAP@@yu`m#e0I?_#ivh7X5K92DBoIphu{03N0I@6( +z%K@=G5Gw$&A`mM9u`&>=0I@0%s{yh4_CE_XmId(MW?;znW?%|9%D}jD=l1oVG`yJf +z%}n(S^$fIAQp*fYb&U*+jCBnxbq!1pxH>vaSm0oQF5a&8RRf4MfmjQOwSib?yV_UX +OtFsy3PyaJPPXYiZJ96a! + +diff --git a/boot/ocamllex b/boot/ocamllex +index cfdfbe8b4541516ef49c895ea691ea534706de67..b2b5404e69f35a1eb7d0a74fe687a4f4508a7149 100755 +GIT binary patch +delta 98 +zcmdn~RebAL@rD-07N!>F7M3lnT~@qO3=Hgl7#JKo7#Or4Zl7+&>cymMYN}_bXQ-W$ +qT4tbYWME{hYhbBsXmY^S(Q(282Yoc*?EF7M3lnT~@p@3=Hgl7#JKo85p!5ZJ%z%>cymQW~yhXXP}*u +rT4rdfYh++#tZQJYYhZf7)zM+X0tW+h@$G!JtbKbK4W`fi#VP>+{6`&d + +diff --git a/testsuite/tests/typing-misc/variance.ml b/testsuite/tests/typing-misc/variance.ml +index d0f754f716..419e348f48 100644 +--- a/testsuite/tests/typing-misc/variance.ml ++++ b/testsuite/tests/typing-misc/variance.ml +@@ -36,3 +36,90 @@ type !'a t = (module s with type t = 'a);; + module type s = sig type t end + type 'a t = (module s with type t = 'a) + |}] ++ ++(* Composition *) ++type -'a n ++type +'a p ++type !'a i ++ ++type +'a error_np = 'a n p;; ++[%%expect{| ++type -'a n ++type +'a p ++type !'a i ++Line 5, characters 0-26: ++5 | type +'a error_np = 'a n p;; ++ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ++Error: In this definition, expected parameter variances are not satisfied. ++ The 1st type parameter was expected to be covariant, ++ but it is contravariant. ++|}] ++ ++ ++type +'a error_pn = 'a p n;; ++[%%expect{| ++Line 1, characters 0-26: ++1 | type +'a error_pn = 'a p n;; ++ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ++Error: In this definition, expected parameter variances are not satisfied. ++ The 1st type parameter was expected to be covariant, ++ but it is contravariant. ++|}] ++ ++type -'a error_pp = 'a p p;; ++[%%expect{| ++Line 1, characters 0-26: ++1 | type -'a error_pp = 'a p p;; ++ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ++Error: In this definition, expected parameter variances are not satisfied. ++ The 1st type parameter was expected to be contravariant, ++ but it is covariant. ++|}] ++ ++type -'a error_nn = 'a n n;; ++[%%expect{| ++Line 1, characters 0-26: ++1 | type -'a error_nn = 'a n n;; ++ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ++Error: In this definition, expected parameter variances are not satisfied. ++ The 1st type parameter was expected to be contravariant, ++ but it is covariant. ++|}] ++ ++type !'a inj_in = 'a i n ++[%%expect{| ++Line 1, characters 0-24: ++1 | type !'a inj_in = 'a i n ++ ^^^^^^^^^^^^^^^^^^^^^^^^ ++Error: In this definition, expected parameter variances are not satisfied. ++ The 1st type parameter was expected to be injective invariant, ++ but it is invariant. ++|}] ++ ++type !'a inj_in = 'a n i ++[%%expect{| ++Line 1, characters 0-24: ++1 | type !'a inj_in = 'a n i ++ ^^^^^^^^^^^^^^^^^^^^^^^^ ++Error: In this definition, expected parameter variances are not satisfied. ++ The 1st type parameter was expected to be injective invariant, ++ but it is invariant. ++|}] ++ ++module Make_covariant(M: sig type 'a t end): sig ++ type 'a i = 'a ++ type +'a t = 'a i M.t ++end = struct ++ type 'a i = 'a ++ type +'a t = 'a i M.t ++end ++ ++module Positive_ref = Make_covariant(struct type 'a t = 'a ref end) ++[%%expect {| ++Line 6, characters 2-23: ++6 | type +'a t = 'a i M.t ++ ^^^^^^^^^^^^^^^^^^^^^ ++Error: In this definition, expected parameter variances are not satisfied. ++ The 1st type parameter was expected to be covariant, ++ but it is invariant. ++|}] +diff --git a/typing/types.ml b/typing/types.ml +index 45a4f896d6..c1dbdb6895 100644 +--- a/typing/types.ml ++++ b/typing/types.ml +@@ -186,7 +186,7 @@ module Variance = struct + let mp = + mem May_pos v1 && mem May_pos v2 || mem May_neg v1 && mem May_neg v2 + and mn = +- mem May_pos v1 && mem May_neg v2 || mem May_pos v1 && mem May_neg v2 ++ mem May_pos v1 && mem May_neg v2 || mem May_neg v1 && mem May_pos v2 + and mw = mem May_weak v1 && v2 <> null || v1 <> null && mem May_weak v2 + and inj = mem Inj v1 && mem Inj v2 + and pos = mem Pos v1 && mem Pos v2 || mem Neg v1 && mem Neg v2 +-- +2.41.0 + diff --git a/0001-Don-t-add-rpaths-to-libraries.patch b/0002-Don-t-add-rpaths-to-libraries.patch similarity index 79% rename from 0001-Don-t-add-rpaths-to-libraries.patch rename to 0002-Don-t-add-rpaths-to-libraries.patch index 344a528..d1362a5 100644 --- a/0001-Don-t-add-rpaths-to-libraries.patch +++ b/0002-Don-t-add-rpaths-to-libraries.patch @@ -1,14 +1,14 @@ -From 03435cc789bfb783c1d5566e8abd387eea1b9155 Mon Sep 17 00:00:00 2001 +From 56fafd588484ceb9b8e998b5e569d7df27deae3b 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 2/5] Don't add rpaths to libraries. --- configure.ac | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure.ac b/configure.ac -index 7c7d9a814c..d5040c279c 100644 +index aba3569f7c..6c50ba6c71 100644 --- a/configure.ac +++ b/configure.ac @@ -1106,8 +1106,6 @@ AS_IF([test x"$enable_shared" != "xno"], diff --git a/0002-configure-Allow-user-defined-C-compiler-flags.patch b/0003-configure-Allow-user-defined-C-compiler-flags.patch similarity index 89% rename from 0002-configure-Allow-user-defined-C-compiler-flags.patch rename to 0003-configure-Allow-user-defined-C-compiler-flags.patch index 0d70a04..8c64262 100644 --- a/0002-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0003-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,14 +1,14 @@ -From d9bcdb9d0a27e10350b1ca90df43b401656324f1 Mon Sep 17 00:00:00 2001 +From e8170e71efb93f10c27935acc95093eb3f53ab6c 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 3/5] configure: Allow user defined C compiler flags. --- configure.ac | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac -index d5040c279c..4cbba04557 100644 +index 6c50ba6c71..db6ea8a8d1 100644 --- a/configure.ac +++ b/configure.ac @@ -759,6 +759,10 @@ AS_CASE([$host], diff --git a/0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch b/0004-Fix-x86_64-delivery-of-effect-related-exceptions.patch similarity index 84% rename from 0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch rename to 0004-Fix-x86_64-delivery-of-effect-related-exceptions.patch index 6d40ec0..2a90a81 100644 --- a/0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch +++ b/0004-Fix-x86_64-delivery-of-effect-related-exceptions.patch @@ -1,14 +1,14 @@ -From 352789925e44f012fbddc5dfae63abd15a447577 Mon Sep 17 00:00:00 2001 +From 8d0e4af8141f6ba925c1de426a9600a96816c86b Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Mon, 4 Sep 2023 13:50:30 -0600 -Subject: [PATCH 3/4] Fix x86_64 delivery of effect-related exceptions +Subject: [PATCH 4/5] Fix x86_64 delivery of effect-related exceptions --- runtime/amd64.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/amd64.S b/runtime/amd64.S -index 7e6f95c680..24dfa7111b 100644 +index 8dc9f81ec6..72d96f502d 100644 --- a/runtime/amd64.S +++ b/runtime/amd64.S @@ -902,6 +902,7 @@ LBL(112): diff --git a/0004-Update-framepointers-tests-to-avoid-false-positive-w.patch b/0005-Update-framepointers-tests-to-avoid-false-positive-w.patch similarity index 97% rename from 0004-Update-framepointers-tests-to-avoid-false-positive-w.patch rename to 0005-Update-framepointers-tests-to-avoid-false-positive-w.patch index 2025d57..a160acb 100644 --- a/0004-Update-framepointers-tests-to-avoid-false-positive-w.patch +++ b/0005-Update-framepointers-tests-to-avoid-false-positive-w.patch @@ -1,7 +1,7 @@ -From 210f9b439b264fb6ab16802f468992086a4af58c Mon Sep 17 00:00:00 2001 +From e1ee698f482664237bfb693966987cd167c22b68 Mon Sep 17 00:00:00 2001 From: Fabrice Buoro Date: Fri, 10 Mar 2023 09:36:22 -0700 -Subject: [PATCH 4/4] Update framepointers tests to avoid false positive with +Subject: [PATCH 5/5] Update framepointers tests to avoid false positive with inlined C functions --- @@ -36,10 +36,10 @@ Subject: [PATCH 4/4] Update framepointers tests to avoid false positive with delete mode 100644 testsuite/tests/frame-pointers/stack_realloc2.run diff --git a/testsuite/tests/frame-pointers/c_call.ml b/testsuite/tests/frame-pointers/c_call.ml -index 7d48b4947d..f552b0df8f 100644 +index c2493b3a99..9b98e86520 100644 --- a/testsuite/tests/frame-pointers/c_call.ml +++ b/testsuite/tests/frame-pointers/c_call.ml -@@ -7,20 +7,20 @@ all_modules = "${readonly_files} c_call. +@@ -7,20 +7,20 @@ all_modules = "${readonly_files} c_call.ml" *) @@ -140,7 +140,7 @@ index 634c4dd937..a75100b213 100644 + argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]); } diff --git a/testsuite/tests/frame-pointers/effects.ml b/testsuite/tests/frame-pointers/effects.ml -index 2aa7012606..ac304683fe 100644 +index e14633a374..4d14190320 100644 --- a/testsuite/tests/frame-pointers/effects.ml +++ b/testsuite/tests/frame-pointers/effects.ml @@ -11,26 +11,26 @@ open Printf @@ -239,10 +239,10 @@ index e96b5ea13a..0000000000 -${program} 2>&1 \ - | ${test_source_directory}/filter-locations.sh ${program} >${output} diff --git a/testsuite/tests/frame-pointers/exception_handler.ml b/testsuite/tests/frame-pointers/exception_handler.ml -index 6bf5bf470d..19773f78de 100644 +index 575f7329bf..95a4f0d75c 100644 --- a/testsuite/tests/frame-pointers/exception_handler.ml +++ b/testsuite/tests/frame-pointers/exception_handler.ml -@@ -8,7 +8,7 @@ +@@ -8,7 +8,7 @@ all_modules = "${readonly_files} exception_handler.ml" *) (* https://github.com/ocaml/ocaml/pull/11031 *) @@ -374,13 +374,13 @@ index a521218a38..cef7ccd9f2 100644 + perror("backtrace_symbols"); + return NULL; + } -+ + +-static void signal_handler(int signum) + const char* symbol = strdup(symbols[0]); + free(symbols); + return symbol; +} - --static void signal_handler(int signum) ++ +static bool is_from_executable(const char* symbol, const char* execname) { - /* Should be safe to be called from a signal handler. @@ -504,17 +504,17 @@ index a521218a38..cef7ccd9f2 100644 - struct frame_info *fi; - struct frame_info* next; - void* retaddr; -+ const char* execname = String_val(argv0); -+ struct frame_info* next = NULL; -+ const char* symbol = NULL; - +- - fi = __builtin_frame_address(0); - retaddr = __builtin_extract_return_addr(__builtin_return_address(0)); - - for (; fi; fi = next) { - if (safe_read(fi, &next, &retaddr) != 0) - return; -- ++ const char* execname = String_val(argv0); ++ struct frame_info* next = NULL; ++ const char* symbol = NULL; + - print_location(retaddr); + for (struct frame_info* fi = __builtin_frame_address(0); fi; fi = next) { + next = fi->prev; @@ -563,10 +563,10 @@ index a521218a38..cef7ccd9f2 100644 + free((void*)symbol); } diff --git a/testsuite/tests/frame-pointers/reperform.ml b/testsuite/tests/frame-pointers/reperform.ml -index ec5393907c..7a3b09162b 100644 +index 1af8452e5f..da251c98a7 100644 --- a/testsuite/tests/frame-pointers/reperform.ml +++ b/testsuite/tests/frame-pointers/reperform.ml -@@ -11,7 +11,7 @@ +@@ -11,7 +11,7 @@ all_modules = "${readonly_files} reperform.ml" open Effect open Effect.Deep @@ -606,7 +606,7 @@ index e96b5ea13a..0000000000 -${program} 2>&1 \ - | ${test_source_directory}/filter-locations.sh ${program} >${output} diff --git a/testsuite/tests/frame-pointers/stack_realloc.ml b/testsuite/tests/frame-pointers/stack_realloc.ml -index fc4e9e9d3b..cacc43c216 100644 +index 79e70c2add..f24e4795d5 100644 --- a/testsuite/tests/frame-pointers/stack_realloc.ml +++ b/testsuite/tests/frame-pointers/stack_realloc.ml @@ -13,7 +13,7 @@ open Effect.Deep @@ -649,7 +649,7 @@ index e96b5ea13a..0000000000 -${program} 2>&1 \ - | ${test_source_directory}/filter-locations.sh ${program} >${output} diff --git a/testsuite/tests/frame-pointers/stack_realloc2.ml b/testsuite/tests/frame-pointers/stack_realloc2.ml -index a4aea249ea..b2a602fa4a 100644 +index a3d21bf2bf..218dd6a1c3 100644 --- a/testsuite/tests/frame-pointers/stack_realloc2.ml +++ b/testsuite/tests/frame-pointers/stack_realloc2.ml @@ -13,7 +13,7 @@ open Effect.Deep diff --git a/ocaml.spec b/ocaml.spec index 2669eac..8382b01 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -43,7 +43,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.1.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: OCaml compiler and programming environment @@ -71,14 +71,15 @@ Source2: ocaml_files.py # be incorporated into the git repo at a later time. # Patches added after 5.1.0 was released. +Patch: 0001-Fix-variance-composition-12623.patch # Fedora-specific patches -Patch: 0001-Don-t-add-rpaths-to-libraries.patch -Patch: 0002-configure-Allow-user-defined-C-compiler-flags.patch +Patch: 0002-Don-t-add-rpaths-to-libraries.patch +Patch: 0003-configure-Allow-user-defined-C-compiler-flags.patch # https://github.com/ocaml/ocaml/pull/12530 -Patch: 0003-Fix-x86_64-delivery-of-effect-related-exceptions.patch +Patch: 0004-Fix-x86_64-delivery-of-effect-related-exceptions.patch # https://github.com/ocaml/ocaml/pull/11594 -Patch: 0004-Update-framepointers-tests-to-avoid-false-positive-w.patch +Patch: 0005-Update-framepointers-tests-to-avoid-false-positive-w.patch BuildRequires: make BuildRequires: git @@ -467,6 +468,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Thu Oct 5 2023 Richard W.M. Jones - 5.1.0-2 +- Add upstream patch added after 5.1.0 + * Wed Oct 4 2023 Jerry James - 5.1.0-1 - Version 5.1.0 - Add LicenseRef-Fedora-Public-Domain to the runtime License field From a8e366538adc5550add1d3840372022e090f03c0 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 5 Oct 2023 10:53:11 +0100 Subject: [PATCH 03/31] Rebuild against updated ocaml-srpm-macros I managed to build it against the old ocaml-srpm-macros, thus native compilation was disabled still on s390x. Hopefully bump and rebuild after adding ocaml-srpm-macros to the side tag will fix this. --- ocaml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index 8382b01..e6d1c1a 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -43,7 +43,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.1.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: OCaml compiler and programming environment @@ -468,6 +468,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Thu Oct 05 2023 Richard W.M. Jones - 5.1.0-3 +- Rebuild against updated ocaml-srpm-macros + * Thu Oct 5 2023 Richard W.M. Jones - 5.1.0-2 - Add upstream patch added after 5.1.0 From 2ec55e949b92244d2b119f71e83c38a5ea878efc Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 6 Oct 2023 12:40:21 +0100 Subject: [PATCH 04/31] Use BR ocaml-srpm-macros to force latest to be built against --- ocaml.spec | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ocaml.spec b/ocaml.spec index e6d1c1a..6aa019b 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -43,7 +43,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.1.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: OCaml compiler and programming environment @@ -109,8 +109,10 @@ Requires: libzstd-devel%{?_isa} # of ocaml-runtime. Requires: ocaml-runtime%{?_isa} = %{version}-%{release} -# Force ocaml-srpm-macros to be at the latest version, since OCaml 5.1 -# has a different set of native code generators than previous versions. +# Force ocaml-srpm-macros to be at the latest version, both for builds +# and installs, since OCaml 5.1 has a different set of native code +# generators than previous versions. +BuildRequires: ocaml-srpm-macros >= 9 Requires: ocaml-srpm-macros >= 9 # Bundles an MD5 implementation in runtime/caml/md5.h and runtime/md5.c @@ -468,6 +470,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Fri Oct 06 2023 Richard W.M. Jones - 5.1.0-4 +- Use BR ocaml-srpm-macros to force latest to be built against + * Thu Oct 05 2023 Richard W.M. Jones - 5.1.0-3 - Rebuild against updated ocaml-srpm-macros From ebbf4c122f2f8804a6da5b29c56cfeacc425b49e Mon Sep 17 00:00:00 2001 From: Jerry James Date: Thu, 12 Oct 2023 12:34:40 -0600 Subject: [PATCH 05/31] Configure with --enable-ocamltest on test_arches --- ocaml.spec | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ocaml.spec b/ocaml.spec index 6aa019b..8fbbb76 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -268,6 +268,11 @@ sed -i '/^EXTRACAMLFLAGS=/aLINKOPTS=-cclib -lm' otherlibs/unix/Makefile %if 0%{?_include_frame_pointers} --enable-frame-pointers \ %endif +%endif +%ifarch %{test_arches} + --enable-ocamltest \ +%else + --disable-ocamltest \ %endif OC_CFLAGS='%{build_cflags}' \ OC_LDFLAGS='%{build_ldflags}' \ @@ -297,10 +302,6 @@ annocheck -v hello ||: %endif %ifarch %{test_arches} -make ocamltest -%ifarch %{ocaml_native_compiler} -make ocamltest.opt -%endif %ifarch %{test_arches_required} make -j1 tests %else From 48b6d0088d09695a373cbd10e7ad045de477bb56 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 13 Nov 2023 22:14:13 -0500 Subject: [PATCH 06/31] Drop unused BR parallel GNU parallel is only used by make parallel in the testsuite directory; the toplevel make tests calls make all in testsuite. --- ocaml.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ocaml.spec b/ocaml.spec index 8fbbb76..7984dc4 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -43,7 +43,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.1.0 -Release: 4%{?dist} +Release: 5%{?dist} Summary: OCaml compiler and programming environment @@ -87,7 +87,6 @@ BuildRequires: gcc BuildRequires: autoconf BuildRequires: gawk BuildRequires: hardlink -BuildRequires: parallel BuildRequires: perl-interpreter BuildRequires: util-linux BuildRequires: /usr/bin/annocheck @@ -471,6 +470,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Tue Nov 14 2023 Yaakov Selkowitz - 5.1.0-5 +- Drop unused BR parallel + * Fri Oct 06 2023 Richard W.M. Jones - 5.1.0-4 - Use BR ocaml-srpm-macros to force latest to be built against From b40114b0c94016adf6340b67be20f49fde56e211 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 11 Dec 2023 22:33:21 +0000 Subject: [PATCH 07/31] New upstream version 5.1.1 (RHBZ#2239227) --- ...> 0001-Don-t-add-rpaths-to-libraries.patch | 10 +- 0001-Fix-variance-composition-12623.patch | 176 ------------------ ...-Allow-user-defined-C-compiler-flags.patch | 14 +- ...ters-tests-to-avoid-false-positive-w.patch | 6 +- ...elivery-of-effect-related-exceptions.patch | 34 ---- ocaml.spec | 21 +-- sources | 2 +- 7 files changed, 26 insertions(+), 237 deletions(-) rename 0002-Don-t-add-rpaths-to-libraries.patch => 0001-Don-t-add-rpaths-to-libraries.patch (72%) delete mode 100644 0001-Fix-variance-composition-12623.patch rename 0003-configure-Allow-user-defined-C-compiler-flags.patch => 0002-configure-Allow-user-defined-C-compiler-flags.patch (80%) rename 0005-Update-framepointers-tests-to-avoid-false-positive-w.patch => 0003-Update-framepointers-tests-to-avoid-false-positive-w.patch (99%) delete mode 100644 0004-Fix-x86_64-delivery-of-effect-related-exceptions.patch diff --git a/0002-Don-t-add-rpaths-to-libraries.patch b/0001-Don-t-add-rpaths-to-libraries.patch similarity index 72% rename from 0002-Don-t-add-rpaths-to-libraries.patch rename to 0001-Don-t-add-rpaths-to-libraries.patch index d1362a5..92f75dd 100644 --- a/0002-Don-t-add-rpaths-to-libraries.patch +++ b/0001-Don-t-add-rpaths-to-libraries.patch @@ -1,17 +1,17 @@ -From 56fafd588484ceb9b8e998b5e569d7df27deae3b Mon Sep 17 00:00:00 2001 +From 799bf9088c131fc71626a48e9987e4d44a2f0194 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 2/5] Don't add rpaths to libraries. +Subject: [PATCH 1/3] Don't add rpaths to libraries. --- configure.ac | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure.ac b/configure.ac -index aba3569f7c..6c50ba6c71 100644 +index b81da53c42..892a2a894f 100644 --- a/configure.ac +++ b/configure.ac -@@ -1106,8 +1106,6 @@ AS_IF([test x"$enable_shared" != "xno"], +@@ -1107,8 +1107,6 @@ AS_IF([test x"$enable_shared" != "xno"], [[*-*-openbsd7.[3-9]|*-*-openbsd[89].*]], [mkdll_flags="${mkdll_flags} -Wl,--no-execute-only"]) oc_ldflags="$oc_ldflags -Wl,-E" @@ -21,5 +21,5 @@ index aba3569f7c..6c50ba6c71 100644 supports_shared_libraries=true], [mkdll='shared-libs-not-available']) -- -2.41.0 +2.43.0 diff --git a/0001-Fix-variance-composition-12623.patch b/0001-Fix-variance-composition-12623.patch deleted file mode 100644 index 34db2ab..0000000 --- a/0001-Fix-variance-composition-12623.patch +++ /dev/null @@ -1,176 +0,0 @@ -From 4c03e721b4c53240a9091790acb401b27e72dce0 Mon Sep 17 00:00:00 2001 -From: Florian Angeletti -Date: Wed, 4 Oct 2023 10:05:44 +0200 -Subject: [PATCH 1/5] Fix variance composition (#12623) - -Possible positive occurrence under possible negative occurrence were -forgotten, making the typechecker accepts the absurd statement - - type -'a n - type +'a p - type +'a ko = 'a p n - -(cherry picked from commit 1a9c45317b2c6c9ca9b4cb95fe4891f9f1a2820e) ---- - Changes | 8 +++ - boot/ocamlc | Bin 3051798 -> 3051796 bytes - boot/ocamllex | Bin 391863 -> 391861 bytes - testsuite/tests/typing-misc/variance.ml | 87 ++++++++++++++++++++++++ - typing/types.ml | 2 +- - 5 files changed, 96 insertions(+), 1 deletion(-) - -diff --git a/Changes b/Changes -index 20b7b8ee22..dccdc9baba 100644 ---- a/Changes -+++ b/Changes -@@ -1,3 +1,11 @@ -+OCaml 5.1.1 -+----------- -+ -+### Bug fixes: -+ -+- #12623, fix the computation of variance composition -+ (Florian Angeletti, report by Vesa Karvonen, review by Gabriel Scherer) -+ - OCaml 5.1.0 (14 September 2023) - ------------------------------- - -diff --git a/boot/ocamlc b/boot/ocamlc -index f3b2cba8df84a5f1326c7fe7bdf12b85159f65b3..4db4d848dbc3c2411a9e6160e9d932dd7ba35a34 100755 -GIT binary patch -delta 244 -zcmZ9=y)pw)7zW@yD_A75h=~7x4sq6QNTHKLLz5Y;l1i^m@y)Byq%e*dP4>M3jS*A| -zH=r=XOm0DACarO5#nU`Dd{Ng71+*IApk>g1RMp&zydf97QqRy1Wtle;50Y`&VqB`Jh%WZf=l2sxB{+% -zYvB4LHS4)A&pSWz{Q8@xo}b$HKl;!&)oPSPN%{2bA~uz{vSZ>slkC18)N0Mv{`SAV -Z)LrdtIGaw{*=p;q`M6Wx_O}_8{s6iiTe|=N - -delta 266 -zcmbQTXcyx&AZ}=3Y+-6)ZeeL*ZDDI+Z{cX+Y~gC*ZsBR+ZQ*O--y(2h;q(<<0zA`W -z77B1oUvN>3W%_}I0zB=17775dAP@@yu`m#e0I?_#ivh7X5K92DBoIphu{03N0I@6( -z%K@=G5Gw$&A`mM9u`&>=0I@0%s{yh4_CE_XmId(MW?;znW?%|9%D}jD=l1oVG`yJf -z%}n(S^$fIAQp*fYb&U*+jCBnxbq!1pxH>vaSm0oQF5a&8RRf4MfmjQOwSib?yV_UX -OtFsy3PyaJPPXYiZJ96a! - -diff --git a/boot/ocamllex b/boot/ocamllex -index cfdfbe8b4541516ef49c895ea691ea534706de67..b2b5404e69f35a1eb7d0a74fe687a4f4508a7149 100755 -GIT binary patch -delta 98 -zcmdn~RebAL@rD-07N!>F7M3lnT~@qO3=Hgl7#JKo7#Or4Zl7+&>cymMYN}_bXQ-W$ -qT4tbYWME{hYhbBsXmY^S(Q(282Yoc*?EF7M3lnT~@p@3=Hgl7#JKo85p!5ZJ%z%>cymQW~yhXXP}*u -rT4rdfYh++#tZQJYYhZf7)zM+X0tW+h@$G!JtbKbK4W`fi#VP>+{6`&d - -diff --git a/testsuite/tests/typing-misc/variance.ml b/testsuite/tests/typing-misc/variance.ml -index d0f754f716..419e348f48 100644 ---- a/testsuite/tests/typing-misc/variance.ml -+++ b/testsuite/tests/typing-misc/variance.ml -@@ -36,3 +36,90 @@ type !'a t = (module s with type t = 'a);; - module type s = sig type t end - type 'a t = (module s with type t = 'a) - |}] -+ -+(* Composition *) -+type -'a n -+type +'a p -+type !'a i -+ -+type +'a error_np = 'a n p;; -+[%%expect{| -+type -'a n -+type +'a p -+type !'a i -+Line 5, characters 0-26: -+5 | type +'a error_np = 'a n p;; -+ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -+Error: In this definition, expected parameter variances are not satisfied. -+ The 1st type parameter was expected to be covariant, -+ but it is contravariant. -+|}] -+ -+ -+type +'a error_pn = 'a p n;; -+[%%expect{| -+Line 1, characters 0-26: -+1 | type +'a error_pn = 'a p n;; -+ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -+Error: In this definition, expected parameter variances are not satisfied. -+ The 1st type parameter was expected to be covariant, -+ but it is contravariant. -+|}] -+ -+type -'a error_pp = 'a p p;; -+[%%expect{| -+Line 1, characters 0-26: -+1 | type -'a error_pp = 'a p p;; -+ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -+Error: In this definition, expected parameter variances are not satisfied. -+ The 1st type parameter was expected to be contravariant, -+ but it is covariant. -+|}] -+ -+type -'a error_nn = 'a n n;; -+[%%expect{| -+Line 1, characters 0-26: -+1 | type -'a error_nn = 'a n n;; -+ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -+Error: In this definition, expected parameter variances are not satisfied. -+ The 1st type parameter was expected to be contravariant, -+ but it is covariant. -+|}] -+ -+type !'a inj_in = 'a i n -+[%%expect{| -+Line 1, characters 0-24: -+1 | type !'a inj_in = 'a i n -+ ^^^^^^^^^^^^^^^^^^^^^^^^ -+Error: In this definition, expected parameter variances are not satisfied. -+ The 1st type parameter was expected to be injective invariant, -+ but it is invariant. -+|}] -+ -+type !'a inj_in = 'a n i -+[%%expect{| -+Line 1, characters 0-24: -+1 | type !'a inj_in = 'a n i -+ ^^^^^^^^^^^^^^^^^^^^^^^^ -+Error: In this definition, expected parameter variances are not satisfied. -+ The 1st type parameter was expected to be injective invariant, -+ but it is invariant. -+|}] -+ -+module Make_covariant(M: sig type 'a t end): sig -+ type 'a i = 'a -+ type +'a t = 'a i M.t -+end = struct -+ type 'a i = 'a -+ type +'a t = 'a i M.t -+end -+ -+module Positive_ref = Make_covariant(struct type 'a t = 'a ref end) -+[%%expect {| -+Line 6, characters 2-23: -+6 | type +'a t = 'a i M.t -+ ^^^^^^^^^^^^^^^^^^^^^ -+Error: In this definition, expected parameter variances are not satisfied. -+ The 1st type parameter was expected to be covariant, -+ but it is invariant. -+|}] -diff --git a/typing/types.ml b/typing/types.ml -index 45a4f896d6..c1dbdb6895 100644 ---- a/typing/types.ml -+++ b/typing/types.ml -@@ -186,7 +186,7 @@ module Variance = struct - let mp = - mem May_pos v1 && mem May_pos v2 || mem May_neg v1 && mem May_neg v2 - and mn = -- mem May_pos v1 && mem May_neg v2 || mem May_pos v1 && mem May_neg v2 -+ mem May_pos v1 && mem May_neg v2 || mem May_neg v1 && mem May_pos v2 - and mw = mem May_weak v1 && v2 <> null || v1 <> null && mem May_weak v2 - and inj = mem Inj v1 && mem Inj v2 - and pos = mem Pos v1 && mem Pos v2 || mem Neg v1 && mem Neg v2 --- -2.41.0 - diff --git a/0003-configure-Allow-user-defined-C-compiler-flags.patch b/0002-configure-Allow-user-defined-C-compiler-flags.patch similarity index 80% rename from 0003-configure-Allow-user-defined-C-compiler-flags.patch rename to 0002-configure-Allow-user-defined-C-compiler-flags.patch index 8c64262..d2d6a4b 100644 --- a/0003-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0002-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,17 +1,17 @@ -From e8170e71efb93f10c27935acc95093eb3f53ab6c Mon Sep 17 00:00:00 2001 +From f2b875e8201efed22267136096b1e5df97f99f84 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 3/5] configure: Allow user defined C compiler flags. +Subject: [PATCH 2/3] configure: Allow user defined C compiler flags. --- configure.ac | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac -index 6c50ba6c71..db6ea8a8d1 100644 +index 892a2a894f..e8f6cbc863 100644 --- a/configure.ac +++ b/configure.ac -@@ -759,6 +759,10 @@ AS_CASE([$host], +@@ -760,6 +760,10 @@ AS_CASE([$host], internal_cflags="$cc_warnings"], [common_cflags="-O"])]) @@ -22,7 +22,7 @@ index 6c50ba6c71..db6ea8a8d1 100644 # Enable SSE2 on x86 mingw to avoid using 80-bit registers. AS_CASE([$host], [i686-*-mingw32*], -@@ -2325,7 +2329,7 @@ AC_CONFIG_COMMANDS_PRE([ +@@ -2327,7 +2331,7 @@ AC_CONFIG_COMMANDS_PRE([ [mkexedebugflag="${mkexe_ldflags_prefix}${mkexedebugflag}"]) mkdll_ldflags="" AS_IF([test -n "${LDFLAGS}"], @@ -31,7 +31,7 @@ index 6c50ba6c71..db6ea8a8d1 100644 mkdll_ldflags="${mkdll_ldflags} ${mkexe_ldflags_prefix}${flag}" done mkdll_ldflags_exp="$mkdll_ldflags"]) -@@ -2351,7 +2355,7 @@ ${mkdll_ldflags}" +@@ -2353,7 +2357,7 @@ ${mkdll_ldflags}" ],[ mkdll_ldflags='$(OC_DLL_LDFLAGS) $(LDFLAGS)' mkdll_ldflags_exp="${oc_dll_ldflags}" @@ -41,5 +41,5 @@ index 6c50ba6c71..db6ea8a8d1 100644 mkexe_ldflags="\$(OC_LDFLAGS) \$(LDFLAGS)" mkexe_ldflags_exp="${oc_ldflags} ${LDFLAGS}" -- -2.41.0 +2.43.0 diff --git a/0005-Update-framepointers-tests-to-avoid-false-positive-w.patch b/0003-Update-framepointers-tests-to-avoid-false-positive-w.patch similarity index 99% rename from 0005-Update-framepointers-tests-to-avoid-false-positive-w.patch rename to 0003-Update-framepointers-tests-to-avoid-false-positive-w.patch index a160acb..80e51e0 100644 --- a/0005-Update-framepointers-tests-to-avoid-false-positive-w.patch +++ b/0003-Update-framepointers-tests-to-avoid-false-positive-w.patch @@ -1,7 +1,7 @@ -From e1ee698f482664237bfb693966987cd167c22b68 Mon Sep 17 00:00:00 2001 +From ba44a9c29771aacf44222a2ff63e7bd6034dd92c Mon Sep 17 00:00:00 2001 From: Fabrice Buoro Date: Fri, 10 Mar 2023 09:36:22 -0700 -Subject: [PATCH 5/5] Update framepointers tests to avoid false positive with +Subject: [PATCH 3/3] Update framepointers tests to avoid false positive with inlined C functions --- @@ -692,5 +692,5 @@ index e96b5ea13a..0000000000 -${program} 2>&1 \ - | ${test_source_directory}/filter-locations.sh ${program} >${output} -- -2.41.0 +2.43.0 diff --git a/0004-Fix-x86_64-delivery-of-effect-related-exceptions.patch b/0004-Fix-x86_64-delivery-of-effect-related-exceptions.patch deleted file mode 100644 index 2a90a81..0000000 --- a/0004-Fix-x86_64-delivery-of-effect-related-exceptions.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 8d0e4af8141f6ba925c1de426a9600a96816c86b Mon Sep 17 00:00:00 2001 -From: Miod Vallat -Date: Mon, 4 Sep 2023 13:50:30 -0600 -Subject: [PATCH 4/5] Fix x86_64 delivery of effect-related exceptions - ---- - runtime/amd64.S | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/runtime/amd64.S b/runtime/amd64.S -index 8dc9f81ec6..72d96f502d 100644 ---- a/runtime/amd64.S -+++ b/runtime/amd64.S -@@ -902,6 +902,7 @@ LBL(112): - movq Caml_state(current_stack), %rsi - SWITCH_OCAML_STACKS - /* No parent stack. Raise Effect.Unhandled. */ -+ ENTER_FUNCTION - movq %rax, C_ARG_1 - LEA_VAR(caml_raise_unhandled_effect, %rax) - jmp LBL(caml_c_call) -@@ -946,7 +947,8 @@ CFI_STARTPROC - UPDATE_BASE_POINTER(%rcx) - SWITCH_OCAML_STACKS - jmp *(%rbx) --2: LEA_VAR(caml_raise_continuation_already_resumed, %rax) -+2: ENTER_FUNCTION -+ LEA_VAR(caml_raise_continuation_already_resumed, %rax) - jmp LBL(caml_c_call) - CFI_ENDPROC - ENDFUNCTION(G(caml_resume)) --- -2.41.0 - diff --git a/ocaml.spec b/ocaml.spec index 7984dc4..92dcff1 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -42,8 +42,8 @@ ExcludeArch: %{ix86} %global rcver %{nil} Name: ocaml -Version: 5.1.0 -Release: 5%{?dist} +Version: 5.1.1 +Release: 1%{?dist} Summary: OCaml compiler and programming environment @@ -64,22 +64,18 @@ Source2: ocaml_files.py # # https://pagure.io/fedora-ocaml # -# Current branch: fedora-40-5.1.0 +# Current branch: fedora-40-5.1.1 # # 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. -# Patches added after 5.1.0 was released. -Patch: 0001-Fix-variance-composition-12623.patch - # Fedora-specific patches -Patch: 0002-Don-t-add-rpaths-to-libraries.patch -Patch: 0003-configure-Allow-user-defined-C-compiler-flags.patch -# https://github.com/ocaml/ocaml/pull/12530 -Patch: 0004-Fix-x86_64-delivery-of-effect-related-exceptions.patch +Patch: 0001-Don-t-add-rpaths-to-libraries.patch +Patch: 0002-configure-Allow-user-defined-C-compiler-flags.patch + # https://github.com/ocaml/ocaml/pull/11594 -Patch: 0005-Update-framepointers-tests-to-avoid-false-positive-w.patch +Patch: 0003-Update-framepointers-tests-to-avoid-false-positive-w.patch BuildRequires: make BuildRequires: git @@ -470,6 +466,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Mon Dec 11 2023 Richard W.M. Jones - 5.1.1-1 +- New upstream version 5.1.1 (RHBZ#2239227) + * Tue Nov 14 2023 Yaakov Selkowitz - 5.1.0-5 - Drop unused BR parallel diff --git a/sources b/sources index 1da2f82..f4deb78 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ocaml-5.1.0.tar.gz) = 814ea71de656eadc59a658ad3b6c4d786815c348ab883b1cdb22d5d0f99d11768f5646f03725f6b44c3b8f4ffeb71e89dadaea157711a7afbe86f23846fc5b52 +SHA512 (ocaml-5.1.1.tar.gz) = e4aa78afc9a59f604881f14093f4298ebcb005daeb8132a076fe6d24fdf8b59132cbfa2cfe677f1db1891351d3d637c621f24077e531cac6753c264fc7f5fbea From 4f34985ad8b10ed92e98b7115d7fedff1948bee9 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 18 Dec 2023 11:07:28 +0000 Subject: [PATCH 08/31] Add s390x code generation fix https://github.com/ocaml/ocaml/issues/12829 --- 0001-Don-t-add-rpaths-to-libraries.patch | 2 +- ...-Allow-user-defined-C-compiler-flags.patch | 2 +- ...ters-tests-to-avoid-false-positive-w.patch | 2 +- ...-stack-reallocation-code-in-PIC-mode.patch | 26 +++++++++++++++++++ ocaml.spec | 10 ++++++- 5 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 0004-Fix-s390x-stack-reallocation-code-in-PIC-mode.patch diff --git a/0001-Don-t-add-rpaths-to-libraries.patch b/0001-Don-t-add-rpaths-to-libraries.patch index 92f75dd..b0cb61b 100644 --- a/0001-Don-t-add-rpaths-to-libraries.patch +++ b/0001-Don-t-add-rpaths-to-libraries.patch @@ -1,7 +1,7 @@ From 799bf9088c131fc71626a48e9987e4d44a2f0194 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 1/3] Don't add rpaths to libraries. +Subject: [PATCH 1/4] Don't add rpaths to libraries. --- configure.ac | 2 -- diff --git a/0002-configure-Allow-user-defined-C-compiler-flags.patch b/0002-configure-Allow-user-defined-C-compiler-flags.patch index d2d6a4b..d3d927d 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 f2b875e8201efed22267136096b1e5df97f99f84 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 2/3] configure: Allow user defined C compiler flags. +Subject: [PATCH 2/4] configure: Allow user defined C compiler flags. --- configure.ac | 8 ++++++-- diff --git a/0003-Update-framepointers-tests-to-avoid-false-positive-w.patch b/0003-Update-framepointers-tests-to-avoid-false-positive-w.patch index 80e51e0..4ee59a8 100644 --- a/0003-Update-framepointers-tests-to-avoid-false-positive-w.patch +++ b/0003-Update-framepointers-tests-to-avoid-false-positive-w.patch @@ -1,7 +1,7 @@ From ba44a9c29771aacf44222a2ff63e7bd6034dd92c Mon Sep 17 00:00:00 2001 From: Fabrice Buoro Date: Fri, 10 Mar 2023 09:36:22 -0700 -Subject: [PATCH 3/3] Update framepointers tests to avoid false positive with +Subject: [PATCH 3/4] Update framepointers tests to avoid false positive with inlined C functions --- diff --git a/0004-Fix-s390x-stack-reallocation-code-in-PIC-mode.patch b/0004-Fix-s390x-stack-reallocation-code-in-PIC-mode.patch new file mode 100644 index 0000000..16c63f9 --- /dev/null +++ b/0004-Fix-s390x-stack-reallocation-code-in-PIC-mode.patch @@ -0,0 +1,26 @@ +From 81d3fb3e20afede32298e4d3e78bcebf6a22858a Mon Sep 17 00:00:00 2001 +From: Vincent Laviron +Date: Fri, 15 Dec 2023 10:00:52 +0100 +Subject: [PATCH 4/4] Fix s390x stack reallocation code in PIC mode + +(cherry picked from commit c40a955c029a203d0d7f05718e297e66987ec87f) +--- + asmcomp/s390x/emit.mlp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/asmcomp/s390x/emit.mlp b/asmcomp/s390x/emit.mlp +index 35ade079f6..0212cf3b00 100644 +--- a/asmcomp/s390x/emit.mlp ++++ b/asmcomp/s390x/emit.mlp +@@ -751,7 +751,7 @@ let fundecl fundecl = + ` lay %r15, -8(%r15)\n`; + ` stg %r14, 0(%r15)\n`; + ` lgfi %r12, {emit_int s}\n`; +- ` brasl %r14, {emit_symbol "caml_call_realloc_stack"}\n`; ++ emit_call "caml_call_realloc_stack"; + ` lg %r14, 0(%r15)\n`; + ` la %r15, 8(%r15)\n`; + ` brcl 15, {emit_label ret}\n` +-- +2.43.0 + diff --git a/ocaml.spec b/ocaml.spec index 92dcff1..4de70ea 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -43,7 +43,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.1.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: OCaml compiler and programming environment @@ -77,6 +77,10 @@ Patch: 0002-configure-Allow-user-defined-C-compiler-flags.patch # https://github.com/ocaml/ocaml/pull/11594 Patch: 0003-Update-framepointers-tests-to-avoid-false-positive-w.patch +# https://github.com/ocaml/ocaml/issues/12829 +# https://github.com/ocaml/ocaml/pull/12831 +Patch: 0004-Fix-s390x-stack-reallocation-code-in-PIC-mode.patch + BuildRequires: make BuildRequires: git BuildRequires: gcc @@ -466,6 +470,10 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Mon Dec 18 2023 Richard W.M. Jones - 5.1.1-2 +- Add s390x code generation fix + https://github.com/ocaml/ocaml/issues/12829 + * Mon Dec 11 2023 Richard W.M. Jones - 5.1.1-1 - New upstream version 5.1.1 (RHBZ#2239227) From 2883f28bbd9754bd0762c0c9e52cefd7d3883ffa Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 21 Jan 2024 10:09:11 +0000 Subject: [PATCH 09/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- ocaml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index 4de70ea..b410c4c 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -43,7 +43,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: OCaml compiler and programming environment @@ -470,6 +470,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Sun Jan 21 2024 Fedora Release Engineering - 5.1.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Mon Dec 18 2023 Richard W.M. Jones - 5.1.1-2 - Add s390x code generation fix https://github.com/ocaml/ocaml/issues/12829 From a3771460e1e6d494c130fcddd9f0d92b9b3225e4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jan 2024 09:45:15 +0000 Subject: [PATCH 10/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- ocaml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index b410c4c..d8d069b 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -43,7 +43,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.1.1 -Release: 3%{?dist} +Release: 4%{?dist} Summary: OCaml compiler and programming environment @@ -470,6 +470,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Thu Jan 25 2024 Fedora Release Engineering - 5.1.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sun Jan 21 2024 Fedora Release Engineering - 5.1.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From f299c84c6ddf24babb331a6128d5993c2e99c1b5 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Thu, 23 May 2024 09:00:25 -0600 Subject: [PATCH 11/31] Version 5.2.0 - Drop upstreamed frame pointer and s390x patches --- 0001-Don-t-add-rpaths-to-libraries.patch | 6 +- ...-Allow-user-defined-C-compiler-flags.patch | 12 +- ...ters-tests-to-avoid-false-positive-w.patch | 696 ------------------ ...-stack-reallocation-code-in-PIC-mode.patch | 26 - ocaml.spec | 27 +- sources | 2 +- 6 files changed, 21 insertions(+), 748 deletions(-) delete mode 100644 0003-Update-framepointers-tests-to-avoid-false-positive-w.patch delete mode 100644 0004-Fix-s390x-stack-reallocation-code-in-PIC-mode.patch diff --git a/0001-Don-t-add-rpaths-to-libraries.patch b/0001-Don-t-add-rpaths-to-libraries.patch index b0cb61b..04773ec 100644 --- a/0001-Don-t-add-rpaths-to-libraries.patch +++ b/0001-Don-t-add-rpaths-to-libraries.patch @@ -1,7 +1,7 @@ From 799bf9088c131fc71626a48e9987e4d44a2f0194 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/2] Don't add rpaths to libraries. --- configure.ac | 2 -- @@ -11,8 +11,8 @@ diff --git a/configure.ac b/configure.ac index b81da53c42..892a2a894f 100644 --- a/configure.ac +++ b/configure.ac -@@ -1107,8 +1107,6 @@ AS_IF([test x"$enable_shared" != "xno"], - [[*-*-openbsd7.[3-9]|*-*-openbsd[89].*]], +@@ -1221,8 +1221,6 @@ AS_IF([test x"$enable_shared" != "xno"], + [[*-*-openbsd7.[3-9]|*-*-openbsd[89].*]], [mkdll_flags="${mkdll_flags} -Wl,--no-execute-only"]) oc_ldflags="$oc_ldflags -Wl,-E" - rpath="-Wl,-rpath," diff --git a/0002-configure-Allow-user-defined-C-compiler-flags.patch b/0002-configure-Allow-user-defined-C-compiler-flags.patch index d3d927d..569b4a1 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 f2b875e8201efed22267136096b1e5df97f99f84 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/2] configure: Allow user defined C compiler flags. --- configure.ac | 8 ++++++-- @@ -11,9 +11,9 @@ diff --git a/configure.ac b/configure.ac index 892a2a894f..e8f6cbc863 100644 --- a/configure.ac +++ b/configure.ac -@@ -760,6 +760,10 @@ AS_CASE([$host], - internal_cflags="$cc_warnings"], - [common_cflags="-O"])]) +@@ -869,6 +869,10 @@ AS_CASE([$ocaml_cc_vendor], + internal_cflags="$cc_warnings"], + [common_cflags="-O"]) +# Allow CFLAGS and LDFLAGS to be added. +common_cflags="$common_cflags $CFLAGS" @@ -22,7 +22,7 @@ index 892a2a894f..e8f6cbc863 100644 # Enable SSE2 on x86 mingw to avoid using 80-bit registers. AS_CASE([$host], [i686-*-mingw32*], -@@ -2327,7 +2331,7 @@ AC_CONFIG_COMMANDS_PRE([ +@@ -2648,7 +2652,7 @@ AC_CONFIG_COMMANDS_PRE([ [mkexedebugflag="${mkexe_ldflags_prefix}${mkexedebugflag}"]) mkdll_ldflags="" AS_IF([test -n "${LDFLAGS}"], @@ -31,7 +31,7 @@ index 892a2a894f..e8f6cbc863 100644 mkdll_ldflags="${mkdll_ldflags} ${mkexe_ldflags_prefix}${flag}" done mkdll_ldflags_exp="$mkdll_ldflags"]) -@@ -2353,7 +2357,7 @@ ${mkdll_ldflags}" +@@ -2674,7 +2678,7 @@ ${mkdll_ldflags}" ],[ mkdll_ldflags='$(OC_DLL_LDFLAGS) $(LDFLAGS)' mkdll_ldflags_exp="${oc_dll_ldflags}" diff --git a/0003-Update-framepointers-tests-to-avoid-false-positive-w.patch b/0003-Update-framepointers-tests-to-avoid-false-positive-w.patch deleted file mode 100644 index 4ee59a8..0000000 --- a/0003-Update-framepointers-tests-to-avoid-false-positive-w.patch +++ /dev/null @@ -1,696 +0,0 @@ -From ba44a9c29771aacf44222a2ff63e7bd6034dd92c Mon Sep 17 00:00:00 2001 -From: Fabrice Buoro -Date: Fri, 10 Mar 2023 09:36:22 -0700 -Subject: [PATCH 3/4] Update framepointers tests to avoid false positive with - inlined C functions - ---- - testsuite/tests/frame-pointers/c_call.ml | 14 +- - .../tests/frame-pointers/c_call.reference | 9 - - testsuite/tests/frame-pointers/c_call.run | 4 - - testsuite/tests/frame-pointers/c_call_.c | 14 +- - testsuite/tests/frame-pointers/effects.ml | 12 +- - .../tests/frame-pointers/effects.reference | 15 -- - testsuite/tests/frame-pointers/effects.run | 4 - - .../tests/frame-pointers/exception_handler.ml | 4 +- - .../exception_handler.reference | 12 -- - .../frame-pointers/exception_handler.run | 4 - - .../tests/frame-pointers/filter-locations.sh | 23 --- - testsuite/tests/frame-pointers/fp_backtrace.c | 186 +++++++++++------- - testsuite/tests/frame-pointers/reperform.ml | 4 +- - .../tests/frame-pointers/reperform.reference | 3 - - testsuite/tests/frame-pointers/reperform.run | 4 - - .../tests/frame-pointers/stack_realloc.ml | 4 +- - .../frame-pointers/stack_realloc.reference | 3 - - .../tests/frame-pointers/stack_realloc.run | 4 - - .../tests/frame-pointers/stack_realloc2.ml | 4 +- - .../frame-pointers/stack_realloc2.reference | 3 - - .../tests/frame-pointers/stack_realloc2.run | 4 - - 21 files changed, 144 insertions(+), 190 deletions(-) - delete mode 100644 testsuite/tests/frame-pointers/c_call.run - delete mode 100644 testsuite/tests/frame-pointers/effects.run - delete mode 100644 testsuite/tests/frame-pointers/exception_handler.run - delete mode 100755 testsuite/tests/frame-pointers/filter-locations.sh - delete mode 100644 testsuite/tests/frame-pointers/reperform.run - delete mode 100644 testsuite/tests/frame-pointers/stack_realloc.run - delete mode 100644 testsuite/tests/frame-pointers/stack_realloc2.run - -diff --git a/testsuite/tests/frame-pointers/c_call.ml b/testsuite/tests/frame-pointers/c_call.ml -index c2493b3a99..9b98e86520 100644 ---- a/testsuite/tests/frame-pointers/c_call.ml -+++ b/testsuite/tests/frame-pointers/c_call.ml -@@ -7,20 +7,20 @@ all_modules = "${readonly_files} c_call.ml" - - *) - --external fp_backtrace : unit -> unit = "fp_backtrace" --external fp_backtrace_no_alloc : unit -> unit = "fp_backtrace" [@@noalloc] --external fp_backtrace_many_args : int -> int -> int -> int -> int -> int -> int -- -> int -> int -> int -> int -> unit = -+external fp_backtrace : string -> unit = "fp_backtrace" -+external fp_backtrace_no_alloc : string -> unit = "fp_backtrace" [@@noalloc] -+external fp_backtrace_many_args : string -> int -> int -> int -> int -> int -+ -> int -> int -> int -> int -> int -> int -> unit = - "fp_backtrace_many_args_argv" "fp_backtrace_many_args" - - let[@inline never] f () = - (* Check backtrace through caml_c_call_stack_args *) -- fp_backtrace_many_args 1 2 3 4 5 6 7 8 9 10 11; -+ fp_backtrace_many_args Sys.argv.(0) 1 2 3 4 5 6 7 8 9 10 11; - (* Check backtrace through caml_c_call. - * Also check that caml_c_call_stack_args correctly restores rbp register *) -- fp_backtrace (); -+ fp_backtrace Sys.argv.(0); - (* Check caml_c_call correctly restores rbp register *) -- fp_backtrace_no_alloc (); -+ fp_backtrace_no_alloc Sys.argv.(0); - 42 - - let () = ignore (f ()) -diff --git a/testsuite/tests/frame-pointers/c_call.reference b/testsuite/tests/frame-pointers/c_call.reference -index 92fb40a238..23095e7431 100644 ---- a/testsuite/tests/frame-pointers/c_call.reference -+++ b/testsuite/tests/frame-pointers/c_call.reference -@@ -3,19 +3,10 @@ caml_c_call_stack_args - camlC_call.f - camlC_call.entry - caml_program --caml_start_program --caml_main/caml_startup --main - caml_c_call - camlC_call.f - camlC_call.entry - caml_program --caml_start_program --caml_main/caml_startup --main - camlC_call.f - camlC_call.entry - caml_program --caml_start_program --caml_main/caml_startup --main -diff --git a/testsuite/tests/frame-pointers/c_call.run b/testsuite/tests/frame-pointers/c_call.run -deleted file mode 100644 -index e96b5ea13a..0000000000 ---- a/testsuite/tests/frame-pointers/c_call.run -+++ /dev/null -@@ -1,4 +0,0 @@ --#!/bin/sh -- --${program} 2>&1 \ -- | ${test_source_directory}/filter-locations.sh ${program} >${output} -diff --git a/testsuite/tests/frame-pointers/c_call_.c b/testsuite/tests/frame-pointers/c_call_.c -index 634c4dd937..a75100b213 100644 ---- a/testsuite/tests/frame-pointers/c_call_.c -+++ b/testsuite/tests/frame-pointers/c_call_.c -@@ -16,10 +16,10 @@ - #include - #include "caml/mlvalues.h" - --void fp_backtrace(void); -+void fp_backtrace(value); - --value fp_backtrace_many_args(value a, value b, value c, value d, value e, -- value f, value g, value h, value i, value j, value k) -+value fp_backtrace_many_args(value argv0, value a, value b, value c, -+ value d, value e, value f, value g, value h, value i, value j, value k) - { - assert(Int_val(a) == 1); - assert(Int_val(b) == 2); -@@ -33,15 +33,15 @@ value fp_backtrace_many_args(value a, value b, value c, value d, value e, - assert(Int_val(j) == 10); - assert(Int_val(k) == 11); - -- fp_backtrace(); -+ fp_backtrace(argv0); - - return Val_unit; - } - --value fp_bactrace_many_args_argv(value *argv, int argc) -+value fp_bactrace_many_args_argv(value argv0, value *argv, int argc) - { - assert(argc == 11); - -- return fp_backtrace_many_args(argv[0], argv[1], argv[2], argv[3], argv[4], -- argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]); -+ return fp_backtrace_many_args(argv0, argv[0], argv[1], argv[2], argv[3], -+ argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]); - } -diff --git a/testsuite/tests/frame-pointers/effects.ml b/testsuite/tests/frame-pointers/effects.ml -index e14633a374..4d14190320 100644 ---- a/testsuite/tests/frame-pointers/effects.ml -+++ b/testsuite/tests/frame-pointers/effects.ml -@@ -11,26 +11,26 @@ open Printf - open Effect - open Effect.Deep - --external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc] -+external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc] - - type _ t += E : int -> int t - - let[@inline never] f () = - printf "# computation f\n%!"; -- fp_backtrace (); -+ fp_backtrace Sys.argv.(0); - printf "# perform effect (E 0)\n%!"; - let v = perform (E 0) in - printf "# perform returns %d\n%!" v; -- fp_backtrace (); -+ fp_backtrace Sys.argv.(0); - v + 1 - - let h (type a) (eff : a t) : ((a, 'b) continuation -> 'b) option = - let[@inline never] h_effect_e v k = - printf "# caught effect (E %d). continuing...\n%!" v; -- fp_backtrace (); -+ fp_backtrace Sys.argv.(0); - let v = continue k (v + 1) in - printf "# continue returns %d\n%!" v; -- fp_backtrace (); -+ fp_backtrace Sys.argv.(0); - v + 1 - in - match eff with -@@ -41,7 +41,7 @@ let h (type a) (eff : a t) : ((a, 'b) continuation -> 'b) option = - let v = - let[@inline never] v_retc v = - printf "# done %d\n%!" v; -- fp_backtrace (); -+ fp_backtrace Sys.argv.(0); - v + 1 - in - match_with f () -diff --git a/testsuite/tests/frame-pointers/effects.reference b/testsuite/tests/frame-pointers/effects.reference -index c8bd0a391a..8ae3fc26df 100644 ---- a/testsuite/tests/frame-pointers/effects.reference -+++ b/testsuite/tests/frame-pointers/effects.reference -@@ -3,39 +3,24 @@ camlEffects.f - caml_runstack - camlEffects.entry - caml_program --caml_start_program --caml_main/caml_startup --main - # perform effect (E 0) - # caught effect (E 0). continuing... - camlEffects.h_effect_e - camlEffects.entry - caml_program --caml_start_program --caml_main/caml_startup --main - # perform returns 1 - camlEffects.f - caml_runstack - camlEffects.h_effect_e - camlEffects.entry - caml_program --caml_start_program --caml_main/caml_startup --main - # done 2 - camlEffects.v_retc - camlEffects.h_effect_e - camlEffects.entry - caml_program --caml_start_program --caml_main/caml_startup --main - # continue returns 3 - camlEffects.h_effect_e - camlEffects.entry - caml_program --caml_start_program --caml_main/caml_startup --main - # result=4 -diff --git a/testsuite/tests/frame-pointers/effects.run b/testsuite/tests/frame-pointers/effects.run -deleted file mode 100644 -index e96b5ea13a..0000000000 ---- a/testsuite/tests/frame-pointers/effects.run -+++ /dev/null -@@ -1,4 +0,0 @@ --#!/bin/sh -- --${program} 2>&1 \ -- | ${test_source_directory}/filter-locations.sh ${program} >${output} -diff --git a/testsuite/tests/frame-pointers/exception_handler.ml b/testsuite/tests/frame-pointers/exception_handler.ml -index 575f7329bf..95a4f0d75c 100644 ---- a/testsuite/tests/frame-pointers/exception_handler.ml -+++ b/testsuite/tests/frame-pointers/exception_handler.ml -@@ -8,7 +8,7 @@ all_modules = "${readonly_files} exception_handler.ml" - *) - - (* https://github.com/ocaml/ocaml/pull/11031 *) --external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc] -+external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc] - - exception Exn1 - exception Exn2 -@@ -38,7 +38,7 @@ let[@inline never] handler () = - let _ = Sys.opaque_identity x0 in - let _ = Sys.opaque_identity x1 in - let _ = Sys.opaque_identity x2 in -- fp_backtrace () -+ fp_backtrace Sys.argv.(0) - - let[@inline never] nested i = - begin -diff --git a/testsuite/tests/frame-pointers/exception_handler.reference b/testsuite/tests/frame-pointers/exception_handler.reference -index 513ca488b9..e012fb6d4f 100644 ---- a/testsuite/tests/frame-pointers/exception_handler.reference -+++ b/testsuite/tests/frame-pointers/exception_handler.reference -@@ -2,27 +2,15 @@ camlException_handler.handler - camlException_handler.bare - camlException_handler.entry - caml_program --caml_start_program --caml_main/caml_startup --main - camlException_handler.handler - camlException_handler.bare - camlException_handler.entry - caml_program --caml_start_program --caml_main/caml_startup --main - camlException_handler.handler - camlException_handler.nested - camlException_handler.entry - caml_program --caml_start_program --caml_main/caml_startup --main - camlException_handler.handler - camlException_handler.nested - camlException_handler.entry - caml_program --caml_start_program --caml_main/caml_startup --main -diff --git a/testsuite/tests/frame-pointers/exception_handler.run b/testsuite/tests/frame-pointers/exception_handler.run -deleted file mode 100644 -index e96b5ea13a..0000000000 ---- a/testsuite/tests/frame-pointers/exception_handler.run -+++ /dev/null -@@ -1,4 +0,0 @@ --#!/bin/sh -- --${program} 2>&1 \ -- | ${test_source_directory}/filter-locations.sh ${program} >${output} -diff --git a/testsuite/tests/frame-pointers/filter-locations.sh b/testsuite/tests/frame-pointers/filter-locations.sh -deleted file mode 100755 -index 31c7fc3189..0000000000 ---- a/testsuite/tests/frame-pointers/filter-locations.sh -+++ /dev/null -@@ -1,23 +0,0 @@ --#!/bin/sh -- --set -eu -- --program="${1}" --# https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed/29626460#29626460 --program_escaped=$(echo ${program} | sed 's/[^^\\]/[&]/g; s/\^/\\^/g; s/\\/\\\\/g') --regex_backtrace='^.*(\(.*\)+0x[[:xdigit:]]*)[0x[[:xdigit:]]*]$' --regex_trim_fun='^\(caml.*\)_[[:digit:]]*$' -- --# - Ignore backtrace not coming from the program binary --# - Discard the number suffix from OCaml function name --# - Remove strange '[0x.....]' entries inserted by some implementation --# of backtrace_symbols_fd --# - Keep the other lines --sed -e \ -- "/${regex_backtrace}/ { -- /^${program_escaped}/ ! d -- s/${regex_backtrace}/\1/ -- s/${regex_trim_fun}/\1/ -- s;caml_\(main\|startup\);caml_main/caml_startup; -- }" \ -- -e '/^\[0x/d' -diff --git a/testsuite/tests/frame-pointers/fp_backtrace.c b/testsuite/tests/frame-pointers/fp_backtrace.c -index a521218a38..cef7ccd9f2 100644 ---- a/testsuite/tests/frame-pointers/fp_backtrace.c -+++ b/testsuite/tests/frame-pointers/fp_backtrace.c -@@ -1,10 +1,17 @@ - #include --#include --#include --#include -+#include -+#include - #include -+#include -+#include - --#define ARRSIZE(a) (sizeof(a) / sizeof(*(a))) -+#include "caml/mlvalues.h" -+ -+#define ARR_SIZE(a) (sizeof(a) / sizeof(*(a))) -+ -+#define RE_FUNC_NAME "^.*\\((.+)\\+0x[[:xdigit:]]+\\) \\[0x[[:xdigit:]]+\\]$" -+#define RE_TRIM_FUNC "(caml.*)_[[:digit:]]+" -+#define CAML_ENTRY "caml_program" - - typedef struct frame_info - { -@@ -12,99 +19,138 @@ typedef struct frame_info - void* retaddr; /* rip */ - } frame_info; - --jmp_buf resume_buf; - -+/* -+ * A backtrace symbol looks like: -+ * ./path/to/binary(camlModule_fn_123+0xAABBCC) [0xAABBCCDDEE] -+ */ -+static const char* backtrace_symbol(const struct frame_info* fi) -+{ -+ char** symbols = backtrace_symbols(&fi->retaddr, 1); -+ if (!symbols) { -+ perror("backtrace_symbols"); -+ return NULL; -+ } - --static void signal_handler(int signum) -+ const char* symbol = strdup(symbols[0]); -+ free(symbols); -+ return symbol; -+} -+ -+static bool is_from_executable(const char* symbol, const char* execname) - { -- /* Should be safe to be called from a signal handler. -- * See 21.2.1 "Performing a nonlocal goto from a signal handler" from -- * The Linux Programming Interface, Michael Kerrisk */ -- siglongjmp(resume_buf, 1); -+ return strncmp(symbol, execname, strlen(execname)) == 0; - } - --static int install_signal_handlers(const int signals[], struct sigaction -- handlers[], int count) -+static regmatch_t func_name_from_symbol(const char* symbol) - { -- for (int i = 0; i < count; i++) { -- struct sigaction action = { 0 }; -- action.sa_handler = signal_handler; -- sigemptyset(&action.sa_mask); -- action.sa_flags = 0; -- -- if (sigaction(signals[i], &action, &handlers[i]) != 0) { -- perror("sigaction"); -- return -1; -- } -+ regex_t regex; -+ regmatch_t match[2] = { {-1, -1}, {-1, -1}}; -+ char errbuf[128]; -+ int err; -+ -+ err = regcomp(®ex, RE_FUNC_NAME, REG_EXTENDED); -+ if (err) { -+ regerror(err, ®ex, errbuf, ARR_SIZE(errbuf)); -+ fprintf(stderr, "regcomp: %s\n", errbuf); -+ return match[0]; - } -- return 0; -+ -+ err = regexec(®ex, symbol, ARR_SIZE(match), match, 0); -+ if (err == REG_NOMATCH) -+ return match[0]; -+ -+ return match[1]; - } - --static int restore_signal_handlers(const int signals[], struct sigaction -- handlers[], int count) -+static bool is_caml_entry(const char* symbol, const regmatch_t* funcname) - { -- for (int i = 0; i < count; i++) { -- if (sigaction(signals[i], &handlers[i], NULL) != 0) { -- perror("sigaction"); -- return -1; -- } -- } -- return 0; -+ //regoff_t len = funcname->rm_eo - funcname->rm_so; -+ //return strnstr(symbol + funcname->rm_so, CAML_ENTRY, len) == 0; -+ return strstr(symbol + funcname->rm_so, CAML_ENTRY) != NULL; - } - --static int safe_read(const struct frame_info* fi, struct frame_info** prev, -- void** retaddr) -+static regmatch_t trim_func_name(const char* symbol, const regmatch_t* funcname) - { -- /* Signals to ignore while attempting to read frame_info members */ -- const int signals[] = { SIGSEGV, SIGBUS }; -- /* Store original signal handers */ -- struct sigaction handlers[ARRSIZE(signals)] = { 0 }; -- int ret = 0; -- -- if (install_signal_handlers(signals, handlers, ARRSIZE(signals)) != 0) -- return -1; -- -- if (!sigsetjmp(resume_buf, 1)) { -- *prev = fi->prev; -- *retaddr = fi->retaddr; -- } else { -- ret = -1; -+ regex_t regex; -+ regmatch_t match[2] = { {-1, -1}, {-1, -1}}; -+ char errbuf[128]; -+ int err; -+ -+ err = regcomp(®ex, RE_TRIM_FUNC, REG_EXTENDED); -+ if (err) { -+ regerror(err, ®ex, errbuf, ARR_SIZE(errbuf)); -+ fprintf(stderr, "regcomp: %s\n", errbuf); -+ return match[0]; - } - -- if (restore_signal_handlers(signals, handlers, ARRSIZE(signals)) != 0) -- return -1; -+ match[0] = *funcname; -+ err = regexec(®ex, symbol, ARR_SIZE(match), match, REG_STARTEND); -+ if (err == REG_NOMATCH) { -+ /* match[0] has already been overwritten to hold the function full name for -+ regexec */ -+ return match[1]; -+ } - -- return ret; -+ return match[1]; - } - --static void print_location(void* addr) -+static void print_symbol(const char* symbol, const regmatch_t* match) - { -- if (!addr) -- return; -+ regoff_t off = match->rm_so; -+ regoff_t len = match->rm_eo - match->rm_so; - -- /* This requires the binary to be linked with '-rdynamic' */ -- backtrace_symbols_fd(&addr, 1, STDOUT_FILENO); -+ fprintf(stdout, "%.*s\n", len, symbol + off); -+ fflush(stdout); - } - --void fp_backtrace(void) -+void fp_backtrace(value argv0) - { -- struct frame_info *fi; -- struct frame_info* next; -- void* retaddr; -- -- fi = __builtin_frame_address(0); -- retaddr = __builtin_extract_return_addr(__builtin_return_address(0)); -- -- for (; fi; fi = next) { -- if (safe_read(fi, &next, &retaddr) != 0) -- return; -+ const char* execname = String_val(argv0); -+ struct frame_info* next = NULL; -+ const char* symbol = NULL; - -- print_location(retaddr); -+ for (struct frame_info* fi = __builtin_frame_address(0); fi; fi = next) { -+ next = fi->prev; - - /* Detect the simplest kind of infinite loop */ - if (fi == next) { -- printf("fp_backtrace: loop detected\n"); -- return; -+ fprintf(stderr, "fp_backtrace: loop detected\n"); -+ break; - } -+ -+ symbol = backtrace_symbol(fi); -+ if (!symbol) -+ continue; -+ -+ /* Skip entries not from the test */ -+ if (!is_from_executable(symbol, execname)) -+ goto skip; -+ -+ /* Exctract the full function name */ -+ regmatch_t funcname = func_name_from_symbol(symbol); -+ if (funcname.rm_so == -1) -+ goto skip; -+ -+ /* Trim numeric suffix from caml functions */ -+ regmatch_t functrimmed = trim_func_name(symbol, &funcname); -+ -+ /* Use the trimmed caml name if available, otherwise use the full function -+ name */ -+ const regmatch_t* match = (functrimmed.rm_so != -1) ? -+ &functrimmed : &funcname; -+ -+ print_symbol(symbol, match); -+ -+ /* Stop the backtrace at caml_program */ -+ if (is_caml_entry(symbol, &funcname)) -+ break; -+ -+skip: -+ free((void*)symbol); -+ symbol = NULL; - } -+ -+ if (symbol) -+ free((void*)symbol); - } -diff --git a/testsuite/tests/frame-pointers/reperform.ml b/testsuite/tests/frame-pointers/reperform.ml -index 1af8452e5f..da251c98a7 100644 ---- a/testsuite/tests/frame-pointers/reperform.ml -+++ b/testsuite/tests/frame-pointers/reperform.ml -@@ -11,7 +11,7 @@ all_modules = "${readonly_files} reperform.ml" - open Effect - open Effect.Deep - --external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc] -+external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc] - - type _ Effect.t += E : unit t - | F : unit t -@@ -22,7 +22,7 @@ let rec foo n = - if n = 5 then begin - perform E; - print_endline "# resumed..."; -- fp_backtrace () -+ fp_backtrace Sys.argv.(0) - end; - foo (n + 1) + n - end -diff --git a/testsuite/tests/frame-pointers/reperform.reference b/testsuite/tests/frame-pointers/reperform.reference -index 9ac6681d4b..e215f77169 100644 ---- a/testsuite/tests/frame-pointers/reperform.reference -+++ b/testsuite/tests/frame-pointers/reperform.reference -@@ -15,6 +15,3 @@ camlReperform.bar - caml_runstack - camlReperform.entry - caml_program --caml_start_program --caml_main/caml_startup --main -diff --git a/testsuite/tests/frame-pointers/reperform.run b/testsuite/tests/frame-pointers/reperform.run -deleted file mode 100644 -index e96b5ea13a..0000000000 ---- a/testsuite/tests/frame-pointers/reperform.run -+++ /dev/null -@@ -1,4 +0,0 @@ --#!/bin/sh -- --${program} 2>&1 \ -- | ${test_source_directory}/filter-locations.sh ${program} >${output} -diff --git a/testsuite/tests/frame-pointers/stack_realloc.ml b/testsuite/tests/frame-pointers/stack_realloc.ml -index 79e70c2add..f24e4795d5 100644 ---- a/testsuite/tests/frame-pointers/stack_realloc.ml -+++ b/testsuite/tests/frame-pointers/stack_realloc.ml -@@ -13,7 +13,7 @@ open Effect.Deep - - type _ t += E : int -> int t - --external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc] -+external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc] - external c_fun : unit -> int = "c_fun" - - let[@inline never][@local never] f x = x -@@ -42,7 +42,7 @@ let[@inline never] consume_stack () = - - let[@inline never] callback () = - consume_stack (); -- fp_backtrace (); -+ fp_backtrace Sys.argv.(0); - 0 - - let _ = Callback.register "callback" callback -diff --git a/testsuite/tests/frame-pointers/stack_realloc.reference b/testsuite/tests/frame-pointers/stack_realloc.reference -index 016a03550a..e61d4104e0 100644 ---- a/testsuite/tests/frame-pointers/stack_realloc.reference -+++ b/testsuite/tests/frame-pointers/stack_realloc.reference -@@ -7,6 +7,3 @@ camlStack_realloc.f_comp - caml_runstack - camlStack_realloc.entry - caml_program --caml_start_program --caml_main/caml_startup --main -diff --git a/testsuite/tests/frame-pointers/stack_realloc.run b/testsuite/tests/frame-pointers/stack_realloc.run -deleted file mode 100644 -index e96b5ea13a..0000000000 ---- a/testsuite/tests/frame-pointers/stack_realloc.run -+++ /dev/null -@@ -1,4 +0,0 @@ --#!/bin/sh -- --${program} 2>&1 \ -- | ${test_source_directory}/filter-locations.sh ${program} >${output} -diff --git a/testsuite/tests/frame-pointers/stack_realloc2.ml b/testsuite/tests/frame-pointers/stack_realloc2.ml -index a3d21bf2bf..218dd6a1c3 100644 ---- a/testsuite/tests/frame-pointers/stack_realloc2.ml -+++ b/testsuite/tests/frame-pointers/stack_realloc2.ml -@@ -13,7 +13,7 @@ open Effect.Deep - - type _ t += E : int -> int t - --external fp_backtrace : unit -> unit = "fp_backtrace" [@@noalloc] -+external fp_backtrace : string -> unit = "fp_backtrace" [@@noalloc] - external c_fun : unit -> int = "c_fun" - - let[@inline never][@local never] f x = x -@@ -41,7 +41,7 @@ let[@inline never] consume_stack () = - ignore (gobbler count) - - let[@inline never] callback () = -- fp_backtrace (); -+ fp_backtrace Sys.argv.(0); - 0 - - let _ = Callback.register "callback" callback -diff --git a/testsuite/tests/frame-pointers/stack_realloc2.reference b/testsuite/tests/frame-pointers/stack_realloc2.reference -index ae492abd88..0051f3bad0 100644 ---- a/testsuite/tests/frame-pointers/stack_realloc2.reference -+++ b/testsuite/tests/frame-pointers/stack_realloc2.reference -@@ -7,6 +7,3 @@ camlStack_realloc2.f_comp - caml_runstack - camlStack_realloc2.entry - caml_program --caml_start_program --caml_main/caml_startup --main -diff --git a/testsuite/tests/frame-pointers/stack_realloc2.run b/testsuite/tests/frame-pointers/stack_realloc2.run -deleted file mode 100644 -index e96b5ea13a..0000000000 ---- a/testsuite/tests/frame-pointers/stack_realloc2.run -+++ /dev/null -@@ -1,4 +0,0 @@ --#!/bin/sh -- --${program} 2>&1 \ -- | ${test_source_directory}/filter-locations.sh ${program} >${output} --- -2.43.0 - diff --git a/0004-Fix-s390x-stack-reallocation-code-in-PIC-mode.patch b/0004-Fix-s390x-stack-reallocation-code-in-PIC-mode.patch deleted file mode 100644 index 16c63f9..0000000 --- a/0004-Fix-s390x-stack-reallocation-code-in-PIC-mode.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 81d3fb3e20afede32298e4d3e78bcebf6a22858a Mon Sep 17 00:00:00 2001 -From: Vincent Laviron -Date: Fri, 15 Dec 2023 10:00:52 +0100 -Subject: [PATCH 4/4] Fix s390x stack reallocation code in PIC mode - -(cherry picked from commit c40a955c029a203d0d7f05718e297e66987ec87f) ---- - asmcomp/s390x/emit.mlp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/asmcomp/s390x/emit.mlp b/asmcomp/s390x/emit.mlp -index 35ade079f6..0212cf3b00 100644 ---- a/asmcomp/s390x/emit.mlp -+++ b/asmcomp/s390x/emit.mlp -@@ -751,7 +751,7 @@ let fundecl fundecl = - ` lay %r15, -8(%r15)\n`; - ` stg %r14, 0(%r15)\n`; - ` lgfi %r12, {emit_int s}\n`; -- ` brasl %r14, {emit_symbol "caml_call_realloc_stack"}\n`; -+ emit_call "caml_call_realloc_stack"; - ` lg %r14, 0(%r15)\n`; - ` la %r15, 8(%r15)\n`; - ` brcl 15, {emit_label ret}\n` --- -2.43.0 - diff --git a/ocaml.spec b/ocaml.spec index d8d069b..64db332 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -42,16 +42,17 @@ ExcludeArch: %{ix86} %global rcver %{nil} Name: ocaml -Version: 5.1.1 -Release: 4%{?dist} +Version: 5.2.0 +Release: 1%{?dist} Summary: OCaml compiler and programming environment License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception URL: https://www.ocaml.org +VCS: https://github.com/ocaml/ocaml -Source0: https://github.com/ocaml/ocaml/archive/%{version}/%{name}-%{version}.tar.gz +Source0: %{vcs}/archive/%{version}%{rcver}/%{name}-%{version}%{rcver}.tar.gz Source1: macros.ocaml-rpm Source2: ocaml_files.py @@ -74,13 +75,6 @@ Source2: ocaml_files.py Patch: 0001-Don-t-add-rpaths-to-libraries.patch Patch: 0002-configure-Allow-user-defined-C-compiler-flags.patch -# https://github.com/ocaml/ocaml/pull/11594 -Patch: 0003-Update-framepointers-tests-to-avoid-false-positive-w.patch - -# https://github.com/ocaml/ocaml/issues/12829 -# https://github.com/ocaml/ocaml/pull/12831 -Patch: 0004-Fix-s390x-stack-reallocation-code-in-PIC-mode.patch - BuildRequires: make BuildRequires: git BuildRequires: gcc @@ -111,8 +105,8 @@ Requires: ocaml-runtime%{?_isa} = %{version}-%{release} # Force ocaml-srpm-macros to be at the latest version, both for builds # and installs, since OCaml 5.1 has a different set of native code # generators than previous versions. -BuildRequires: ocaml-srpm-macros >= 9 -Requires: ocaml-srpm-macros >= 9 +BuildRequires: ocaml-srpm-macros >= 10 +Requires: ocaml-srpm-macros >= 10 # Bundles an MD5 implementation in runtime/caml/md5.h and runtime/md5.c Provides: bundled(md5-plumb) @@ -368,8 +362,6 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %{_bindir}/ocamloptp %endif -%{_libdir}/ocaml/camlheader -%{_libdir}/ocaml/camlheader_ur %{_libdir}/ocaml/expunge %{_libdir}/ocaml/ld.conf %{_libdir}/ocaml/Makefile.config @@ -410,8 +402,6 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %{_libdir}/ocaml/*.cmo %{_libdir}/ocaml/*.cmi %{_libdir}/ocaml/*.cma -%{_libdir}/ocaml/camlheaderd -%{_libdir}/ocaml/camlheaderi %{_libdir}/ocaml/stublibs %dir %{_libdir}/ocaml/dynlink %{_libdir}/ocaml/dynlink/META @@ -424,6 +414,7 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %{_libdir}/ocaml/runtime_events/META %{_libdir}/ocaml/runtime_events/*.cmi %{_libdir}/ocaml/runtime_events/*.cma +%{_libdir}/ocaml/runtime-launch-info %{_libdir}/ocaml/stdlib %dir %{_libdir}/ocaml/str %{_libdir}/ocaml/str/META @@ -470,6 +461,10 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Thu May 23 2024 Jerry James - 5.2.0-1 +- Version 5.2.0 +- Drop upstreamed frame pointer and s390x patches + * Thu Jan 25 2024 Fedora Release Engineering - 5.1.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/sources b/sources index f4deb78..c8a1b16 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ocaml-5.1.1.tar.gz) = e4aa78afc9a59f604881f14093f4298ebcb005daeb8132a076fe6d24fdf8b59132cbfa2cfe677f1db1891351d3d637c621f24077e531cac6753c264fc7f5fbea +SHA512 (ocaml-5.2.0.tar.gz) = 78115690186c13c1f2480e4812a9fe34cce2c28bf8a89d5c9810bca0391f930cecd9cee2b53daca8a32da1815628b33be68f3948f1ad03fa50b72b14e3ea84f2 From 7f5edb92c01292a25db532cf468fbc8894fdcd9e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 29 May 2024 10:48:49 +0100 Subject: [PATCH 12/31] New upstream version 5.2.0 (RHBZ#2269805) --- ...onisation-and-consistency-with-trunk.patch | 90 +++ 0002-Changes-copy-editing.patch | 515 ++++++++++++++++++ ...> 0003-Don-t-add-rpaths-to-libraries.patch | 8 +- ...-Allow-user-defined-C-compiler-flags.patch | 8 +- ...transitive-closure-in-invariant_para.patch | 114 ++++ ocaml.spec | 29 +- 6 files changed, 747 insertions(+), 17 deletions(-) create mode 100644 0001-Changes-synchronisation-and-consistency-with-trunk.patch create mode 100644 0002-Changes-copy-editing.patch rename 0001-Don-t-add-rpaths-to-libraries.patch => 0003-Don-t-add-rpaths-to-libraries.patch (79%) rename 0002-configure-Allow-user-defined-C-compiler-flags.patch => 0004-configure-Allow-user-defined-C-compiler-flags.patch (88%) create mode 100644 0005-flambda-Improve-transitive-closure-in-invariant_para.patch diff --git a/0001-Changes-synchronisation-and-consistency-with-trunk.patch b/0001-Changes-synchronisation-and-consistency-with-trunk.patch new file mode 100644 index 0000000..5f865d0 --- /dev/null +++ b/0001-Changes-synchronisation-and-consistency-with-trunk.patch @@ -0,0 +1,90 @@ +From 5538fa66e94fad3d2b4f110d23bef3b4d2d6342c Mon Sep 17 00:00:00 2001 +From: Florian Angeletti +Date: Mon, 13 May 2024 11:39:37 +0200 +Subject: [PATCH 1/5] Changes: synchronisation and consistency with trunk + +--- + Changes | 25 ++++++++++++++----------- + 1 file changed, 14 insertions(+), 11 deletions(-) + +diff --git a/Changes b/Changes +index 208d5e8697..1af198ba77 100644 +--- a/Changes ++++ b/Changes +@@ -140,9 +140,6 @@ OCaml 5.2.0 + (Guillaume Munch-Maccagnoni, bug reports and suggestion by Mark + Shinwell, review by Nick Barnes and Stephen Dolan) + +-- #12876: Port ThreadSanitizer support to Linux on POWER +- (Miod Vallat, review by Tim McGilchrist) +- + - #12408: `Domain.spawn` no longer leaks its functional argument for + the whole duration of the children domain lifetime. + (Guillaume Munch-Maccagnoni, review by Gabriel Scherer) +@@ -156,8 +153,10 @@ OCaml 5.2.0 + review by Damien Doligez, Sébastien Hinderer, Jacques-Henri Jourdan, Luc + Maranget, Guillaume Munch-Maccagnoni, Gabriel Scherer) + +-- #11911, #12381: Restore statmemprof functionality in part +- (API changes in Gc.Memprof). (Nick Barnes) ++- #11911, #12381: Restore statmemprof functionality in part, with ++ some API changes in Gc.Memprof. ++ (Nick Barnes, review by Jacques-Henri Jourdan ++ and Guillaume Munch-Maccagnoni). + + - #12430: Simplify dynamic bytecode loading in Meta.reify_bytecode + (Stephen Dolan, review by Sébastien Hinderer, Vincent Laviron and Xavier +@@ -216,9 +215,10 @@ OCaml 5.2.0 + Ojeda Bar) + + - #11911, #12382, #12383: Restore statmemprof functionality in part +- (backtrace buffers, per-thread and per-domain data structures). +- (Nick Barnes, review by Gabriel Scherer, Fabrice Buoro, Sadiq +- Jaffer, and Guillaume Munch-Maccagnoni). ++ (backtrace buffers, per-thread and per-domain data structures, ++ GC/allocation interface). (Nick Barnes, review by Gabriel Scherer, ++ Fabrice Buoro, Sadiq Jaffer, Guillaume Munch-Maccagnoni, and ++ Jacques-Henri Jourdan). + + - #12735: Store both ends of the stack chain in continuations + (Leo White, review by Miod Vallat and KC Sivaramakrishnan) +@@ -248,6 +248,9 @@ OCaml 5.2.0 + Hari Hara Naveen S, reviewed by Fabrice Buoro, Gabriel Scherer and + Miod Vallat) + ++- #12876: Port ThreadSanitizer support to Linux on POWER ++ (Miod Vallat, review by Tim McGilchrist) ++ + - #12886: Reinitialize IO mutexes after fork + (Max Slater, review by Guillaume Munch-Maccagnoni and Xavier Leroy) + +@@ -990,7 +993,7 @@ OCaml 5.1.0 (14 September 2023) + `Seq.find_mapi`, `Seq.find_index`, `Array.find_mapi`, `Array.find_index`, + `Float.Array.find_opt`, `Float.Array.find_index`, `Float.Array.find_map`, + `Float.Array.find_mapi`. +- (Sima Kinsart, review by Daniel Bünzli and Nicolás Ojeda Bär) ++ (Tima Kinsart, review by Daniel Bünzli and Nicolás Ojeda Bär) + + - #11410: Add Set.to_list, Map.to_list, Map.of_list, + `Map.add_to_list: key -> 'a -> 'a list t -> 'a list t`. +@@ -1771,7 +1774,7 @@ Some of those changes will benefit all OCaml packages. + + - #11846: Mark rbx as destroyed at C call for Win64 (mingw-w64 and Cygwin64). + Reserve the shadow store for the ABI in the c_stack_link struct instead of +- explictly when calling C functions. This simultaneously reduces the number of ++ explicitly when calling C functions. This simultaneously reduces the number of + stack pointer manipulations and also fixes a bug when calling noalloc + functions where the shadow store was not being reserved. + (David Allsopp, report by Vesa Karvonen, review by Xavier Leroy and +@@ -2791,7 +2794,7 @@ OCaml 4.14.0 (28 March 2022) + - #8516: Change representation of class signatures + (Leo White, review by Thomas Refis) + +-- #9444: -dtypedtree, print more explictly extra nodes in pattern ast. ++- #9444: -dtypedtree, print more explicitly extra nodes in pattern ast. + (Frédéric Bour, review by Gabriel Scherer) + + - #10337: Normalize type_expr nodes on access +-- +2.44.0 + diff --git a/0002-Changes-copy-editing.patch b/0002-Changes-copy-editing.patch new file mode 100644 index 0000000..05f48ac --- /dev/null +++ b/0002-Changes-copy-editing.patch @@ -0,0 +1,515 @@ +From 7a20c9322f827923baa6a9907998f670463ce447 Mon Sep 17 00:00:00 2001 +From: Florian Angeletti +Date: Mon, 13 May 2024 14:28:08 +0200 +Subject: [PATCH 2/5] Changes copy-editing + +--- + Changes | 398 ++++++++++++++++++++++++++++---------------------------- + 1 file changed, 201 insertions(+), 197 deletions(-) + +diff --git a/Changes b/Changes +index 1af198ba77..75842fc216 100644 +--- a/Changes ++++ b/Changes +@@ -1,5 +1,5 @@ +-OCaml 5.2.0 +------------- ++OCaml 5.2.0 (13 May 2024) ++------------------------- + + (Changes that can break existing programs are marked with a "*") + +@@ -12,60 +12,6 @@ OCaml 5.2.0 + - #12667: extend the latter to POWER 64 bits, big-endian, ELFv2 ABI + (A. Wilcox, review by Xavier Leroy) + +-### Language features: +- +-- #12295, #12568: Give `while true' a polymorphic type, similarly to +- `assert false' +- (Jeremy Yallop, review by Nicolás Ojeda Bär and Gabriel Scherer, +- suggestion by Rodolphe Lepigre and John Whitington) +- +-- #12315: Use type annotations from arguments in let rec +- (Stephen Dolan, review by Gabriel Scherer) +- +-- #11252, RFC 27: Support raw identifier syntax \#foo +- (Stephen Dolan, review by David Allsopp, Gabriel Scherer and Olivier Nicole) +- +-- #12044: Add local module open syntax for types. +- ``` +- module A = struct +- type t = int +- type r = unit +- type s = string +- end +- +- type example = A.(t * r * s) +- ``` +- (Alistair O'Brien, review by Gabriel Scherer, Nicolás Ojeda Bär +- and Florian Angeletti) +- +-- #12456: Document the incompatibility between effects on the one +- hand, and `caml_callback` and asynchronous callbacks (signal +- handlers, finalisers, memprof callbacks...) on the other hand. +- (Guillaume Munch-Maccagnoni, review by KC Sivaramakrishnan) +- +-- #12375: allow use of [@untagged] for all immediate types like char, bool, +- and variant with only constant constructors. +- (Christophe Raffalli, review by Gabriel Scherer) +- +-* #12502: the compiler now normalizes the newline sequence \r\n to +- a single \n character during lexing, to guarantee that the semantics +- of newlines in string literals is not modified by Windows tools +- transforming \n into \r\n in source files. +- Warning 29 [eol-in-string] is not emitted anymore, as the normalization +- gives a more robust semantics to newlines in string literals. +- (Gabriel Scherer and Damien Doligez, review by Daniel Bünzli, David +- Allsopp, Andreas Rossberg, Xavier Leroy, report by Andreas Rossberg) +- +-- #13130: minor fixes to pprintast for raw identifiers and local module open +- syntax for types. +- (Chet Murthy, review by Gabriel Scherer) +- +-### Type system: +- +-- #12313, #11799: Do not re-build as-pattern type when a ground type annotation +- is given. This allows to work around problems with GADTs in as-patterns. +- (Jacques Garrigue, report by Leo White, review by Gabriel Scherer) +- + ### Runtime system: + + - #12193: Re-introduce GC compaction for shared pools +@@ -76,6 +22,12 @@ OCaml 5.2.0 + David Allsopp, Miod Vallat, Artem Pianykh, Stephen Dolan, Mark Shinwell + and KC Sivaramakrishnan) + ++- #12114: Add ThreadSanitizer support ++ (Fabrice Buoro and Olivier Nicole, based on an initial work by Anmol Sahoo, ++ review by Damien Doligez, Sébastien Hinderer, Jacques-Henri Jourdan, Luc ++ Maranget, Guillaume Munch-Maccagnoni, Gabriel Scherer) ++ ++ + - #12850: Update Gc.quick_stat data at the end of major cycles and compaction + This PR adds an additional caml_collect_gc_stats_sample_stw to the major heap + cycling stw. This means that Gc.quick_stat now actually reflects the state of +@@ -148,11 +100,6 @@ OCaml 5.2.0 + arise at specific locations during domain creation and shutdown. + (Guillaume Munch-Maccagnoni, review by Gabriel Scherer) + +-- #12114: Add ThreadSanitizer support +- (Fabrice Buoro and Olivier Nicole, based on an initial work by Anmol Sahoo, +- review by Damien Doligez, Sébastien Hinderer, Jacques-Henri Jourdan, Luc +- Maranget, Guillaume Munch-Maccagnoni, Gabriel Scherer) +- + - #11911, #12381: Restore statmemprof functionality in part, with + some API changes in Gc.Memprof. + (Nick Barnes, review by Jacques-Henri Jourdan +@@ -264,34 +211,48 @@ OCaml 5.2.0 + (Olivier Nicole, suggested by Stephen Dolan, review by Gabriel Scherer, + Miod Vallat and Damien Doligez) + +-### Code generation and optimizations: ++### Language features: + +-- #11239: on x86-64 and RISC-V, reduce alignment of OCaml stacks from 16 to 8. +- This reduces stack usage. It's only C stacks that require 16-alignment. +- (Xavier Leroy, review by Gabriel Scherer and Stephen Dolan) ++- #12295, #12568: Give `while true' a polymorphic type, similarly to ++ `assert false' ++ (Jeremy Yallop, review by Nicolás Ojeda Bär and Gabriel Scherer, ++ suggestion by Rodolphe Lepigre and John Whitington) + +-- #12311: on POWER, 32-bit FP numbers stored in memory (e.g. in bigarrays) +- were not correctly rounded sometimes. +- (Xavier Leroy, review by Anil Madhavapeddy and Tim McGilchrist) ++- #12044: Add local module open syntax for types. ++ ``` ++ module A = struct ++ type t = int ++ type r = unit ++ type s = string ++ end + +-- #12551, #12608, #12782, #12596: Overhaul of recursive value compilation. +- Non-function recursive bindings are now forbidden from Lambda onwards, +- and compiled using a new Value_rec_compiler module. +- (Vincent Laviron and Lunia Ayanides, review by Gabriel Scherer, +- Stefan Muenzel and Nathanaëlle Courant) ++ type example = A.(t * r * s) ++ ``` ++ (Alistair O'Brien, review by Gabriel Scherer, Nicolás Ojeda Bär ++ and Florian Angeletti) + +-- #1809, #12181: rewrite `compare x y op 0` to `x op y` when values are integers +- (Xavier Clerc, Stefan Muenzel, review by Gabriel Scherer and Vincent Laviron) ++- #11252, RFC 27: Support raw identifier syntax \#foo ++ (Stephen Dolan, review by David Allsopp, Gabriel Scherer and Olivier Nicole) + +-- #12825: disable common subexpression elimination for atomic loads... again. +- (Gabriel Scherer, review by KC Sivaramakrishnan, Xavier Leroy +- and Vincent Laviron, report by Vesa Karvonen) ++ ++- #12315: Use type annotations from arguments in let rec ++ (Stephen Dolan, review by Gabriel Scherer) ++ ++- #12375: allow use of [@untagged] for all immediate types like char, bool, ++ and variant with only constant constructors. ++ (Christophe Raffalli, review by Gabriel Scherer) ++ ++* #12502: the compiler now normalizes the newline sequence \r\n to ++ a single \n character during lexing, to guarantee that the semantics ++ of newlines in string literals is not modified by Windows tools ++ transforming \n into \r\n in source files. ++ Warning 29 [eol-in-string] is not emitted anymore, as the normalization ++ gives a more robust semantics to newlines in string literals. ++ (Gabriel Scherer and Damien Doligez, review by Daniel Bünzli, David ++ Allsopp, Andreas Rossberg, Xavier Leroy, report by Andreas Rossberg) + + ### Standard library: + +-- #12716: Add `Format.pp_print_nothing` function. +- (Léo Andrès, review by Gabriel Scherer and Nicolás Ojeda Bär) +- + - #11563: Add the Dynarray module to the stdlib. Dynamic arrays are + arrays whose length can be changed by adding or removing elements at + the end, similar to 'vectors' in C++ or Rust. +@@ -299,6 +260,10 @@ OCaml 5.2.0 + Daniel Bünzli, Guillaume Munch-Maccagnoni, Clément Allain, + Damien Doligez, Wiktor Kuchta and Pieter Goetschalckx) + ++ ++- #12716: Add `Format.pp_print_nothing` function. ++ (Léo Andrès, review by Gabriel Scherer and Nicolás Ojeda Bär) ++ + * #6732, #12423: Make Buffer.add_substitute surjective and fix its + documentation. + (Damien Doligez, review by Antonin Décimo) +@@ -380,6 +345,35 @@ OCaml 5.2.0 + C API. + (David Allsopp, review by Nicolás Ojeda Bär and Xavier Leroy) + ++### Type system: ++ ++- #12313, #11799: Do not re-build as-pattern type when a ground type annotation ++ is given. This allows to work around problems with GADTs in as-patterns. ++ (Jacques Garrigue, report by Leo White, review by Gabriel Scherer) ++ ++### Code generation and optimizations: ++ ++- #11239: on x86-64 and RISC-V, reduce alignment of OCaml stacks from 16 to 8. ++ This reduces stack usage. It's only C stacks that require 16-alignment. ++ (Xavier Leroy, review by Gabriel Scherer and Stephen Dolan) ++ ++- #12311: on POWER, 32-bit FP numbers stored in memory (e.g. in bigarrays) ++ were not correctly rounded sometimes. ++ (Xavier Leroy, review by Anil Madhavapeddy and Tim McGilchrist) ++ ++- #12551, #12608, #12782, #12596: Overhaul of recursive value compilation. ++ Non-function recursive bindings are now forbidden from Lambda onwards, ++ and compiled using a new Value_rec_compiler module. ++ (Vincent Laviron and Lunia Ayanides, review by Gabriel Scherer, ++ Stefan Muenzel and Nathanaëlle Courant) ++ ++- #1809, #12181: rewrite `compare x y op 0` to `x op y` when values are integers ++ (Xavier Clerc, Stefan Muenzel, review by Gabriel Scherer and Vincent Laviron) ++ ++- #12825: disable common subexpression elimination for atomic loads... again. ++ (Gabriel Scherer, review by KC Sivaramakrishnan, Xavier Leroy ++ and Vincent Laviron, report by Vesa Karvonen) ++ + ### Other libraries: + + - #12213: Dynlink library, improve legibility of error messages +@@ -390,98 +384,14 @@ OCaml 5.2.0 + instead of `value`. + (Xavier Leroy, review by David Allsopp) + +-### Tools: +- +-- #12340: testsuite: collect known issues with current -short-paths +- implementation for existential types +- (Florian Angeletti, Samuel Hym, review by Florian Angeletti and Thomas Refis) +- +-- #12147: ocamllex: Allow carriage returns at the end of line directives. +- (SeungCheol Jung, review by Nicolás Ojeda Bär) +- +-- #12260: Fix invalid_argument on some external or module aliases in ocamlnat +- (Fabian Hemmer, review by Vincent Laviron) +- +-- #12185: New script language for ocamltest. +- (Damien Doligez with Florian Angeletti, Sébastien Hinderer, Gabriel Scherer, +- review by Sébastien Hinderer and Gabriel Scherer) +- +-- #12371: ocamltest: fix recursive expansion of variables. +- (Antonin Décimo, Damien Doligez, review by Sébastien Hinderer, +- Damien Doligez, Gabriel Scherer, and Xavier Leroy) +- +-* #12497, #12613: Make ocamlc/ocamlopt fail with an error when no +- input files are specified to build an executable. +- (Antonin Décimo, review by Sébastien Hinderer) +- +-- #12576: ocamldep: various refactors. +- (Antonin Décimo, review by Florian Angeletti, Gabriel Scherer, and Léo Andrès) +- +-- #12615: ocamldoc: get rid of the odoc_literate and odoc_todo generators. +- (Sébaistien Hinderer, review by Gabriel Scherer and Florian Angeletti) +- +-- #12624: Use $XDG_CONFIG_DIRS in addition to $XDG_CONFIG_HOME when searching +- for init.ml and use this to extend init.ml support to the toplevel when +- running on Windows. +- (David Allsopp, report by Jonah Beckford, review by Nicolás Ojeda Bär and +- Antonin Décimo) +- +-- #12688: Setting the env variable `NO_COLOR` with an empty value no longer +- has effects. Previously, setting `NO_COLOR` with any value, including +- the empty value, would disable colors (unless `OCAML_COLOR` is also set). +- After this change, the user must set `NO_COLOR` with an non-empty value +- to disable colors. This reflects a specification clarification/change +- from the upstream website at https://no-color.org. +- (Favonia, review by Gabriel Scherer) +- +-- #12744: ocamltest: run tests in recursive subdirs more eagerly +- (Nick Roberts, review by Nicolás Ojeda Bär) +- +-- #12901, 12908: ocamllex: add overflow checks to prevent generating incorrect +- lexers; use unsigned numbers in the table encoding when possible. +- (Vincent Laviron, report by Edwin Török, review by Xavier Leroy) +- +-### Manual and documentation: +- +-- #12338: clarification of the documentation of process related function in +- the unix module regarding the first element of args and shell's pid. +- (Christophe Raffalli, review by Florian Angeletti) +- +-- #12473: Document in runtime/memory.c our current understanding of +- accesses to the OCaml heap from the C runtime code -- the problem +- of hybrid programs mixing two memory models. +- (Gabriel Scherer and Guillaume Munch-Maccagnoni, review by Olivier +- Nicole and Xavier Leroy) +- +-- #12694: Document in runtime/tsan.c the TSan instrumentation choices and the +- consequences with regard to the memory model. +- (Olivier Nicole, review by Miod Vallat, Gabriel Scherer, Guillaume +- Munch-Maccagnoni and Fabrice Buoro) +- +-- #12802: Add manual chapter about ThreadSanitizer support +- (Olivier Nicole, review by Miod Vallat, Sebastien Hinderer, Fabrice Buoro, +- Gabriel Scherer and KC Sivaramakrishnan) +- +-- #12819: Clarify which runtime interactions are allowed in custom ops +- (Basile Clément, review by Guillaume Munch-Maccagnoni and Xavier Leroy) +- +-- #12840: manual: update runtime tracing chapter for custom events (ex #12335) +- (Lucas Pluvinage, Sadiq Jaffer and Olivier Nicole, review by Gabriel Scherer, +- David Allsopp, Tim McGilchrist and Thomas Leonard) +- +-- #13066, update OCAMLRUNPARAM documentation for the stack size parameter l +- (Florian Angeletti, review by Nicolás Ojeda Bär, Tim McGilchrist, and +- Miod Vallat) +- +-- #13078: update Format tutorial on structural boxes to mention alignment +- questions. +- (Edwin Török, review by Florian Angeletti) +- +-- #13092: document the existence of the `[@@poll error]` built-in attribute +- (Florian Angeletti, review by Gabriel Scherer) +- + ### Compiler user-interface and warnings: + ++- #11989, #12246, RFC 31: New flag, -H, to allow for transitive dependencies ++ without including them in the initial environment. ++ (Chris Casinghino, François Bobot, and Gabriel Scherer, review by Leo White ++ and Stefan Muenzel, RFC by François Bobot) ++ ++ + * #10613, #12405: Simplify the values used for the system variable (`system:` in + `ocamlopt -config` or the `Config.system` constant). In particular, s390x and + ppc64 now report "linux" instead of "elf"; all variants of 32-bit ARM on Linux +@@ -493,11 +403,6 @@ OCaml 5.2.0 + (David Allsopp, request by Kate Deplaix, review by Sébastien Hinderer and + Xavier Leroy) + +-- #11989, #12246, RFC 31: New flag, -H, to allow for transitive dependencies +- without including them in the initial environment. +- (Chris Casinghino, François Bobot, and Gabriel Scherer, review by Leo White +- and Stefan Muenzel, RFC by François Bobot) +- + - #12247: configure: --disable-ocamldebug can now be used instead + of --disable-debugger (which remains available for compatibility) + (Gabriel Scherer, review by Damien Doligez and Sébastien Hinderer) +@@ -546,9 +451,125 @@ OCaml 5.2.0 + + * #12942: Fix an line ordering in some module inclusion error messages + (Nick Roberts, review by Florian Angeletti, report by Carl Eastlund) ++### Manual and documentation: ++ ++- #12338: clarification of the documentation of process related function in ++ the unix module regarding the first element of args and shell's pid. ++ (Christophe Raffalli, review by Florian Angeletti) ++ ++- #12473: Document in runtime/memory.c our current understanding of ++ accesses to the OCaml heap from the C runtime code -- the problem ++ of hybrid programs mixing two memory models. ++ (Gabriel Scherer and Guillaume Munch-Maccagnoni, review by Olivier ++ Nicole and Xavier Leroy) ++ ++- #12456: Document the incompatibility between effects on the one ++ hand, and `caml_callback` and asynchronous callbacks (signal ++ handlers, finalisers, memprof callbacks...) on the other hand. ++ (Guillaume Munch-Maccagnoni, review by KC Sivaramakrishnan) ++ ++- #12694: Document in runtime/tsan.c the TSan instrumentation choices and the ++ consequences with regard to the memory model. ++ (Olivier Nicole, review by Miod Vallat, Gabriel Scherer, Guillaume ++ Munch-Maccagnoni and Fabrice Buoro) ++ ++- #12802: Add manual chapter about ThreadSanitizer support ++ (Olivier Nicole, review by Miod Vallat, Sebastien Hinderer, Fabrice Buoro, ++ Gabriel Scherer and KC Sivaramakrishnan) ++ ++- #12819: Clarify which runtime interactions are allowed in custom ops ++ (Basile Clément, review by Guillaume Munch-Maccagnoni and Xavier Leroy) ++ ++- #12840: manual: update runtime tracing chapter for custom events (ex #12335) ++ (Lucas Pluvinage, Sadiq Jaffer and Olivier Nicole, review by Gabriel Scherer, ++ David Allsopp, Tim McGilchrist and Thomas Leonard) ++ ++- #13066, update OCAMLRUNPARAM documentation for the stack size parameter l ++ (Florian Angeletti, review by Nicolás Ojeda Bär, Tim McGilchrist, and ++ Miod Vallat) ++ ++- #13078: update Format tutorial on structural boxes to mention alignment ++ questions. ++ (Edwin Török, review by Florian Angeletti) ++ ++- #13092: document the existence of the `[@@poll error]` built-in attribute ++ (Florian Angeletti, review by Gabriel Scherer) ++ ++### Tools: ++ ++- #12340: testsuite: collect known issues with current -short-paths ++ implementation for existential types ++ (Florian Angeletti, Samuel Hym, review by Florian Angeletti and Thomas Refis) ++ ++- #12147: ocamllex: Allow carriage returns at the end of line directives. ++ (SeungCheol Jung, review by Nicolás Ojeda Bär) ++ ++- #12260: Fix invalid_argument on some external or module aliases in ocamlnat ++ (Fabian Hemmer, review by Vincent Laviron) ++ ++- #12185: New script language for ocamltest. ++ (Damien Doligez with Florian Angeletti, Sébastien Hinderer, Gabriel Scherer, ++ review by Sébastien Hinderer and Gabriel Scherer) ++ ++- #12371: ocamltest: fix recursive expansion of variables. ++ (Antonin Décimo, Damien Doligez, review by Sébastien Hinderer, ++ Damien Doligez, Gabriel Scherer, and Xavier Leroy) ++ ++* #12497, #12613: Make ocamlc/ocamlopt fail with an error when no ++ input files are specified to build an executable. ++ (Antonin Décimo, review by Sébastien Hinderer) ++ ++- #12576: ocamldep: various refactors. ++ (Antonin Décimo, review by Florian Angeletti, Gabriel Scherer, and Léo Andrès) ++ ++- #12615: ocamldoc: get rid of the odoc_literate and odoc_todo generators. ++ (Sébaistien Hinderer, review by Gabriel Scherer and Florian Angeletti) ++ ++- #12624: Use $XDG_CONFIG_DIRS in addition to $XDG_CONFIG_HOME when searching ++ for init.ml and use this to extend init.ml support to the toplevel when ++ running on Windows. ++ (David Allsopp, report by Jonah Beckford, review by Nicolás Ojeda Bär and ++ Antonin Décimo) ++ ++- #12688: Setting the env variable `NO_COLOR` with an empty value no longer ++ has effects. Previously, setting `NO_COLOR` with any value, including ++ the empty value, would disable colors (unless `OCAML_COLOR` is also set). ++ After this change, the user must set `NO_COLOR` with an non-empty value ++ to disable colors. This reflects a specification clarification/change ++ from the upstream website at https://no-color.org. ++ (Favonia, review by Gabriel Scherer) ++ ++- #12744: ocamltest: run tests in recursive subdirs more eagerly ++ (Nick Roberts, review by Nicolás Ojeda Bär) ++ ++- #12901, 12908: ocamllex: add overflow checks to prevent generating incorrect ++ lexers; use unsigned numbers in the table encoding when possible. ++ (Vincent Laviron, report by Edwin Török, review by Xavier Leroy) + + ### Internal/compiler-libs changes: + ++- #12508 : Add compiler-side support for project-wide occurrences in Merlin, by ++ generating index tables of all identifier occurrences. This extra data in .cmt ++ files is only added when the new flag -bin-annot-occurrences is passed. ++ (Ulysse Gérard, Nathanaëlle Courant, suggestions by Gabriel Scherer and Thomas ++ Refis, review by Florian Angeletti, Gabriel Scherer and Thomas Refis) ++ ++- #12236, #12386, #12391, #12496, #12673: Use syntax as sole determiner of arity ++ This changes function arity to be based solely on the source program's ++ parsetree. Previously, the heuristic for arity had more subtle heuristics ++ that involved type information about patterns. Function arity is important ++ because it determines when a pattern match's effects run and is an input ++ into the fast path for function application. ++ ++ This change affects tooling: it changes the function constructs in parsetree ++ and typedtree. ++ ++ See https://github.com/ocaml/RFCs/pull/32 for the original RFC. ++ ++ (Nick Roberts; review by Richard Eisenberg, Leo White, and Gabriel Scherer; ++ RFC by Stephen Dolan) ++ ++ + - #12639: parsing: Attach a location to the RHS of Ptyp_alias + and improve the 'alias type mismatch' error message. + (Jules Aguillon, review by Florian Angeletti) +@@ -583,21 +604,6 @@ OCaml 5.2.0 + in Typecore in favor of local mutable state. + (Nick Roberts, review by Takafumi Saikawa) + +-- #12236, #12386, #12391, #12496, #12673: Use syntax as sole determiner of arity +- This changes function arity to be based solely on the source program's +- parsetree. Previously, the heuristic for arity had more subtle heuristics +- that involved type information about patterns. Function arity is important +- because it determines when a pattern match's effects run and is an input +- into the fast path for function application. +- +- This change affects tooling: it changes the function constructs in parsetree +- and typedtree. +- +- See https://github.com/ocaml/RFCs/pull/32 for the original RFC. +- +- (Nick Roberts; review by Richard Eisenberg, Leo White, and Gabriel Scherer; +- RFC by Stephen Dolan) +- + - #12542: Minor bugfix to #12236: restore dropped call to `instance` + (Nick Roberts, review by Jacques Garrigue) + +@@ -650,12 +656,6 @@ OCaml 5.2.0 + - #12764: Move all installable headers in `caml/` sub-directories. + (Antonin Décimo, review by Gabriel Scherer and David Allsopp) + +-- #12508 : Add compiler-side support for project-wide occurrences in Merlin, by +- generating index tables of all identifier occurrences. This extra data in .cmt +- files is only added when the new flag -bin-annot-occurrences is passed. +- (Ulysse Gérard, Nathanaëlle Courant, suggestions by Gabriel Scherer and Thomas +- Refis, review by Florian Angeletti, Gabriel Scherer and Thomas Refis) +- + - #12914: Slightly change the s390x assembly dialect in order to build with + Clang's integrated assembler. + (Miod Vallat, review by Gabriel Scherer) +@@ -888,6 +888,10 @@ OCaml 5.2.0 + - #13094: Fix undefined behavior of left-shifting a negative number. + (Antonin Décimo, review by Miod Vallat and Nicolás Ojeda Bär) + ++- #13130: minor fixes to pprintast for raw identifiers and local module open ++ syntax for types. ++ (Chet Murthy, review by Gabriel Scherer) ++ + OCaml 5.1.1 (8 December 2023) + ---------------------------- + +-- +2.44.0 + diff --git a/0001-Don-t-add-rpaths-to-libraries.patch b/0003-Don-t-add-rpaths-to-libraries.patch similarity index 79% rename from 0001-Don-t-add-rpaths-to-libraries.patch rename to 0003-Don-t-add-rpaths-to-libraries.patch index 04773ec..c3c1373 100644 --- a/0001-Don-t-add-rpaths-to-libraries.patch +++ b/0003-Don-t-add-rpaths-to-libraries.patch @@ -1,14 +1,14 @@ -From 799bf9088c131fc71626a48e9987e4d44a2f0194 Mon Sep 17 00:00:00 2001 +From 507a1382cb82160c2a6cfc0ea5bcb3e33ece7307 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 1/2] Don't add rpaths to libraries. +Subject: [PATCH 3/5] Don't add rpaths to libraries. --- configure.ac | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure.ac b/configure.ac -index b81da53c42..892a2a894f 100644 +index 0c9d63859a..48aa9f0a29 100644 --- a/configure.ac +++ b/configure.ac @@ -1221,8 +1221,6 @@ AS_IF([test x"$enable_shared" != "xno"], @@ -21,5 +21,5 @@ index b81da53c42..892a2a894f 100644 supports_shared_libraries=true], [mkdll='shared-libs-not-available']) -- -2.43.0 +2.44.0 diff --git a/0002-configure-Allow-user-defined-C-compiler-flags.patch b/0004-configure-Allow-user-defined-C-compiler-flags.patch similarity index 88% rename from 0002-configure-Allow-user-defined-C-compiler-flags.patch rename to 0004-configure-Allow-user-defined-C-compiler-flags.patch index 569b4a1..7c447ff 100644 --- a/0002-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0004-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,14 +1,14 @@ -From f2b875e8201efed22267136096b1e5df97f99f84 Mon Sep 17 00:00:00 2001 +From edd903fc73b98eb784b307a47110985967cb1d09 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 2/2] configure: Allow user defined C compiler flags. +Subject: [PATCH 4/5] configure: Allow user defined C compiler flags. --- configure.ac | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac -index 892a2a894f..e8f6cbc863 100644 +index 48aa9f0a29..fc29c88f50 100644 --- a/configure.ac +++ b/configure.ac @@ -869,6 +869,10 @@ AS_CASE([$ocaml_cc_vendor], @@ -41,5 +41,5 @@ index 892a2a894f..e8f6cbc863 100644 mkexe_ldflags="\$(OC_LDFLAGS) \$(LDFLAGS)" mkexe_ldflags_exp="${oc_ldflags} ${LDFLAGS}" -- -2.43.0 +2.44.0 diff --git a/0005-flambda-Improve-transitive-closure-in-invariant_para.patch b/0005-flambda-Improve-transitive-closure-in-invariant_para.patch new file mode 100644 index 0000000..808a96c --- /dev/null +++ b/0005-flambda-Improve-transitive-closure-in-invariant_para.patch @@ -0,0 +1,114 @@ +From acdc441ff1acb5390467e649bc9a9bfddd7df774 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Thu, 9 May 2024 10:03:23 +0200 +Subject: [PATCH 5/5] flambda: Improve transitive closure in + invariant_params_in_recursion (#13150) + +The old implementation did not really exploit the sparseness of the +graph because it used newly discovered edges in later iterations. +The new implementation processes each original relation only once +per starting node, and does not re-process newly discovered relations. + +(cherry picked from commit 787b4fbb5aaf3728de54ca240ba9ca0bf56ace60) +--- + Changes | 5 ++ + middle_end/flambda/invariant_params.ml | 66 ++++++++++---------------- + 2 files changed, 31 insertions(+), 40 deletions(-) + +diff --git a/Changes b/Changes +index 75842fc216..d26512067d 100644 +--- a/Changes ++++ b/Changes +@@ -1,6 +1,11 @@ + OCaml 5.2.0 (13 May 2024) + ------------------------- + ++- #13150: improve a transitive-closure computation algorithm in the flambda ++ middle-end to avoid a compilation time blowup on Menhir-generated code ++ (Florian Weimer, review by Gabriel Scherer and Pierre Chambart, ++ report by Richard Jones) ++ + (Changes that can break existing programs are marked with a "*") + + ### Restored and new backends: +diff --git a/middle_end/flambda/invariant_params.ml b/middle_end/flambda/invariant_params.ml +index 414d39310a..dba63970fd 100644 +--- a/middle_end/flambda/invariant_params.ml ++++ b/middle_end/flambda/invariant_params.ml +@@ -65,47 +65,33 @@ let implies relation from to_ = + relation + + let transitive_closure state = +- let union s1 s2 = +- match s1, s2 with +- | Top, _ | _, Top -> Top +- | Implication s1, Implication s2 -> +- Implication (Variable.Pair.Set.union s1 s2) ++ (* Depth-first search for all implications for one argument. ++ Arguments are moved from candidate to frontier, assuming ++ they are newly added to the result. *) ++ let rec loop candidate frontier result = ++ match (candidate, frontier) with ++ | ([], []) -> Implication result ++ | ([], frontier::fs) -> ++ (* Obtain fresh candidate for the frontier argument. *) ++ (match Variable.Pair.Map.find frontier state with ++ | exception Not_found -> loop [] fs result ++ | Top -> Top ++ | Implication candidate -> ++ loop (Variable.Pair.Set.elements candidate) fs result) ++ | (candidate::cs, frontier) -> ++ let result' = Variable.Pair.Set.add candidate result in ++ if result' != result then ++ (* Result change means candidate becomes part of frontier. *) ++ loop cs (candidate :: frontier) result' ++ else ++ loop cs frontier result + in +- let equal s1 s2 = +- match s1, s2 with +- | Top, Implication _ | Implication _, Top -> false +- | Top, Top -> true +- | Implication s1, Implication s2 -> Variable.Pair.Set.equal s1 s2 +- in +- let update arg state = +- let original_set = +- try Variable.Pair.Map.find arg state with +- | Not_found -> Implication Variable.Pair.Set.empty +- in +- match original_set with +- | Top -> state +- | Implication arguments -> +- let set = +- Variable.Pair.Set.fold +- (fun orig acc-> +- let set = +- try Variable.Pair.Map.find orig state with +- | Not_found -> Implication Variable.Pair.Set.empty in +- union set acc) +- arguments original_set +- in +- Variable.Pair.Map.add arg set state +- in +- let once state = +- Variable.Pair.Map.fold (fun arg _ state -> update arg state) state state +- in +- let rec fp state = +- let state' = once state in +- if Variable.Pair.Map.equal equal state state' +- then state +- else fp state' +- in +- fp state ++ Variable.Pair.Map.map ++ (fun set -> ++ match set with ++ | Top -> Top ++ | Implication set -> loop [] (Variable.Pair.Set.elements set) set) ++ state + + (* CR-soon pchambart: to move to Flambda_utils and document + mshinwell: I think this calculation is basically the same as +-- +2.44.0 + diff --git a/ocaml.spec b/ocaml.spec index 64db332..991fcc3 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -1,10 +1,11 @@ # Don't add -Wl,-dT, %undefine _package_note_flags -# OCaml 5.1 broke building with LTO. A file prims.c is generated with primitive -# function declarations, all with "void" for their parameter list. This does -# not match the real definitions, leading to lots of -Wlto-type-mismatch -# warnings. These change the output of the tests, leading to many failed tests. +# OCaml 5.1 broke building with LTO. A file prims.c is generated with +# primitive function declarations, all with "void" for their parameter +# list. This does not match the real definitions, leading to lots of +# -Wlto-type-mismatch warnings. These change the output of the tests, +# leading to many failed tests. This is still a problem in 5.2. %global _lto_cflags %{nil} # OCaml has a bytecode backend that works on anything with a C @@ -65,15 +66,25 @@ Source2: ocaml_files.py # # https://pagure.io/fedora-ocaml # -# Current branch: fedora-40-5.1.1 +# Current branch: fedora-41-5.2.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. +# Upstream after 5.2.0: +Patch: 0001-Changes-synchronisation-and-consistency-with-trunk.patch +Patch: 0002-Changes-copy-editing.patch + # Fedora-specific patches -Patch: 0001-Don-t-add-rpaths-to-libraries.patch -Patch: 0002-configure-Allow-user-defined-C-compiler-flags.patch +Patch: 0003-Don-t-add-rpaths-to-libraries.patch +Patch: 0004-configure-Allow-user-defined-C-compiler-flags.patch + +# Improve performance of flambda optimizer in some cases. Required to +# compiler blow-up in coccinelle package. Upstream, but not included +# in 5.2 branch. +# https://github.com/ocaml/ocaml/pull/13150 +Patch: 0005-flambda-Improve-transitive-closure-in-invariant_para.patch BuildRequires: make BuildRequires: git @@ -103,7 +114,7 @@ Requires: libzstd-devel%{?_isa} Requires: ocaml-runtime%{?_isa} = %{version}-%{release} # Force ocaml-srpm-macros to be at the latest version, both for builds -# and installs, since OCaml 5.1 has a different set of native code +# and installs, since OCaml 5.2 has a different set of native code # generators than previous versions. BuildRequires: ocaml-srpm-macros >= 10 Requires: ocaml-srpm-macros >= 10 @@ -462,7 +473,7 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog * Thu May 23 2024 Jerry James - 5.2.0-1 -- Version 5.2.0 +- New upstream version 5.2.0 (RHBZ#2269805) - Drop upstreamed frame pointer and s390x patches * Thu Jan 25 2024 Fedora Release Engineering - 5.1.1-4 From 13ff7d02443abd752b791a74c5089bf94685afff Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 19 Jun 2024 08:01:03 +0100 Subject: [PATCH 13/31] Add fix for ppc64le code generation issue found after 5.2.0 was released --- ...onisation-and-consistency-with-trunk.patch | 2 +- 0002-Changes-copy-editing.patch | 2 +- 0003-Don-t-add-rpaths-to-libraries.patch | 2 +- ...-Allow-user-defined-C-compiler-flags.patch | 2 +- ...transitive-closure-in-invariant_para.patch | 2 +- ...tion-pointer-register-in-caml_c_call.patch | 165 ++++++++++++++++ ...urate-instruction-sizes-for-branch-r.patch | 178 ++++++++++++++++++ ocaml.spec | 13 +- 8 files changed, 360 insertions(+), 6 deletions(-) create mode 100644 0006-Reload-exception-pointer-register-in-caml_c_call.patch create mode 100644 0007-Compute-more-accurate-instruction-sizes-for-branch-r.patch diff --git a/0001-Changes-synchronisation-and-consistency-with-trunk.patch b/0001-Changes-synchronisation-and-consistency-with-trunk.patch index 5f865d0..a1f33b7 100644 --- a/0001-Changes-synchronisation-and-consistency-with-trunk.patch +++ b/0001-Changes-synchronisation-and-consistency-with-trunk.patch @@ -1,7 +1,7 @@ From 5538fa66e94fad3d2b4f110d23bef3b4d2d6342c Mon Sep 17 00:00:00 2001 From: Florian Angeletti Date: Mon, 13 May 2024 11:39:37 +0200 -Subject: [PATCH 1/5] Changes: synchronisation and consistency with trunk +Subject: [PATCH 1/7] Changes: synchronisation and consistency with trunk --- Changes | 25 ++++++++++++++----------- diff --git a/0002-Changes-copy-editing.patch b/0002-Changes-copy-editing.patch index 05f48ac..7633e01 100644 --- a/0002-Changes-copy-editing.patch +++ b/0002-Changes-copy-editing.patch @@ -1,7 +1,7 @@ From 7a20c9322f827923baa6a9907998f670463ce447 Mon Sep 17 00:00:00 2001 From: Florian Angeletti Date: Mon, 13 May 2024 14:28:08 +0200 -Subject: [PATCH 2/5] Changes copy-editing +Subject: [PATCH 2/7] Changes copy-editing --- Changes | 398 ++++++++++++++++++++++++++++---------------------------- diff --git a/0003-Don-t-add-rpaths-to-libraries.patch b/0003-Don-t-add-rpaths-to-libraries.patch index c3c1373..3b3e9f9 100644 --- a/0003-Don-t-add-rpaths-to-libraries.patch +++ b/0003-Don-t-add-rpaths-to-libraries.patch @@ -1,7 +1,7 @@ From 507a1382cb82160c2a6cfc0ea5bcb3e33ece7307 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 3/5] Don't add rpaths to libraries. +Subject: [PATCH 3/7] Don't add rpaths to libraries. --- configure.ac | 2 -- diff --git a/0004-configure-Allow-user-defined-C-compiler-flags.patch b/0004-configure-Allow-user-defined-C-compiler-flags.patch index 7c447ff..3c14867 100644 --- a/0004-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0004-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,7 +1,7 @@ From edd903fc73b98eb784b307a47110985967cb1d09 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 4/5] configure: Allow user defined C compiler flags. +Subject: [PATCH 4/7] configure: Allow user defined C compiler flags. --- configure.ac | 8 ++++++-- diff --git a/0005-flambda-Improve-transitive-closure-in-invariant_para.patch b/0005-flambda-Improve-transitive-closure-in-invariant_para.patch index 808a96c..b0b347c 100644 --- a/0005-flambda-Improve-transitive-closure-in-invariant_para.patch +++ b/0005-flambda-Improve-transitive-closure-in-invariant_para.patch @@ -1,7 +1,7 @@ From acdc441ff1acb5390467e649bc9a9bfddd7df774 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Thu, 9 May 2024 10:03:23 +0200 -Subject: [PATCH 5/5] flambda: Improve transitive closure in +Subject: [PATCH 5/7] flambda: Improve transitive closure in invariant_params_in_recursion (#13150) The old implementation did not really exploit the sparseness of the diff --git a/0006-Reload-exception-pointer-register-in-caml_c_call.patch b/0006-Reload-exception-pointer-register-in-caml_c_call.patch new file mode 100644 index 0000000..4c20a85 --- /dev/null +++ b/0006-Reload-exception-pointer-register-in-caml_c_call.patch @@ -0,0 +1,165 @@ +From 8637cac022907501c3c0d941e07e436b70c9d4ac Mon Sep 17 00:00:00 2001 +From: Miod Vallat <118974489+dustanddreams@users.noreply.github.com> +Date: Thu, 30 May 2024 09:57:41 +0000 +Subject: [PATCH 6/7] Reload exception pointer register in caml_c_call* + +The invoked code may end up causing caml_try_realloc_stack() to be invoked, +which in turn may replace the stack TRAP_PTR points to, leading to +either crashes with the debug runtime (thanks to the old stack contents +being overwritten) or all kinds of memory or control flow corruption otherwise. + +Added test for stack reallocation in callback followed by exception raising. + +(cherry picked from commit 6964d3a90f84402ed6066fb1821679435e063067) +(cherry picked from commit 1e8a91d305f1fa4668444fb1cce97952dbc39810) +--- + Changes | 9 +++++++++ + runtime/arm64.S | 6 ++++-- + runtime/power.S | 6 ++++-- + runtime/riscv.S | 6 ++++-- + runtime/s390x.S | 5 +++-- + testsuite/tests/callback/test1.ml | 5 +++++ + 6 files changed, 29 insertions(+), 8 deletions(-) + +diff --git a/Changes b/Changes +index d26512067d..53bb5369b9 100644 +--- a/Changes ++++ b/Changes +@@ -1,3 +1,12 @@ ++OCaml 5.2 maintenance version ++----------------------------- ++ ++- #13207: Be sure to reload the register caching the exception handler in ++ caml_c_call and caml_c_call_stack_args, as its value may have been changed ++ if the OCaml stack is expanded during a callback. ++ (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and ++ Xavier Leroy) ++ + OCaml 5.2.0 (13 May 2024) + ------------------------- + +diff --git a/runtime/arm64.S b/runtime/arm64.S +index e71f25ebba..6c6495a0a8 100644 +--- a/runtime/arm64.S ++++ b/runtime/arm64.S +@@ -569,8 +569,9 @@ FUNCTION(caml_c_call) + str TRAP_PTR, Caml_state(exn_handler) + /* Call the function */ + blr ADDITIONAL_ARG +- /* Reload alloc ptr */ ++ /* Reload new allocation pointer & exn handler */ + ldr ALLOC_PTR, Caml_state(young_ptr) ++ ldr TRAP_PTR, Caml_state(exn_handler) + /* Load ocaml stack */ + SWITCH_C_TO_OCAML + #if defined(WITH_THREAD_SANITIZER) +@@ -625,8 +626,9 @@ FUNCTION(caml_c_call_stack_args) + blr ADDITIONAL_ARG + /* Restore stack */ + mov sp, x19 +- /* Reload alloc ptr */ ++ /* Reload new allocation pointer & exn handler */ + ldr ALLOC_PTR, Caml_state(young_ptr) ++ ldr TRAP_PTR, Caml_state(exn_handler) + /* Switch from C to OCaml */ + SWITCH_C_TO_OCAML + /* Return */ +diff --git a/runtime/power.S b/runtime/power.S +index bfb37fa989..257678100e 100644 +--- a/runtime/power.S ++++ b/runtime/power.S +@@ -445,8 +445,9 @@ FUNCTION caml_c_call + mr 2, C_CALL_TOC /* restore current TOC */ + /* Restore return address (in register C_CALL_RET_ADDR, preserved by C) */ + mtlr C_CALL_RET_ADDR +- /* Reload allocation pointer*/ ++ /* Reload new allocation pointer and exception pointer */ + ld ALLOC_PTR, Caml_state(young_ptr) ++ ld TRAP_PTR, Caml_state(exn_handler) + #if defined(WITH_THREAD_SANITIZER) + TSAN_SETUP_C_CALL 16 + /* Save return value registers. Since the called function could be anything, +@@ -497,8 +498,9 @@ FUNCTION caml_c_call_stack_args + add SP, SP, STACK_ARG_BYTES + /* Restore return address (in register C_CALL_RET_ADDR, preserved by C) */ + mtlr C_CALL_RET_ADDR +- /* Reload allocation pointer*/ ++ /* Reload new allocation pointer and exception pointer */ + ld ALLOC_PTR, Caml_state(young_ptr) ++ ld TRAP_PTR, Caml_state(exn_handler) + /* Switch from C to OCaml */ + SWITCH_C_TO_OCAML + /* Return to caller */ +diff --git a/runtime/riscv.S b/runtime/riscv.S +index a2eca7a315..8934db0bb3 100644 +--- a/runtime/riscv.S ++++ b/runtime/riscv.S +@@ -516,8 +516,9 @@ L(caml_c_call): + sd TRAP_PTR, Caml_state(exn_handler) + /* Call the function */ + jalr ADDITIONAL_ARG +- /* Reload alloc ptr */ ++ /* Reload new allocation pointer & exn handler */ + ld ALLOC_PTR, Caml_state(young_ptr) ++ ld TRAP_PTR, Caml_state(exn_handler) + /* Load ocaml stack */ + SWITCH_C_TO_OCAML + #if defined(WITH_THREAD_SANITIZER) +@@ -575,8 +576,9 @@ FUNCTION(caml_c_call_stack_args) + jalr ADDITIONAL_ARG + /* Restore stack */ + mv sp, s2 +- /* Reload alloc ptr */ ++ /* Reload new allocation pointer & exn handler */ + ld ALLOC_PTR, Caml_state(young_ptr) ++ ld TRAP_PTR, Caml_state(exn_handler) + /* Switch from C to OCaml */ + SWITCH_C_TO_OCAML + /* Return */ +diff --git a/runtime/s390x.S b/runtime/s390x.S +index b59822ce57..113831a376 100644 +--- a/runtime/s390x.S ++++ b/runtime/s390x.S +@@ -515,7 +515,7 @@ LBL(caml_c_call): + #endif + basr %r14, ADDITIONAL_ARG + CLEANUP_AFTER_C_CALL +- /* Reload alloc ptr */ ++ /* Reload new allocation pointer & exn handler */ + lg ALLOC_PTR, Caml_state(young_ptr) + lg TRAP_PTR, Caml_state(exn_handler) + /* Load ocaml stack and restore global variables */ +@@ -584,8 +584,9 @@ LBL(106): + CLEANUP_AFTER_C_CALL + /* Restore stack */ + lgr %r15, %r12 +- /* Reload alloc ptr */ ++ /* Reload new allocation pointer & exn handler */ + lg ALLOC_PTR, Caml_state(young_ptr) ++ lg TRAP_PTR, Caml_state(exn_handler) + /* Switch from C to OCaml */ + SWITCH_C_TO_OCAML + /* Return */ +diff --git a/testsuite/tests/callback/test1.ml b/testsuite/tests/callback/test1.ml +index c39be0c586..f6ad4356cf 100644 +--- a/testsuite/tests/callback/test1.ml ++++ b/testsuite/tests/callback/test1.ml +@@ -11,6 +11,9 @@ external mycallback3 : ('a -> 'b -> 'c -> 'd) -> 'a -> 'b -> 'c -> 'd + external mycallback4 : + ('a -> 'b -> 'c -> 'd -> 'e) -> 'a -> 'b -> 'c -> 'd -> 'e = "mycallback4" + ++let rec growstack n = ++ if n <= 0 then 0 else 1 + growstack (n - 1) ++ + let rec tak (x, y, z as _tuple) = + if x > y then tak(tak (x-1, y, z), tak (y-1, z, x), tak (z-1, x, y)) + else z +@@ -46,3 +49,5 @@ let _ = + print_int(trapexit ()); print_newline(); + print_string(tripwire mypushroot); print_newline(); + print_string(tripwire mycamlparam); print_newline(); ++ begin try ignore (mycallback1 growstack 1_000); raise Exit ++ with Exit -> () end +-- +2.44.0 + diff --git a/0007-Compute-more-accurate-instruction-sizes-for-branch-r.patch b/0007-Compute-more-accurate-instruction-sizes-for-branch-r.patch new file mode 100644 index 0000000..e9dd879 --- /dev/null +++ b/0007-Compute-more-accurate-instruction-sizes-for-branch-r.patch @@ -0,0 +1,178 @@ +From 4eb80b13779125fcd76a445ab0004ca064fab634 Mon Sep 17 00:00:00 2001 +From: Miod Vallat +Date: Fri, 7 Jun 2024 06:19:45 +0000 +Subject: [PATCH 7/7] Compute more accurate instruction sizes for branch + relaxation. + +(cherry picked from commit 114ddae2d4c85391a4f939dc6623424ae35a07aa) +--- + Changes | 4 ++ + asmcomp/power/emit.mlp | 87 ++++++++++++++++++++++++------------------ + 2 files changed, 53 insertions(+), 38 deletions(-) + +diff --git a/Changes b/Changes +index 53bb5369b9..1a81509247 100644 +--- a/Changes ++++ b/Changes +@@ -7,6 +7,10 @@ OCaml 5.2 maintenance version + (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and + Xavier Leroy) + ++- #13221: Compute more accurate instruction sizes for branch relocation on ++ POWER. ++ (Miod Vallat, review by Gabriel Scherer) ++ + OCaml 5.2.0 (13 May 2024) + ------------------------- + +diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp +index 47f5419a92..fdf22996fa 100644 +--- a/asmcomp/power/emit.mlp ++++ b/asmcomp/power/emit.mlp +@@ -177,6 +177,28 @@ let emit_tocload emit_dest dest entry = + + (* Output a load or store operation *) + ++let load_mnemonic = function ++ | Byte_unsigned -> "lbz" ++ | Byte_signed -> "lbz" ++ | Sixteen_unsigned -> "lhz" ++ | Sixteen_signed -> "lha" ++ | Thirtytwo_unsigned -> "lwz" ++ | Thirtytwo_signed -> "lwa" ++ | Word_int | Word_val -> "ld" ++ | Single -> "lfs" ++ | Double -> "lfd" ++ ++let store_mnemonic = function ++ | Byte_unsigned | Byte_signed -> "stb" ++ | Sixteen_unsigned | Sixteen_signed -> "sth" ++ | Thirtytwo_unsigned | Thirtytwo_signed -> "stw" ++ | Word_int | Word_val -> "std" ++ | Single -> "stfs" ++ | Double -> "stfd" ++ ++let store_needs_lwsync chunk assignment = ++ assignment && (chunk = Word_int || chunk = Word_val) ++ + let valid_offset instr ofs = + ofs land 3 = 0 || (instr <> "ld" && instr <> "std" && instr <> "lwa") + +@@ -383,11 +405,17 @@ module BR = Branch_relaxation.Make (struct + + let tocload_size = 2 + +- let load_store_size = function ++ let load_store_size instr = function + | Ibased(_s, d) -> +- let (_lo, hi) = low_high_s d in +- tocload_size + (if hi = 0 then 1 else 2) +- | Iindexed ofs -> if is_immediate ofs then 1 else 3 ++ let (lo, hi) = low_high_s d in ++ tocload_size + ++ (if hi <> 0 then 1 else 0) + ++ (if valid_offset instr lo then 1 else 2) ++ | Iindexed ofs -> ++ if is_immediate ofs && valid_offset instr ofs then 1 else begin ++ let (lo, _hi) = low_high_u ofs in ++ if lo <> 0 then 3 else 2 ++ end + | Iindexed2 -> 1 + + let instr_size f = function +@@ -415,16 +443,16 @@ module BR = Branch_relaxation.Make (struct + else if alloc then tocload_size + 2 + else 5 + | Lop(Istackoffset _) -> 1 +- | Lop(Iload {memory_chunk; addressing_mode; _ }) -> +- if memory_chunk = Byte_signed +- then load_store_size addressing_mode + 1 +- else load_store_size addressing_mode ++ | Lop(Iload {memory_chunk; addressing_mode; is_atomic }) -> ++ let loadinstr = load_mnemonic memory_chunk in ++ (if is_atomic then 4 else 0) + ++ (if memory_chunk = Byte_signed then 1 else 0) + ++ load_store_size loadinstr addressing_mode + | Lop(Istore(chunk, addr, assignment)) -> +- (match chunk with +- | Single -> 1 +- | Word_int | Word_val when assignment -> 1 +- | _ -> 0) +- + load_store_size addr ++ let storeinstr = store_mnemonic chunk in ++ (if chunk = Single then 1 else 0) + ++ (if store_needs_lwsync chunk assignment then 1 else 0) + ++ load_store_size storeinstr addr + | Lop(Ialloc _) -> 5 + | Lop(Ispecific(Ialloc_far _)) -> 6 + | Lop(Ipoll { return_label = Some(_) }) -> 5 +@@ -442,12 +470,12 @@ module BR = Branch_relaxation.Make (struct + | Lop(Ispecific(Icheckbound_imm_far _)) -> 3 + | Lop(Iintop_imm _) -> 1 + | Lop(Inegf | Iabsf | Iaddf | Isubf | Imulf | Idivf) -> 1 +- | Lop(Ifloatofint) -> 9 +- | Lop(Iintoffloat) -> 4 ++ | Lop(Ifloatofint) -> 3 ++ | Lop(Iintoffloat) -> 3 + | Lop(Iopaque) -> 0 + | Lop(Ispecific _) -> 1 +- | Lop (Idls_get) -> 1 +- | Lop (Ireturn_addr) -> 1 ++ | Lop(Idls_get) -> 1 ++ | Lop(Ireturn_addr) -> 1 + | Lreloadretaddr -> 2 + | Lreturn -> 2 + | Llabel _ -> 0 +@@ -457,7 +485,7 @@ module BR = Branch_relaxation.Make (struct + 1 + (if lbl0 = None then 0 else 1) + + (if lbl1 = None then 0 else 1) + + (if lbl2 = None then 0 else 1) +- | Lswitch _ -> 5 + tocload_size ++ | Lswitch _ -> 7 + tocload_size + | Lentertrap -> 1 + | Ladjust_trap_depth _ -> 0 + | Lpushtrap _ -> 4 + tocload_size +@@ -705,17 +733,7 @@ let emit_instr env i = + ` addi 1, 1, {emit_int (-n)}\n`; + adjust_stack_offset env n + | Lop(Iload { memory_chunk; addressing_mode; is_atomic }) -> +- let loadinstr = +- match memory_chunk with +- | Byte_unsigned -> "lbz" +- | Byte_signed -> "lbz" +- | Sixteen_unsigned -> "lhz" +- | Sixteen_signed -> "lha" +- | Thirtytwo_unsigned -> "lwz" +- | Thirtytwo_signed -> "lwa" +- | Word_int | Word_val -> "ld" +- | Single -> "lfs" +- | Double -> "lfd" in ++ let loadinstr = load_mnemonic memory_chunk in + if is_atomic then + ` sync\n`; + emit_load_store loadinstr addressing_mode i.arg 0 i.res.(0); +@@ -731,19 +749,12 @@ let emit_instr env i = + ` frsp {emit_reg tmp}, {emit_reg i.arg.(0)}\n`; + emit_load_store "stfs" addr i.arg 1 tmp + | Lop(Istore(chunk, addr, assignment)) -> +- let storeinstr = +- match chunk with +- | Byte_unsigned | Byte_signed -> "stb" +- | Sixteen_unsigned | Sixteen_signed -> "sth" +- | Thirtytwo_unsigned | Thirtytwo_signed -> "stw" +- | Word_int | Word_val -> "std" +- | Single -> assert false +- | Double -> "stfd" in ++ let storeinstr = store_mnemonic chunk in + (* Non-initializing stores need a memory barrier to follow the + Multicore OCaml memory model. Stores of size other than + Word_int and Word_val do not follow the memory model and therefore + do not need a barrier *) +- if assignment && (chunk = Word_int || chunk = Word_val) then ++ if store_needs_lwsync chunk assignment then + ` lwsync\n`; + emit_load_store storeinstr addr i.arg 1 i.arg.(0) + | Lop(Ialloc { bytes; dbginfo }) -> +-- +2.44.0 + diff --git a/ocaml.spec b/ocaml.spec index 991fcc3..a94c4fb 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -44,7 +44,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.2.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: OCaml compiler and programming environment @@ -86,6 +86,14 @@ Patch: 0004-configure-Allow-user-defined-C-compiler-flags.patch # https://github.com/ocaml/ocaml/pull/13150 Patch: 0005-flambda-Improve-transitive-closure-in-invariant_para.patch +# Upstream after 5.2.0: +Patch: 0006-Reload-exception-pointer-register-in-caml_c_call.patch + +# Fix for ppc64le code generation issue found after 5.2.0 was released. +# https://github.com/ocaml/ocaml/issues/13220 +# https://github.com/ocaml/ocaml/commit/114ddae2d4c85391a4f939dc6623424ae35a07aa +Patch: 0007-Compute-more-accurate-instruction-sizes-for-branch-r.patch + BuildRequires: make BuildRequires: git BuildRequires: gcc @@ -472,6 +480,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Wed Jun 19 2024 Richard W.M. Jones - 5.2.0-2 +- Add fix for ppc64le code generation issue found after 5.2.0 was released + * Thu May 23 2024 Jerry James - 5.2.0-1 - New upstream version 5.2.0 (RHBZ#2269805) - Drop upstreamed frame pointer and s390x patches From 561453cd2d96d239213926816ae8c1786e3931e9 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 19 Jun 2024 08:25:18 +0100 Subject: [PATCH 14/31] Add RHEL 10 gating tests --- gating.yaml | 6 ++++++ tests/basic-test.sh | 10 ++++++++++ tests/tests.yml | 11 +++++++++++ 3 files changed, 27 insertions(+) create mode 100755 gating.yaml create mode 100755 tests/basic-test.sh create mode 100755 tests/tests.yml diff --git a/gating.yaml b/gating.yaml new file mode 100755 index 0000000..2c7ed80 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-* +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/basic-test.sh b/tests/basic-test.sh new file mode 100755 index 0000000..514bea0 --- /dev/null +++ b/tests/basic-test.sh @@ -0,0 +1,10 @@ +#!/bin/bash - +set -e +set -x + +# Compile a trivial program and run it. +echo 'print_endline "hello, world"' > hello.ml +ocamlc.opt hello.ml -o hello +./hello +ocamlopt.opt hello.ml -o hello +./hello diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100755 index 0000000..b9ec89a --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,11 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + required_packages: + - ocaml + tests: + - simple: + dir: . + run: ./basic-test.sh From 0e1aab5f28895e613b3764513d98a41c317b75c3 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Wed, 17 Jul 2024 11:25:19 -0600 Subject: [PATCH 15/31] Fix the VCS field --- ocaml.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ocaml.spec b/ocaml.spec index a94c4fb..28b57d1 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -25,6 +25,8 @@ %global natdynlink 0 %endif +%global giturl https://github.com/ocaml/ocaml + # i686 support was dropped in OCaml 5 / Fedora 39. ExcludeArch: %{ix86} @@ -51,9 +53,9 @@ Summary: OCaml compiler and programming environment License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception URL: https://www.ocaml.org -VCS: https://github.com/ocaml/ocaml +VCS: git:%{giturl}.git -Source0: %{vcs}/archive/%{version}%{rcver}/%{name}-%{version}%{rcver}.tar.gz +Source0: %{giturl}/archive/%{version}%{rcver}/%{name}-%{version}%{rcver}.tar.gz Source1: macros.ocaml-rpm Source2: ocaml_files.py From a7c6be2f53b7e29619faa2a481bb3b3905293276 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 18 Jul 2024 19:59:15 +0000 Subject: [PATCH 16/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- ocaml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index 28b57d1..c4b4035 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -46,7 +46,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.2.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: OCaml compiler and programming environment @@ -482,6 +482,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Thu Jul 18 2024 Fedora Release Engineering - 5.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Wed Jun 19 2024 Richard W.M. Jones - 5.2.0-2 - Add fix for ppc64le code generation issue found after 5.2.0 was released From 5018fa7019c262dbfb0402f9cc0f1e19b33d16d3 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Thu, 9 Jan 2025 08:24:42 -0700 Subject: [PATCH 17/31] New upstream version 5.3.0 - Drop upstreamed patches - BR git-core instead of git --- ...onisation-and-consistency-with-trunk.patch | 90 --- ...> 0001-Don-t-add-rpaths-to-libraries.patch | 2 +- 0002-Changes-copy-editing.patch | 515 ------------------ ...-Allow-user-defined-C-compiler-flags.patch | 16 +- ...transitive-closure-in-invariant_para.patch | 114 ---- ...tion-pointer-register-in-caml_c_call.patch | 165 ------ ...urate-instruction-sizes-for-branch-r.patch | 178 ------ ocaml.spec | 38 +- sources | 2 +- 9 files changed, 17 insertions(+), 1103 deletions(-) delete mode 100644 0001-Changes-synchronisation-and-consistency-with-trunk.patch rename 0003-Don-t-add-rpaths-to-libraries.patch => 0001-Don-t-add-rpaths-to-libraries.patch (93%) delete mode 100644 0002-Changes-copy-editing.patch rename 0004-configure-Allow-user-defined-C-compiler-flags.patch => 0002-configure-Allow-user-defined-C-compiler-flags.patch (64%) delete mode 100644 0005-flambda-Improve-transitive-closure-in-invariant_para.patch delete mode 100644 0006-Reload-exception-pointer-register-in-caml_c_call.patch delete mode 100644 0007-Compute-more-accurate-instruction-sizes-for-branch-r.patch diff --git a/0001-Changes-synchronisation-and-consistency-with-trunk.patch b/0001-Changes-synchronisation-and-consistency-with-trunk.patch deleted file mode 100644 index a1f33b7..0000000 --- a/0001-Changes-synchronisation-and-consistency-with-trunk.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 5538fa66e94fad3d2b4f110d23bef3b4d2d6342c Mon Sep 17 00:00:00 2001 -From: Florian Angeletti -Date: Mon, 13 May 2024 11:39:37 +0200 -Subject: [PATCH 1/7] Changes: synchronisation and consistency with trunk - ---- - Changes | 25 ++++++++++++++----------- - 1 file changed, 14 insertions(+), 11 deletions(-) - -diff --git a/Changes b/Changes -index 208d5e8697..1af198ba77 100644 ---- a/Changes -+++ b/Changes -@@ -140,9 +140,6 @@ OCaml 5.2.0 - (Guillaume Munch-Maccagnoni, bug reports and suggestion by Mark - Shinwell, review by Nick Barnes and Stephen Dolan) - --- #12876: Port ThreadSanitizer support to Linux on POWER -- (Miod Vallat, review by Tim McGilchrist) -- - - #12408: `Domain.spawn` no longer leaks its functional argument for - the whole duration of the children domain lifetime. - (Guillaume Munch-Maccagnoni, review by Gabriel Scherer) -@@ -156,8 +153,10 @@ OCaml 5.2.0 - review by Damien Doligez, Sébastien Hinderer, Jacques-Henri Jourdan, Luc - Maranget, Guillaume Munch-Maccagnoni, Gabriel Scherer) - --- #11911, #12381: Restore statmemprof functionality in part -- (API changes in Gc.Memprof). (Nick Barnes) -+- #11911, #12381: Restore statmemprof functionality in part, with -+ some API changes in Gc.Memprof. -+ (Nick Barnes, review by Jacques-Henri Jourdan -+ and Guillaume Munch-Maccagnoni). - - - #12430: Simplify dynamic bytecode loading in Meta.reify_bytecode - (Stephen Dolan, review by Sébastien Hinderer, Vincent Laviron and Xavier -@@ -216,9 +215,10 @@ OCaml 5.2.0 - Ojeda Bar) - - - #11911, #12382, #12383: Restore statmemprof functionality in part -- (backtrace buffers, per-thread and per-domain data structures). -- (Nick Barnes, review by Gabriel Scherer, Fabrice Buoro, Sadiq -- Jaffer, and Guillaume Munch-Maccagnoni). -+ (backtrace buffers, per-thread and per-domain data structures, -+ GC/allocation interface). (Nick Barnes, review by Gabriel Scherer, -+ Fabrice Buoro, Sadiq Jaffer, Guillaume Munch-Maccagnoni, and -+ Jacques-Henri Jourdan). - - - #12735: Store both ends of the stack chain in continuations - (Leo White, review by Miod Vallat and KC Sivaramakrishnan) -@@ -248,6 +248,9 @@ OCaml 5.2.0 - Hari Hara Naveen S, reviewed by Fabrice Buoro, Gabriel Scherer and - Miod Vallat) - -+- #12876: Port ThreadSanitizer support to Linux on POWER -+ (Miod Vallat, review by Tim McGilchrist) -+ - - #12886: Reinitialize IO mutexes after fork - (Max Slater, review by Guillaume Munch-Maccagnoni and Xavier Leroy) - -@@ -990,7 +993,7 @@ OCaml 5.1.0 (14 September 2023) - `Seq.find_mapi`, `Seq.find_index`, `Array.find_mapi`, `Array.find_index`, - `Float.Array.find_opt`, `Float.Array.find_index`, `Float.Array.find_map`, - `Float.Array.find_mapi`. -- (Sima Kinsart, review by Daniel Bünzli and Nicolás Ojeda Bär) -+ (Tima Kinsart, review by Daniel Bünzli and Nicolás Ojeda Bär) - - - #11410: Add Set.to_list, Map.to_list, Map.of_list, - `Map.add_to_list: key -> 'a -> 'a list t -> 'a list t`. -@@ -1771,7 +1774,7 @@ Some of those changes will benefit all OCaml packages. - - - #11846: Mark rbx as destroyed at C call for Win64 (mingw-w64 and Cygwin64). - Reserve the shadow store for the ABI in the c_stack_link struct instead of -- explictly when calling C functions. This simultaneously reduces the number of -+ explicitly when calling C functions. This simultaneously reduces the number of - stack pointer manipulations and also fixes a bug when calling noalloc - functions where the shadow store was not being reserved. - (David Allsopp, report by Vesa Karvonen, review by Xavier Leroy and -@@ -2791,7 +2794,7 @@ OCaml 4.14.0 (28 March 2022) - - #8516: Change representation of class signatures - (Leo White, review by Thomas Refis) - --- #9444: -dtypedtree, print more explictly extra nodes in pattern ast. -+- #9444: -dtypedtree, print more explicitly extra nodes in pattern ast. - (Frédéric Bour, review by Gabriel Scherer) - - - #10337: Normalize type_expr nodes on access --- -2.44.0 - diff --git a/0003-Don-t-add-rpaths-to-libraries.patch b/0001-Don-t-add-rpaths-to-libraries.patch similarity index 93% rename from 0003-Don-t-add-rpaths-to-libraries.patch rename to 0001-Don-t-add-rpaths-to-libraries.patch index 3b3e9f9..b5735bd 100644 --- a/0003-Don-t-add-rpaths-to-libraries.patch +++ b/0001-Don-t-add-rpaths-to-libraries.patch @@ -1,7 +1,7 @@ From 507a1382cb82160c2a6cfc0ea5bcb3e33ece7307 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 3/7] Don't add rpaths to libraries. +Subject: [PATCH 1/2] Don't add rpaths to libraries. --- configure.ac | 2 -- diff --git a/0002-Changes-copy-editing.patch b/0002-Changes-copy-editing.patch deleted file mode 100644 index 7633e01..0000000 --- a/0002-Changes-copy-editing.patch +++ /dev/null @@ -1,515 +0,0 @@ -From 7a20c9322f827923baa6a9907998f670463ce447 Mon Sep 17 00:00:00 2001 -From: Florian Angeletti -Date: Mon, 13 May 2024 14:28:08 +0200 -Subject: [PATCH 2/7] Changes copy-editing - ---- - Changes | 398 ++++++++++++++++++++++++++++---------------------------- - 1 file changed, 201 insertions(+), 197 deletions(-) - -diff --git a/Changes b/Changes -index 1af198ba77..75842fc216 100644 ---- a/Changes -+++ b/Changes -@@ -1,5 +1,5 @@ --OCaml 5.2.0 -------------- -+OCaml 5.2.0 (13 May 2024) -+------------------------- - - (Changes that can break existing programs are marked with a "*") - -@@ -12,60 +12,6 @@ OCaml 5.2.0 - - #12667: extend the latter to POWER 64 bits, big-endian, ELFv2 ABI - (A. Wilcox, review by Xavier Leroy) - --### Language features: -- --- #12295, #12568: Give `while true' a polymorphic type, similarly to -- `assert false' -- (Jeremy Yallop, review by Nicolás Ojeda Bär and Gabriel Scherer, -- suggestion by Rodolphe Lepigre and John Whitington) -- --- #12315: Use type annotations from arguments in let rec -- (Stephen Dolan, review by Gabriel Scherer) -- --- #11252, RFC 27: Support raw identifier syntax \#foo -- (Stephen Dolan, review by David Allsopp, Gabriel Scherer and Olivier Nicole) -- --- #12044: Add local module open syntax for types. -- ``` -- module A = struct -- type t = int -- type r = unit -- type s = string -- end -- -- type example = A.(t * r * s) -- ``` -- (Alistair O'Brien, review by Gabriel Scherer, Nicolás Ojeda Bär -- and Florian Angeletti) -- --- #12456: Document the incompatibility between effects on the one -- hand, and `caml_callback` and asynchronous callbacks (signal -- handlers, finalisers, memprof callbacks...) on the other hand. -- (Guillaume Munch-Maccagnoni, review by KC Sivaramakrishnan) -- --- #12375: allow use of [@untagged] for all immediate types like char, bool, -- and variant with only constant constructors. -- (Christophe Raffalli, review by Gabriel Scherer) -- --* #12502: the compiler now normalizes the newline sequence \r\n to -- a single \n character during lexing, to guarantee that the semantics -- of newlines in string literals is not modified by Windows tools -- transforming \n into \r\n in source files. -- Warning 29 [eol-in-string] is not emitted anymore, as the normalization -- gives a more robust semantics to newlines in string literals. -- (Gabriel Scherer and Damien Doligez, review by Daniel Bünzli, David -- Allsopp, Andreas Rossberg, Xavier Leroy, report by Andreas Rossberg) -- --- #13130: minor fixes to pprintast for raw identifiers and local module open -- syntax for types. -- (Chet Murthy, review by Gabriel Scherer) -- --### Type system: -- --- #12313, #11799: Do not re-build as-pattern type when a ground type annotation -- is given. This allows to work around problems with GADTs in as-patterns. -- (Jacques Garrigue, report by Leo White, review by Gabriel Scherer) -- - ### Runtime system: - - - #12193: Re-introduce GC compaction for shared pools -@@ -76,6 +22,12 @@ OCaml 5.2.0 - David Allsopp, Miod Vallat, Artem Pianykh, Stephen Dolan, Mark Shinwell - and KC Sivaramakrishnan) - -+- #12114: Add ThreadSanitizer support -+ (Fabrice Buoro and Olivier Nicole, based on an initial work by Anmol Sahoo, -+ review by Damien Doligez, Sébastien Hinderer, Jacques-Henri Jourdan, Luc -+ Maranget, Guillaume Munch-Maccagnoni, Gabriel Scherer) -+ -+ - - #12850: Update Gc.quick_stat data at the end of major cycles and compaction - This PR adds an additional caml_collect_gc_stats_sample_stw to the major heap - cycling stw. This means that Gc.quick_stat now actually reflects the state of -@@ -148,11 +100,6 @@ OCaml 5.2.0 - arise at specific locations during domain creation and shutdown. - (Guillaume Munch-Maccagnoni, review by Gabriel Scherer) - --- #12114: Add ThreadSanitizer support -- (Fabrice Buoro and Olivier Nicole, based on an initial work by Anmol Sahoo, -- review by Damien Doligez, Sébastien Hinderer, Jacques-Henri Jourdan, Luc -- Maranget, Guillaume Munch-Maccagnoni, Gabriel Scherer) -- - - #11911, #12381: Restore statmemprof functionality in part, with - some API changes in Gc.Memprof. - (Nick Barnes, review by Jacques-Henri Jourdan -@@ -264,34 +211,48 @@ OCaml 5.2.0 - (Olivier Nicole, suggested by Stephen Dolan, review by Gabriel Scherer, - Miod Vallat and Damien Doligez) - --### Code generation and optimizations: -+### Language features: - --- #11239: on x86-64 and RISC-V, reduce alignment of OCaml stacks from 16 to 8. -- This reduces stack usage. It's only C stacks that require 16-alignment. -- (Xavier Leroy, review by Gabriel Scherer and Stephen Dolan) -+- #12295, #12568: Give `while true' a polymorphic type, similarly to -+ `assert false' -+ (Jeremy Yallop, review by Nicolás Ojeda Bär and Gabriel Scherer, -+ suggestion by Rodolphe Lepigre and John Whitington) - --- #12311: on POWER, 32-bit FP numbers stored in memory (e.g. in bigarrays) -- were not correctly rounded sometimes. -- (Xavier Leroy, review by Anil Madhavapeddy and Tim McGilchrist) -+- #12044: Add local module open syntax for types. -+ ``` -+ module A = struct -+ type t = int -+ type r = unit -+ type s = string -+ end - --- #12551, #12608, #12782, #12596: Overhaul of recursive value compilation. -- Non-function recursive bindings are now forbidden from Lambda onwards, -- and compiled using a new Value_rec_compiler module. -- (Vincent Laviron and Lunia Ayanides, review by Gabriel Scherer, -- Stefan Muenzel and Nathanaëlle Courant) -+ type example = A.(t * r * s) -+ ``` -+ (Alistair O'Brien, review by Gabriel Scherer, Nicolás Ojeda Bär -+ and Florian Angeletti) - --- #1809, #12181: rewrite `compare x y op 0` to `x op y` when values are integers -- (Xavier Clerc, Stefan Muenzel, review by Gabriel Scherer and Vincent Laviron) -+- #11252, RFC 27: Support raw identifier syntax \#foo -+ (Stephen Dolan, review by David Allsopp, Gabriel Scherer and Olivier Nicole) - --- #12825: disable common subexpression elimination for atomic loads... again. -- (Gabriel Scherer, review by KC Sivaramakrishnan, Xavier Leroy -- and Vincent Laviron, report by Vesa Karvonen) -+ -+- #12315: Use type annotations from arguments in let rec -+ (Stephen Dolan, review by Gabriel Scherer) -+ -+- #12375: allow use of [@untagged] for all immediate types like char, bool, -+ and variant with only constant constructors. -+ (Christophe Raffalli, review by Gabriel Scherer) -+ -+* #12502: the compiler now normalizes the newline sequence \r\n to -+ a single \n character during lexing, to guarantee that the semantics -+ of newlines in string literals is not modified by Windows tools -+ transforming \n into \r\n in source files. -+ Warning 29 [eol-in-string] is not emitted anymore, as the normalization -+ gives a more robust semantics to newlines in string literals. -+ (Gabriel Scherer and Damien Doligez, review by Daniel Bünzli, David -+ Allsopp, Andreas Rossberg, Xavier Leroy, report by Andreas Rossberg) - - ### Standard library: - --- #12716: Add `Format.pp_print_nothing` function. -- (Léo Andrès, review by Gabriel Scherer and Nicolás Ojeda Bär) -- - - #11563: Add the Dynarray module to the stdlib. Dynamic arrays are - arrays whose length can be changed by adding or removing elements at - the end, similar to 'vectors' in C++ or Rust. -@@ -299,6 +260,10 @@ OCaml 5.2.0 - Daniel Bünzli, Guillaume Munch-Maccagnoni, Clément Allain, - Damien Doligez, Wiktor Kuchta and Pieter Goetschalckx) - -+ -+- #12716: Add `Format.pp_print_nothing` function. -+ (Léo Andrès, review by Gabriel Scherer and Nicolás Ojeda Bär) -+ - * #6732, #12423: Make Buffer.add_substitute surjective and fix its - documentation. - (Damien Doligez, review by Antonin Décimo) -@@ -380,6 +345,35 @@ OCaml 5.2.0 - C API. - (David Allsopp, review by Nicolás Ojeda Bär and Xavier Leroy) - -+### Type system: -+ -+- #12313, #11799: Do not re-build as-pattern type when a ground type annotation -+ is given. This allows to work around problems with GADTs in as-patterns. -+ (Jacques Garrigue, report by Leo White, review by Gabriel Scherer) -+ -+### Code generation and optimizations: -+ -+- #11239: on x86-64 and RISC-V, reduce alignment of OCaml stacks from 16 to 8. -+ This reduces stack usage. It's only C stacks that require 16-alignment. -+ (Xavier Leroy, review by Gabriel Scherer and Stephen Dolan) -+ -+- #12311: on POWER, 32-bit FP numbers stored in memory (e.g. in bigarrays) -+ were not correctly rounded sometimes. -+ (Xavier Leroy, review by Anil Madhavapeddy and Tim McGilchrist) -+ -+- #12551, #12608, #12782, #12596: Overhaul of recursive value compilation. -+ Non-function recursive bindings are now forbidden from Lambda onwards, -+ and compiled using a new Value_rec_compiler module. -+ (Vincent Laviron and Lunia Ayanides, review by Gabriel Scherer, -+ Stefan Muenzel and Nathanaëlle Courant) -+ -+- #1809, #12181: rewrite `compare x y op 0` to `x op y` when values are integers -+ (Xavier Clerc, Stefan Muenzel, review by Gabriel Scherer and Vincent Laviron) -+ -+- #12825: disable common subexpression elimination for atomic loads... again. -+ (Gabriel Scherer, review by KC Sivaramakrishnan, Xavier Leroy -+ and Vincent Laviron, report by Vesa Karvonen) -+ - ### Other libraries: - - - #12213: Dynlink library, improve legibility of error messages -@@ -390,98 +384,14 @@ OCaml 5.2.0 - instead of `value`. - (Xavier Leroy, review by David Allsopp) - --### Tools: -- --- #12340: testsuite: collect known issues with current -short-paths -- implementation for existential types -- (Florian Angeletti, Samuel Hym, review by Florian Angeletti and Thomas Refis) -- --- #12147: ocamllex: Allow carriage returns at the end of line directives. -- (SeungCheol Jung, review by Nicolás Ojeda Bär) -- --- #12260: Fix invalid_argument on some external or module aliases in ocamlnat -- (Fabian Hemmer, review by Vincent Laviron) -- --- #12185: New script language for ocamltest. -- (Damien Doligez with Florian Angeletti, Sébastien Hinderer, Gabriel Scherer, -- review by Sébastien Hinderer and Gabriel Scherer) -- --- #12371: ocamltest: fix recursive expansion of variables. -- (Antonin Décimo, Damien Doligez, review by Sébastien Hinderer, -- Damien Doligez, Gabriel Scherer, and Xavier Leroy) -- --* #12497, #12613: Make ocamlc/ocamlopt fail with an error when no -- input files are specified to build an executable. -- (Antonin Décimo, review by Sébastien Hinderer) -- --- #12576: ocamldep: various refactors. -- (Antonin Décimo, review by Florian Angeletti, Gabriel Scherer, and Léo Andrès) -- --- #12615: ocamldoc: get rid of the odoc_literate and odoc_todo generators. -- (Sébaistien Hinderer, review by Gabriel Scherer and Florian Angeletti) -- --- #12624: Use $XDG_CONFIG_DIRS in addition to $XDG_CONFIG_HOME when searching -- for init.ml and use this to extend init.ml support to the toplevel when -- running on Windows. -- (David Allsopp, report by Jonah Beckford, review by Nicolás Ojeda Bär and -- Antonin Décimo) -- --- #12688: Setting the env variable `NO_COLOR` with an empty value no longer -- has effects. Previously, setting `NO_COLOR` with any value, including -- the empty value, would disable colors (unless `OCAML_COLOR` is also set). -- After this change, the user must set `NO_COLOR` with an non-empty value -- to disable colors. This reflects a specification clarification/change -- from the upstream website at https://no-color.org. -- (Favonia, review by Gabriel Scherer) -- --- #12744: ocamltest: run tests in recursive subdirs more eagerly -- (Nick Roberts, review by Nicolás Ojeda Bär) -- --- #12901, 12908: ocamllex: add overflow checks to prevent generating incorrect -- lexers; use unsigned numbers in the table encoding when possible. -- (Vincent Laviron, report by Edwin Török, review by Xavier Leroy) -- --### Manual and documentation: -- --- #12338: clarification of the documentation of process related function in -- the unix module regarding the first element of args and shell's pid. -- (Christophe Raffalli, review by Florian Angeletti) -- --- #12473: Document in runtime/memory.c our current understanding of -- accesses to the OCaml heap from the C runtime code -- the problem -- of hybrid programs mixing two memory models. -- (Gabriel Scherer and Guillaume Munch-Maccagnoni, review by Olivier -- Nicole and Xavier Leroy) -- --- #12694: Document in runtime/tsan.c the TSan instrumentation choices and the -- consequences with regard to the memory model. -- (Olivier Nicole, review by Miod Vallat, Gabriel Scherer, Guillaume -- Munch-Maccagnoni and Fabrice Buoro) -- --- #12802: Add manual chapter about ThreadSanitizer support -- (Olivier Nicole, review by Miod Vallat, Sebastien Hinderer, Fabrice Buoro, -- Gabriel Scherer and KC Sivaramakrishnan) -- --- #12819: Clarify which runtime interactions are allowed in custom ops -- (Basile Clément, review by Guillaume Munch-Maccagnoni and Xavier Leroy) -- --- #12840: manual: update runtime tracing chapter for custom events (ex #12335) -- (Lucas Pluvinage, Sadiq Jaffer and Olivier Nicole, review by Gabriel Scherer, -- David Allsopp, Tim McGilchrist and Thomas Leonard) -- --- #13066, update OCAMLRUNPARAM documentation for the stack size parameter l -- (Florian Angeletti, review by Nicolás Ojeda Bär, Tim McGilchrist, and -- Miod Vallat) -- --- #13078: update Format tutorial on structural boxes to mention alignment -- questions. -- (Edwin Török, review by Florian Angeletti) -- --- #13092: document the existence of the `[@@poll error]` built-in attribute -- (Florian Angeletti, review by Gabriel Scherer) -- - ### Compiler user-interface and warnings: - -+- #11989, #12246, RFC 31: New flag, -H, to allow for transitive dependencies -+ without including them in the initial environment. -+ (Chris Casinghino, François Bobot, and Gabriel Scherer, review by Leo White -+ and Stefan Muenzel, RFC by François Bobot) -+ -+ - * #10613, #12405: Simplify the values used for the system variable (`system:` in - `ocamlopt -config` or the `Config.system` constant). In particular, s390x and - ppc64 now report "linux" instead of "elf"; all variants of 32-bit ARM on Linux -@@ -493,11 +403,6 @@ OCaml 5.2.0 - (David Allsopp, request by Kate Deplaix, review by Sébastien Hinderer and - Xavier Leroy) - --- #11989, #12246, RFC 31: New flag, -H, to allow for transitive dependencies -- without including them in the initial environment. -- (Chris Casinghino, François Bobot, and Gabriel Scherer, review by Leo White -- and Stefan Muenzel, RFC by François Bobot) -- - - #12247: configure: --disable-ocamldebug can now be used instead - of --disable-debugger (which remains available for compatibility) - (Gabriel Scherer, review by Damien Doligez and Sébastien Hinderer) -@@ -546,9 +451,125 @@ OCaml 5.2.0 - - * #12942: Fix an line ordering in some module inclusion error messages - (Nick Roberts, review by Florian Angeletti, report by Carl Eastlund) -+### Manual and documentation: -+ -+- #12338: clarification of the documentation of process related function in -+ the unix module regarding the first element of args and shell's pid. -+ (Christophe Raffalli, review by Florian Angeletti) -+ -+- #12473: Document in runtime/memory.c our current understanding of -+ accesses to the OCaml heap from the C runtime code -- the problem -+ of hybrid programs mixing two memory models. -+ (Gabriel Scherer and Guillaume Munch-Maccagnoni, review by Olivier -+ Nicole and Xavier Leroy) -+ -+- #12456: Document the incompatibility between effects on the one -+ hand, and `caml_callback` and asynchronous callbacks (signal -+ handlers, finalisers, memprof callbacks...) on the other hand. -+ (Guillaume Munch-Maccagnoni, review by KC Sivaramakrishnan) -+ -+- #12694: Document in runtime/tsan.c the TSan instrumentation choices and the -+ consequences with regard to the memory model. -+ (Olivier Nicole, review by Miod Vallat, Gabriel Scherer, Guillaume -+ Munch-Maccagnoni and Fabrice Buoro) -+ -+- #12802: Add manual chapter about ThreadSanitizer support -+ (Olivier Nicole, review by Miod Vallat, Sebastien Hinderer, Fabrice Buoro, -+ Gabriel Scherer and KC Sivaramakrishnan) -+ -+- #12819: Clarify which runtime interactions are allowed in custom ops -+ (Basile Clément, review by Guillaume Munch-Maccagnoni and Xavier Leroy) -+ -+- #12840: manual: update runtime tracing chapter for custom events (ex #12335) -+ (Lucas Pluvinage, Sadiq Jaffer and Olivier Nicole, review by Gabriel Scherer, -+ David Allsopp, Tim McGilchrist and Thomas Leonard) -+ -+- #13066, update OCAMLRUNPARAM documentation for the stack size parameter l -+ (Florian Angeletti, review by Nicolás Ojeda Bär, Tim McGilchrist, and -+ Miod Vallat) -+ -+- #13078: update Format tutorial on structural boxes to mention alignment -+ questions. -+ (Edwin Török, review by Florian Angeletti) -+ -+- #13092: document the existence of the `[@@poll error]` built-in attribute -+ (Florian Angeletti, review by Gabriel Scherer) -+ -+### Tools: -+ -+- #12340: testsuite: collect known issues with current -short-paths -+ implementation for existential types -+ (Florian Angeletti, Samuel Hym, review by Florian Angeletti and Thomas Refis) -+ -+- #12147: ocamllex: Allow carriage returns at the end of line directives. -+ (SeungCheol Jung, review by Nicolás Ojeda Bär) -+ -+- #12260: Fix invalid_argument on some external or module aliases in ocamlnat -+ (Fabian Hemmer, review by Vincent Laviron) -+ -+- #12185: New script language for ocamltest. -+ (Damien Doligez with Florian Angeletti, Sébastien Hinderer, Gabriel Scherer, -+ review by Sébastien Hinderer and Gabriel Scherer) -+ -+- #12371: ocamltest: fix recursive expansion of variables. -+ (Antonin Décimo, Damien Doligez, review by Sébastien Hinderer, -+ Damien Doligez, Gabriel Scherer, and Xavier Leroy) -+ -+* #12497, #12613: Make ocamlc/ocamlopt fail with an error when no -+ input files are specified to build an executable. -+ (Antonin Décimo, review by Sébastien Hinderer) -+ -+- #12576: ocamldep: various refactors. -+ (Antonin Décimo, review by Florian Angeletti, Gabriel Scherer, and Léo Andrès) -+ -+- #12615: ocamldoc: get rid of the odoc_literate and odoc_todo generators. -+ (Sébaistien Hinderer, review by Gabriel Scherer and Florian Angeletti) -+ -+- #12624: Use $XDG_CONFIG_DIRS in addition to $XDG_CONFIG_HOME when searching -+ for init.ml and use this to extend init.ml support to the toplevel when -+ running on Windows. -+ (David Allsopp, report by Jonah Beckford, review by Nicolás Ojeda Bär and -+ Antonin Décimo) -+ -+- #12688: Setting the env variable `NO_COLOR` with an empty value no longer -+ has effects. Previously, setting `NO_COLOR` with any value, including -+ the empty value, would disable colors (unless `OCAML_COLOR` is also set). -+ After this change, the user must set `NO_COLOR` with an non-empty value -+ to disable colors. This reflects a specification clarification/change -+ from the upstream website at https://no-color.org. -+ (Favonia, review by Gabriel Scherer) -+ -+- #12744: ocamltest: run tests in recursive subdirs more eagerly -+ (Nick Roberts, review by Nicolás Ojeda Bär) -+ -+- #12901, 12908: ocamllex: add overflow checks to prevent generating incorrect -+ lexers; use unsigned numbers in the table encoding when possible. -+ (Vincent Laviron, report by Edwin Török, review by Xavier Leroy) - - ### Internal/compiler-libs changes: - -+- #12508 : Add compiler-side support for project-wide occurrences in Merlin, by -+ generating index tables of all identifier occurrences. This extra data in .cmt -+ files is only added when the new flag -bin-annot-occurrences is passed. -+ (Ulysse Gérard, Nathanaëlle Courant, suggestions by Gabriel Scherer and Thomas -+ Refis, review by Florian Angeletti, Gabriel Scherer and Thomas Refis) -+ -+- #12236, #12386, #12391, #12496, #12673: Use syntax as sole determiner of arity -+ This changes function arity to be based solely on the source program's -+ parsetree. Previously, the heuristic for arity had more subtle heuristics -+ that involved type information about patterns. Function arity is important -+ because it determines when a pattern match's effects run and is an input -+ into the fast path for function application. -+ -+ This change affects tooling: it changes the function constructs in parsetree -+ and typedtree. -+ -+ See https://github.com/ocaml/RFCs/pull/32 for the original RFC. -+ -+ (Nick Roberts; review by Richard Eisenberg, Leo White, and Gabriel Scherer; -+ RFC by Stephen Dolan) -+ -+ - - #12639: parsing: Attach a location to the RHS of Ptyp_alias - and improve the 'alias type mismatch' error message. - (Jules Aguillon, review by Florian Angeletti) -@@ -583,21 +604,6 @@ OCaml 5.2.0 - in Typecore in favor of local mutable state. - (Nick Roberts, review by Takafumi Saikawa) - --- #12236, #12386, #12391, #12496, #12673: Use syntax as sole determiner of arity -- This changes function arity to be based solely on the source program's -- parsetree. Previously, the heuristic for arity had more subtle heuristics -- that involved type information about patterns. Function arity is important -- because it determines when a pattern match's effects run and is an input -- into the fast path for function application. -- -- This change affects tooling: it changes the function constructs in parsetree -- and typedtree. -- -- See https://github.com/ocaml/RFCs/pull/32 for the original RFC. -- -- (Nick Roberts; review by Richard Eisenberg, Leo White, and Gabriel Scherer; -- RFC by Stephen Dolan) -- - - #12542: Minor bugfix to #12236: restore dropped call to `instance` - (Nick Roberts, review by Jacques Garrigue) - -@@ -650,12 +656,6 @@ OCaml 5.2.0 - - #12764: Move all installable headers in `caml/` sub-directories. - (Antonin Décimo, review by Gabriel Scherer and David Allsopp) - --- #12508 : Add compiler-side support for project-wide occurrences in Merlin, by -- generating index tables of all identifier occurrences. This extra data in .cmt -- files is only added when the new flag -bin-annot-occurrences is passed. -- (Ulysse Gérard, Nathanaëlle Courant, suggestions by Gabriel Scherer and Thomas -- Refis, review by Florian Angeletti, Gabriel Scherer and Thomas Refis) -- - - #12914: Slightly change the s390x assembly dialect in order to build with - Clang's integrated assembler. - (Miod Vallat, review by Gabriel Scherer) -@@ -888,6 +888,10 @@ OCaml 5.2.0 - - #13094: Fix undefined behavior of left-shifting a negative number. - (Antonin Décimo, review by Miod Vallat and Nicolás Ojeda Bär) - -+- #13130: minor fixes to pprintast for raw identifiers and local module open -+ syntax for types. -+ (Chet Murthy, review by Gabriel Scherer) -+ - OCaml 5.1.1 (8 December 2023) - ---------------------------- - --- -2.44.0 - diff --git a/0004-configure-Allow-user-defined-C-compiler-flags.patch b/0002-configure-Allow-user-defined-C-compiler-flags.patch similarity index 64% rename from 0004-configure-Allow-user-defined-C-compiler-flags.patch rename to 0002-configure-Allow-user-defined-C-compiler-flags.patch index 3c14867..9894bc3 100644 --- a/0004-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0002-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,7 +1,7 @@ From edd903fc73b98eb784b307a47110985967cb1d09 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 4/7] configure: Allow user defined C compiler flags. +Subject: [PATCH 2/2] configure: Allow user defined C compiler flags. --- configure.ac | 8 ++++++-- @@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac index 48aa9f0a29..fc29c88f50 100644 --- a/configure.ac +++ b/configure.ac -@@ -869,6 +869,10 @@ AS_CASE([$ocaml_cc_vendor], +@@ -925,6 +925,10 @@ AS_CASE([$ocaml_cc_vendor], internal_cflags="$cc_warnings"], [common_cflags="-O"]) @@ -22,7 +22,7 @@ index 48aa9f0a29..fc29c88f50 100644 # Enable SSE2 on x86 mingw to avoid using 80-bit registers. AS_CASE([$host], [i686-*-mingw32*], -@@ -2648,7 +2652,7 @@ AC_CONFIG_COMMANDS_PRE([ +@@ -2708,7 +2712,7 @@ AC_CONFIG_COMMANDS_PRE([ [mkexedebugflag="${mkexe_ldflags_prefix}${mkexedebugflag}"]) mkdll_ldflags="" AS_IF([test -n "${LDFLAGS}"], @@ -31,15 +31,5 @@ index 48aa9f0a29..fc29c88f50 100644 mkdll_ldflags="${mkdll_ldflags} ${mkexe_ldflags_prefix}${flag}" done mkdll_ldflags_exp="$mkdll_ldflags"]) -@@ -2674,7 +2678,7 @@ ${mkdll_ldflags}" - ],[ - mkdll_ldflags='$(OC_DLL_LDFLAGS) $(LDFLAGS)' - mkdll_ldflags_exp="${oc_dll_ldflags}" -- AS_IF([test -n ${LDFLAGS}], -+ AS_IF([test -n "${LDFLAGS}"], - [mkdll_ldflags_exp="$mkdll_ldflags_exp $LDFLAGS"]) - mkexe_ldflags="\$(OC_LDFLAGS) \$(LDFLAGS)" - mkexe_ldflags_exp="${oc_ldflags} ${LDFLAGS}" -- 2.44.0 - diff --git a/0005-flambda-Improve-transitive-closure-in-invariant_para.patch b/0005-flambda-Improve-transitive-closure-in-invariant_para.patch deleted file mode 100644 index b0b347c..0000000 --- a/0005-flambda-Improve-transitive-closure-in-invariant_para.patch +++ /dev/null @@ -1,114 +0,0 @@ -From acdc441ff1acb5390467e649bc9a9bfddd7df774 Mon Sep 17 00:00:00 2001 -From: Florian Weimer -Date: Thu, 9 May 2024 10:03:23 +0200 -Subject: [PATCH 5/7] flambda: Improve transitive closure in - invariant_params_in_recursion (#13150) - -The old implementation did not really exploit the sparseness of the -graph because it used newly discovered edges in later iterations. -The new implementation processes each original relation only once -per starting node, and does not re-process newly discovered relations. - -(cherry picked from commit 787b4fbb5aaf3728de54ca240ba9ca0bf56ace60) ---- - Changes | 5 ++ - middle_end/flambda/invariant_params.ml | 66 ++++++++++---------------- - 2 files changed, 31 insertions(+), 40 deletions(-) - -diff --git a/Changes b/Changes -index 75842fc216..d26512067d 100644 ---- a/Changes -+++ b/Changes -@@ -1,6 +1,11 @@ - OCaml 5.2.0 (13 May 2024) - ------------------------- - -+- #13150: improve a transitive-closure computation algorithm in the flambda -+ middle-end to avoid a compilation time blowup on Menhir-generated code -+ (Florian Weimer, review by Gabriel Scherer and Pierre Chambart, -+ report by Richard Jones) -+ - (Changes that can break existing programs are marked with a "*") - - ### Restored and new backends: -diff --git a/middle_end/flambda/invariant_params.ml b/middle_end/flambda/invariant_params.ml -index 414d39310a..dba63970fd 100644 ---- a/middle_end/flambda/invariant_params.ml -+++ b/middle_end/flambda/invariant_params.ml -@@ -65,47 +65,33 @@ let implies relation from to_ = - relation - - let transitive_closure state = -- let union s1 s2 = -- match s1, s2 with -- | Top, _ | _, Top -> Top -- | Implication s1, Implication s2 -> -- Implication (Variable.Pair.Set.union s1 s2) -+ (* Depth-first search for all implications for one argument. -+ Arguments are moved from candidate to frontier, assuming -+ they are newly added to the result. *) -+ let rec loop candidate frontier result = -+ match (candidate, frontier) with -+ | ([], []) -> Implication result -+ | ([], frontier::fs) -> -+ (* Obtain fresh candidate for the frontier argument. *) -+ (match Variable.Pair.Map.find frontier state with -+ | exception Not_found -> loop [] fs result -+ | Top -> Top -+ | Implication candidate -> -+ loop (Variable.Pair.Set.elements candidate) fs result) -+ | (candidate::cs, frontier) -> -+ let result' = Variable.Pair.Set.add candidate result in -+ if result' != result then -+ (* Result change means candidate becomes part of frontier. *) -+ loop cs (candidate :: frontier) result' -+ else -+ loop cs frontier result - in -- let equal s1 s2 = -- match s1, s2 with -- | Top, Implication _ | Implication _, Top -> false -- | Top, Top -> true -- | Implication s1, Implication s2 -> Variable.Pair.Set.equal s1 s2 -- in -- let update arg state = -- let original_set = -- try Variable.Pair.Map.find arg state with -- | Not_found -> Implication Variable.Pair.Set.empty -- in -- match original_set with -- | Top -> state -- | Implication arguments -> -- let set = -- Variable.Pair.Set.fold -- (fun orig acc-> -- let set = -- try Variable.Pair.Map.find orig state with -- | Not_found -> Implication Variable.Pair.Set.empty in -- union set acc) -- arguments original_set -- in -- Variable.Pair.Map.add arg set state -- in -- let once state = -- Variable.Pair.Map.fold (fun arg _ state -> update arg state) state state -- in -- let rec fp state = -- let state' = once state in -- if Variable.Pair.Map.equal equal state state' -- then state -- else fp state' -- in -- fp state -+ Variable.Pair.Map.map -+ (fun set -> -+ match set with -+ | Top -> Top -+ | Implication set -> loop [] (Variable.Pair.Set.elements set) set) -+ state - - (* CR-soon pchambart: to move to Flambda_utils and document - mshinwell: I think this calculation is basically the same as --- -2.44.0 - diff --git a/0006-Reload-exception-pointer-register-in-caml_c_call.patch b/0006-Reload-exception-pointer-register-in-caml_c_call.patch deleted file mode 100644 index 4c20a85..0000000 --- a/0006-Reload-exception-pointer-register-in-caml_c_call.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 8637cac022907501c3c0d941e07e436b70c9d4ac Mon Sep 17 00:00:00 2001 -From: Miod Vallat <118974489+dustanddreams@users.noreply.github.com> -Date: Thu, 30 May 2024 09:57:41 +0000 -Subject: [PATCH 6/7] Reload exception pointer register in caml_c_call* - -The invoked code may end up causing caml_try_realloc_stack() to be invoked, -which in turn may replace the stack TRAP_PTR points to, leading to -either crashes with the debug runtime (thanks to the old stack contents -being overwritten) or all kinds of memory or control flow corruption otherwise. - -Added test for stack reallocation in callback followed by exception raising. - -(cherry picked from commit 6964d3a90f84402ed6066fb1821679435e063067) -(cherry picked from commit 1e8a91d305f1fa4668444fb1cce97952dbc39810) ---- - Changes | 9 +++++++++ - runtime/arm64.S | 6 ++++-- - runtime/power.S | 6 ++++-- - runtime/riscv.S | 6 ++++-- - runtime/s390x.S | 5 +++-- - testsuite/tests/callback/test1.ml | 5 +++++ - 6 files changed, 29 insertions(+), 8 deletions(-) - -diff --git a/Changes b/Changes -index d26512067d..53bb5369b9 100644 ---- a/Changes -+++ b/Changes -@@ -1,3 +1,12 @@ -+OCaml 5.2 maintenance version -+----------------------------- -+ -+- #13207: Be sure to reload the register caching the exception handler in -+ caml_c_call and caml_c_call_stack_args, as its value may have been changed -+ if the OCaml stack is expanded during a callback. -+ (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and -+ Xavier Leroy) -+ - OCaml 5.2.0 (13 May 2024) - ------------------------- - -diff --git a/runtime/arm64.S b/runtime/arm64.S -index e71f25ebba..6c6495a0a8 100644 ---- a/runtime/arm64.S -+++ b/runtime/arm64.S -@@ -569,8 +569,9 @@ FUNCTION(caml_c_call) - str TRAP_PTR, Caml_state(exn_handler) - /* Call the function */ - blr ADDITIONAL_ARG -- /* Reload alloc ptr */ -+ /* Reload new allocation pointer & exn handler */ - ldr ALLOC_PTR, Caml_state(young_ptr) -+ ldr TRAP_PTR, Caml_state(exn_handler) - /* Load ocaml stack */ - SWITCH_C_TO_OCAML - #if defined(WITH_THREAD_SANITIZER) -@@ -625,8 +626,9 @@ FUNCTION(caml_c_call_stack_args) - blr ADDITIONAL_ARG - /* Restore stack */ - mov sp, x19 -- /* Reload alloc ptr */ -+ /* Reload new allocation pointer & exn handler */ - ldr ALLOC_PTR, Caml_state(young_ptr) -+ ldr TRAP_PTR, Caml_state(exn_handler) - /* Switch from C to OCaml */ - SWITCH_C_TO_OCAML - /* Return */ -diff --git a/runtime/power.S b/runtime/power.S -index bfb37fa989..257678100e 100644 ---- a/runtime/power.S -+++ b/runtime/power.S -@@ -445,8 +445,9 @@ FUNCTION caml_c_call - mr 2, C_CALL_TOC /* restore current TOC */ - /* Restore return address (in register C_CALL_RET_ADDR, preserved by C) */ - mtlr C_CALL_RET_ADDR -- /* Reload allocation pointer*/ -+ /* Reload new allocation pointer and exception pointer */ - ld ALLOC_PTR, Caml_state(young_ptr) -+ ld TRAP_PTR, Caml_state(exn_handler) - #if defined(WITH_THREAD_SANITIZER) - TSAN_SETUP_C_CALL 16 - /* Save return value registers. Since the called function could be anything, -@@ -497,8 +498,9 @@ FUNCTION caml_c_call_stack_args - add SP, SP, STACK_ARG_BYTES - /* Restore return address (in register C_CALL_RET_ADDR, preserved by C) */ - mtlr C_CALL_RET_ADDR -- /* Reload allocation pointer*/ -+ /* Reload new allocation pointer and exception pointer */ - ld ALLOC_PTR, Caml_state(young_ptr) -+ ld TRAP_PTR, Caml_state(exn_handler) - /* Switch from C to OCaml */ - SWITCH_C_TO_OCAML - /* Return to caller */ -diff --git a/runtime/riscv.S b/runtime/riscv.S -index a2eca7a315..8934db0bb3 100644 ---- a/runtime/riscv.S -+++ b/runtime/riscv.S -@@ -516,8 +516,9 @@ L(caml_c_call): - sd TRAP_PTR, Caml_state(exn_handler) - /* Call the function */ - jalr ADDITIONAL_ARG -- /* Reload alloc ptr */ -+ /* Reload new allocation pointer & exn handler */ - ld ALLOC_PTR, Caml_state(young_ptr) -+ ld TRAP_PTR, Caml_state(exn_handler) - /* Load ocaml stack */ - SWITCH_C_TO_OCAML - #if defined(WITH_THREAD_SANITIZER) -@@ -575,8 +576,9 @@ FUNCTION(caml_c_call_stack_args) - jalr ADDITIONAL_ARG - /* Restore stack */ - mv sp, s2 -- /* Reload alloc ptr */ -+ /* Reload new allocation pointer & exn handler */ - ld ALLOC_PTR, Caml_state(young_ptr) -+ ld TRAP_PTR, Caml_state(exn_handler) - /* Switch from C to OCaml */ - SWITCH_C_TO_OCAML - /* Return */ -diff --git a/runtime/s390x.S b/runtime/s390x.S -index b59822ce57..113831a376 100644 ---- a/runtime/s390x.S -+++ b/runtime/s390x.S -@@ -515,7 +515,7 @@ LBL(caml_c_call): - #endif - basr %r14, ADDITIONAL_ARG - CLEANUP_AFTER_C_CALL -- /* Reload alloc ptr */ -+ /* Reload new allocation pointer & exn handler */ - lg ALLOC_PTR, Caml_state(young_ptr) - lg TRAP_PTR, Caml_state(exn_handler) - /* Load ocaml stack and restore global variables */ -@@ -584,8 +584,9 @@ LBL(106): - CLEANUP_AFTER_C_CALL - /* Restore stack */ - lgr %r15, %r12 -- /* Reload alloc ptr */ -+ /* Reload new allocation pointer & exn handler */ - lg ALLOC_PTR, Caml_state(young_ptr) -+ lg TRAP_PTR, Caml_state(exn_handler) - /* Switch from C to OCaml */ - SWITCH_C_TO_OCAML - /* Return */ -diff --git a/testsuite/tests/callback/test1.ml b/testsuite/tests/callback/test1.ml -index c39be0c586..f6ad4356cf 100644 ---- a/testsuite/tests/callback/test1.ml -+++ b/testsuite/tests/callback/test1.ml -@@ -11,6 +11,9 @@ external mycallback3 : ('a -> 'b -> 'c -> 'd) -> 'a -> 'b -> 'c -> 'd - external mycallback4 : - ('a -> 'b -> 'c -> 'd -> 'e) -> 'a -> 'b -> 'c -> 'd -> 'e = "mycallback4" - -+let rec growstack n = -+ if n <= 0 then 0 else 1 + growstack (n - 1) -+ - let rec tak (x, y, z as _tuple) = - if x > y then tak(tak (x-1, y, z), tak (y-1, z, x), tak (z-1, x, y)) - else z -@@ -46,3 +49,5 @@ let _ = - print_int(trapexit ()); print_newline(); - print_string(tripwire mypushroot); print_newline(); - print_string(tripwire mycamlparam); print_newline(); -+ begin try ignore (mycallback1 growstack 1_000); raise Exit -+ with Exit -> () end --- -2.44.0 - diff --git a/0007-Compute-more-accurate-instruction-sizes-for-branch-r.patch b/0007-Compute-more-accurate-instruction-sizes-for-branch-r.patch deleted file mode 100644 index e9dd879..0000000 --- a/0007-Compute-more-accurate-instruction-sizes-for-branch-r.patch +++ /dev/null @@ -1,178 +0,0 @@ -From 4eb80b13779125fcd76a445ab0004ca064fab634 Mon Sep 17 00:00:00 2001 -From: Miod Vallat -Date: Fri, 7 Jun 2024 06:19:45 +0000 -Subject: [PATCH 7/7] Compute more accurate instruction sizes for branch - relaxation. - -(cherry picked from commit 114ddae2d4c85391a4f939dc6623424ae35a07aa) ---- - Changes | 4 ++ - asmcomp/power/emit.mlp | 87 ++++++++++++++++++++++++------------------ - 2 files changed, 53 insertions(+), 38 deletions(-) - -diff --git a/Changes b/Changes -index 53bb5369b9..1a81509247 100644 ---- a/Changes -+++ b/Changes -@@ -7,6 +7,10 @@ OCaml 5.2 maintenance version - (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and - Xavier Leroy) - -+- #13221: Compute more accurate instruction sizes for branch relocation on -+ POWER. -+ (Miod Vallat, review by Gabriel Scherer) -+ - OCaml 5.2.0 (13 May 2024) - ------------------------- - -diff --git a/asmcomp/power/emit.mlp b/asmcomp/power/emit.mlp -index 47f5419a92..fdf22996fa 100644 ---- a/asmcomp/power/emit.mlp -+++ b/asmcomp/power/emit.mlp -@@ -177,6 +177,28 @@ let emit_tocload emit_dest dest entry = - - (* Output a load or store operation *) - -+let load_mnemonic = function -+ | Byte_unsigned -> "lbz" -+ | Byte_signed -> "lbz" -+ | Sixteen_unsigned -> "lhz" -+ | Sixteen_signed -> "lha" -+ | Thirtytwo_unsigned -> "lwz" -+ | Thirtytwo_signed -> "lwa" -+ | Word_int | Word_val -> "ld" -+ | Single -> "lfs" -+ | Double -> "lfd" -+ -+let store_mnemonic = function -+ | Byte_unsigned | Byte_signed -> "stb" -+ | Sixteen_unsigned | Sixteen_signed -> "sth" -+ | Thirtytwo_unsigned | Thirtytwo_signed -> "stw" -+ | Word_int | Word_val -> "std" -+ | Single -> "stfs" -+ | Double -> "stfd" -+ -+let store_needs_lwsync chunk assignment = -+ assignment && (chunk = Word_int || chunk = Word_val) -+ - let valid_offset instr ofs = - ofs land 3 = 0 || (instr <> "ld" && instr <> "std" && instr <> "lwa") - -@@ -383,11 +405,17 @@ module BR = Branch_relaxation.Make (struct - - let tocload_size = 2 - -- let load_store_size = function -+ let load_store_size instr = function - | Ibased(_s, d) -> -- let (_lo, hi) = low_high_s d in -- tocload_size + (if hi = 0 then 1 else 2) -- | Iindexed ofs -> if is_immediate ofs then 1 else 3 -+ let (lo, hi) = low_high_s d in -+ tocload_size + -+ (if hi <> 0 then 1 else 0) + -+ (if valid_offset instr lo then 1 else 2) -+ | Iindexed ofs -> -+ if is_immediate ofs && valid_offset instr ofs then 1 else begin -+ let (lo, _hi) = low_high_u ofs in -+ if lo <> 0 then 3 else 2 -+ end - | Iindexed2 -> 1 - - let instr_size f = function -@@ -415,16 +443,16 @@ module BR = Branch_relaxation.Make (struct - else if alloc then tocload_size + 2 - else 5 - | Lop(Istackoffset _) -> 1 -- | Lop(Iload {memory_chunk; addressing_mode; _ }) -> -- if memory_chunk = Byte_signed -- then load_store_size addressing_mode + 1 -- else load_store_size addressing_mode -+ | Lop(Iload {memory_chunk; addressing_mode; is_atomic }) -> -+ let loadinstr = load_mnemonic memory_chunk in -+ (if is_atomic then 4 else 0) + -+ (if memory_chunk = Byte_signed then 1 else 0) + -+ load_store_size loadinstr addressing_mode - | Lop(Istore(chunk, addr, assignment)) -> -- (match chunk with -- | Single -> 1 -- | Word_int | Word_val when assignment -> 1 -- | _ -> 0) -- + load_store_size addr -+ let storeinstr = store_mnemonic chunk in -+ (if chunk = Single then 1 else 0) + -+ (if store_needs_lwsync chunk assignment then 1 else 0) + -+ load_store_size storeinstr addr - | Lop(Ialloc _) -> 5 - | Lop(Ispecific(Ialloc_far _)) -> 6 - | Lop(Ipoll { return_label = Some(_) }) -> 5 -@@ -442,12 +470,12 @@ module BR = Branch_relaxation.Make (struct - | Lop(Ispecific(Icheckbound_imm_far _)) -> 3 - | Lop(Iintop_imm _) -> 1 - | Lop(Inegf | Iabsf | Iaddf | Isubf | Imulf | Idivf) -> 1 -- | Lop(Ifloatofint) -> 9 -- | Lop(Iintoffloat) -> 4 -+ | Lop(Ifloatofint) -> 3 -+ | Lop(Iintoffloat) -> 3 - | Lop(Iopaque) -> 0 - | Lop(Ispecific _) -> 1 -- | Lop (Idls_get) -> 1 -- | Lop (Ireturn_addr) -> 1 -+ | Lop(Idls_get) -> 1 -+ | Lop(Ireturn_addr) -> 1 - | Lreloadretaddr -> 2 - | Lreturn -> 2 - | Llabel _ -> 0 -@@ -457,7 +485,7 @@ module BR = Branch_relaxation.Make (struct - 1 + (if lbl0 = None then 0 else 1) - + (if lbl1 = None then 0 else 1) - + (if lbl2 = None then 0 else 1) -- | Lswitch _ -> 5 + tocload_size -+ | Lswitch _ -> 7 + tocload_size - | Lentertrap -> 1 - | Ladjust_trap_depth _ -> 0 - | Lpushtrap _ -> 4 + tocload_size -@@ -705,17 +733,7 @@ let emit_instr env i = - ` addi 1, 1, {emit_int (-n)}\n`; - adjust_stack_offset env n - | Lop(Iload { memory_chunk; addressing_mode; is_atomic }) -> -- let loadinstr = -- match memory_chunk with -- | Byte_unsigned -> "lbz" -- | Byte_signed -> "lbz" -- | Sixteen_unsigned -> "lhz" -- | Sixteen_signed -> "lha" -- | Thirtytwo_unsigned -> "lwz" -- | Thirtytwo_signed -> "lwa" -- | Word_int | Word_val -> "ld" -- | Single -> "lfs" -- | Double -> "lfd" in -+ let loadinstr = load_mnemonic memory_chunk in - if is_atomic then - ` sync\n`; - emit_load_store loadinstr addressing_mode i.arg 0 i.res.(0); -@@ -731,19 +749,12 @@ let emit_instr env i = - ` frsp {emit_reg tmp}, {emit_reg i.arg.(0)}\n`; - emit_load_store "stfs" addr i.arg 1 tmp - | Lop(Istore(chunk, addr, assignment)) -> -- let storeinstr = -- match chunk with -- | Byte_unsigned | Byte_signed -> "stb" -- | Sixteen_unsigned | Sixteen_signed -> "sth" -- | Thirtytwo_unsigned | Thirtytwo_signed -> "stw" -- | Word_int | Word_val -> "std" -- | Single -> assert false -- | Double -> "stfd" in -+ let storeinstr = store_mnemonic chunk in - (* Non-initializing stores need a memory barrier to follow the - Multicore OCaml memory model. Stores of size other than - Word_int and Word_val do not follow the memory model and therefore - do not need a barrier *) -- if assignment && (chunk = Word_int || chunk = Word_val) then -+ if store_needs_lwsync chunk assignment then - ` lwsync\n`; - emit_load_store storeinstr addr i.arg 1 i.arg.(0) - | Lop(Ialloc { bytes; dbginfo }) -> --- -2.44.0 - diff --git a/ocaml.spec b/ocaml.spec index c4b4035..c5c0c05 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -5,7 +5,7 @@ # primitive function declarations, all with "void" for their parameter # list. This does not match the real definitions, leading to lots of # -Wlto-type-mismatch warnings. These change the output of the tests, -# leading to many failed tests. This is still a problem in 5.2. +# leading to many failed tests. This is still a problem in 5.3. %global _lto_cflags %{nil} # OCaml has a bytecode backend that works on anything with a C @@ -45,8 +45,8 @@ ExcludeArch: %{ix86} %global rcver %{nil} Name: ocaml -Version: 5.2.0 -Release: 3%{?dist} +Version: 5.3.0 +Release: 1%{?dist} Summary: OCaml compiler and programming environment @@ -74,30 +74,12 @@ Source2: ocaml_files.py # existing patches unchanged) adding a comment to note that it should # be incorporated into the git repo at a later time. -# Upstream after 5.2.0: -Patch: 0001-Changes-synchronisation-and-consistency-with-trunk.patch -Patch: 0002-Changes-copy-editing.patch - # Fedora-specific patches -Patch: 0003-Don-t-add-rpaths-to-libraries.patch -Patch: 0004-configure-Allow-user-defined-C-compiler-flags.patch - -# Improve performance of flambda optimizer in some cases. Required to -# compiler blow-up in coccinelle package. Upstream, but not included -# in 5.2 branch. -# https://github.com/ocaml/ocaml/pull/13150 -Patch: 0005-flambda-Improve-transitive-closure-in-invariant_para.patch - -# Upstream after 5.2.0: -Patch: 0006-Reload-exception-pointer-register-in-caml_c_call.patch - -# Fix for ppc64le code generation issue found after 5.2.0 was released. -# https://github.com/ocaml/ocaml/issues/13220 -# https://github.com/ocaml/ocaml/commit/114ddae2d4c85391a4f939dc6623424ae35a07aa -Patch: 0007-Compute-more-accurate-instruction-sizes-for-branch-r.patch +Patch: 0001-Don-t-add-rpaths-to-libraries.patch +Patch: 0002-configure-Allow-user-defined-C-compiler-flags.patch BuildRequires: make -BuildRequires: git +BuildRequires: git-core BuildRequires: gcc BuildRequires: autoconf BuildRequires: gawk @@ -135,13 +117,12 @@ Provides: bundled(md5-plumb) Provides: ocaml(compiler) = %{version} %if %{native_compiler} -%global __ocaml_requires_opts -c -f '%{buildroot}%{_bindir}/ocamlrun %{buildroot}%{_bindir}/ocamlobjinfo.byte' +%global __ocaml_requires_opts -c -f '%{buildroot}%{_bindir}/ocamlrun %{buildroot}%{_bindir}/ocamlobjinfo.byte' -i Dynlink_cmo_format -i Dynlink_cmxs_format %else %global __ocaml_requires_opts -c -f '%{buildroot}%{_bindir}/ocamlrun %{buildroot}%{_bindir}/ocamlobjinfo.byte' -i Backend_intf -i Inlining_decision_intf -i Simplify_boxed_integer_ops_intf %endif %global __ocaml_provides_opts -f '%{buildroot}%{_bindir}/ocamlrun %{buildroot}%{_bindir}/ocamlobjinfo.byte' - %description OCaml is a high-level, strongly-typed, functional and object-oriented programming language from the ML family of languages. @@ -482,6 +463,11 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Thu Jan 9 2025 Jerry James - 5.3.0-1 +- New upstream version 5.3.0 +- Drop upstreamed patches +- BR git-core instead of git + * Thu Jul 18 2024 Fedora Release Engineering - 5.2.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/sources b/sources index c8a1b16..eb6f2b4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ocaml-5.2.0.tar.gz) = 78115690186c13c1f2480e4812a9fe34cce2c28bf8a89d5c9810bca0391f930cecd9cee2b53daca8a32da1815628b33be68f3948f1ad03fa50b72b14e3ea84f2 +SHA512 (ocaml-5.3.0.tar.gz) = 73817ada340bdf4091b3edd7b292bd0074c87b4836f202f48ecf0f620a00feaa70ebc9101b97155e8caa6907646dfdf21eff728fa0e14542df3b5e5436229d06 From 9d17af02a537cd24d13ba9241cbf05f98c0c75f6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jan 2025 20:40:47 +0000 Subject: [PATCH 18/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- ocaml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index c5c0c05..f5bfcc2 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -46,7 +46,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.3.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: OCaml compiler and programming environment @@ -463,6 +463,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Fri Jan 17 2025 Fedora Release Engineering - 5.3.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Thu Jan 9 2025 Jerry James - 5.3.0-1 - New upstream version 5.3.0 - Drop upstreamed patches From 5b0d3a3f5da9b30d345541737d8f4f626e1b11cb Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 22 Jun 2025 15:52:30 -0400 Subject: [PATCH 19/31] Fix RPM macros for Python 3.14 A change to argparse in 3.14 is leading it to misinterpret the '%' in '%files' as an operator. Escaping it makes it compatible with both 3.14 and earlier versions. --- ocaml.spec | 5 ++++- ocaml_files.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ocaml.spec b/ocaml.spec index f5bfcc2..3d444bd 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -46,7 +46,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.3.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: OCaml compiler and programming environment @@ -463,6 +463,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Sun Jun 22 2025 Yaakov Selkowitz - 5.3.0-3 +- Fix RPM macros for Python 3.14 + * Fri Jan 17 2025 Fedora Release Engineering - 5.3.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/ocaml_files.py b/ocaml_files.py index cf4afd1..0e4658e 100644 --- a/ocaml_files.py +++ b/ocaml_files.py @@ -429,7 +429,7 @@ if __name__ == "__main__": parser.add_argument('-i', '--install', action='store_true', default=False, - help='install files instead of generating %files') + help='install files instead of generating %%files') parser.add_argument('-n', '--no-devel', action='store_true', default=False, From b9c837a4530b0d20fa88ba22e315745e00a7322a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 23:06:40 +0000 Subject: [PATCH 20/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- ocaml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index 3d444bd..8732a1b 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -46,7 +46,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.3.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: OCaml compiler and programming environment @@ -463,6 +463,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 5.3.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Sun Jun 22 2025 Yaakov Selkowitz - 5.3.0-3 - Fix RPM macros for Python 3.14 From bc284a4d37653ed2dadb8885abdb85655306ccda Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 13 Oct 2025 11:02:01 +0100 Subject: [PATCH 21/31] New upstream version 5.4.0 (RHBZ#2368289) --- 0001-Don-t-add-rpaths-to-libraries.patch | 8 ++++---- ...-Allow-user-defined-C-compiler-flags.patch | 19 ++++++++++--------- ocaml.spec | 7 +++++-- sources | 2 +- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/0001-Don-t-add-rpaths-to-libraries.patch b/0001-Don-t-add-rpaths-to-libraries.patch index b5735bd..eb7b77e 100644 --- a/0001-Don-t-add-rpaths-to-libraries.patch +++ b/0001-Don-t-add-rpaths-to-libraries.patch @@ -1,4 +1,4 @@ -From 507a1382cb82160c2a6cfc0ea5bcb3e33ece7307 Mon Sep 17 00:00:00 2001 +From c8e378e67fc8fbd9ef177794d4ed831d5528bd0b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 Subject: [PATCH 1/2] Don't add rpaths to libraries. @@ -8,10 +8,10 @@ Subject: [PATCH 1/2] Don't add rpaths to libraries. 1 file changed, 2 deletions(-) diff --git a/configure.ac b/configure.ac -index 0c9d63859a..48aa9f0a29 100644 +index 0535f404b0..085fba6626 100644 --- a/configure.ac +++ b/configure.ac -@@ -1221,8 +1221,6 @@ AS_IF([test x"$enable_shared" != "xno"], +@@ -1422,8 +1422,6 @@ AS_IF([test x"$enable_shared" != "xno"], [[*-*-openbsd7.[3-9]|*-*-openbsd[89].*]], [mkdll_flags="${mkdll_flags} -Wl,--no-execute-only"]) oc_ldflags="$oc_ldflags -Wl,-E" @@ -21,5 +21,5 @@ index 0c9d63859a..48aa9f0a29 100644 supports_shared_libraries=true], [mkdll='shared-libs-not-available']) -- -2.44.0 +2.50.1 diff --git a/0002-configure-Allow-user-defined-C-compiler-flags.patch b/0002-configure-Allow-user-defined-C-compiler-flags.patch index 9894bc3..df04691 100644 --- a/0002-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0002-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,17 +1,17 @@ -From edd903fc73b98eb784b307a47110985967cb1d09 Mon Sep 17 00:00:00 2001 +From 8323a13546c138266c609be8aa12841982d3a125 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 Subject: [PATCH 2/2] configure: Allow user defined C compiler flags. --- - configure.ac | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) + configure.ac | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 48aa9f0a29..fc29c88f50 100644 +index 085fba6626..353e10c4fc 100644 --- a/configure.ac +++ b/configure.ac -@@ -925,6 +925,10 @@ AS_CASE([$ocaml_cc_vendor], +@@ -997,6 +997,10 @@ AS_CASE([$ocaml_cc_vendor], internal_cflags="$cc_warnings"], [common_cflags="-O"]) @@ -20,9 +20,9 @@ index 48aa9f0a29..fc29c88f50 100644 +cclibs="$cclibs $LDFLAGS" + # Enable SSE2 on x86 mingw to avoid using 80-bit registers. - AS_CASE([$host], - [i686-*-mingw32*], -@@ -2708,7 +2712,7 @@ AC_CONFIG_COMMANDS_PRE([ + AS_CASE([$target], + [i686-w64-mingw32*], +@@ -2847,7 +2851,7 @@ AC_CONFIG_COMMANDS_PRE([ [mkexedebugflag="${mkexe_ldflags_prefix}${mkexedebugflag}"]) mkdll_ldflags="" AS_IF([test -n "${LDFLAGS}"], @@ -32,4 +32,5 @@ index 48aa9f0a29..fc29c88f50 100644 done mkdll_ldflags_exp="$mkdll_ldflags"]) -- -2.44.0 +2.50.1 + diff --git a/ocaml.spec b/ocaml.spec index 8732a1b..f31d5d3 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -45,8 +45,8 @@ ExcludeArch: %{ix86} %global rcver %{nil} Name: ocaml -Version: 5.3.0 -Release: 4%{?dist} +Version: 5.4.0 +Release: 1%{?dist} Summary: OCaml compiler and programming environment @@ -463,6 +463,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Mon Oct 13 2025 Richard W.M. Jones - 5.4.0-1 +- New upstream version 5.4.0 (RHBZ#2368289) + * Thu Jul 24 2025 Fedora Release Engineering - 5.3.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/sources b/sources index eb6f2b4..3f99d7d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ocaml-5.3.0.tar.gz) = 73817ada340bdf4091b3edd7b292bd0074c87b4836f202f48ecf0f620a00feaa70ebc9101b97155e8caa6907646dfdf21eff728fa0e14542df3b5e5436229d06 +SHA512 (ocaml-5.4.0.tar.gz) = 3684468800f4528c9fd96ef3fdd6aa04f71b77180d3ae8045d429f96b32e23cb3a8a307762c7237b6c56c087f45b59b0dab672a31166e3de254bb0fb9b4eb588 From ebbc5125daaae76311284c2c54fe55886c39e0f4 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 13 Oct 2025 11:17:54 +0100 Subject: [PATCH 22/31] Fix branch name in comment --- ocaml.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index f31d5d3..194bdcd 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -68,7 +68,7 @@ Source2: ocaml_files.py # # https://pagure.io/fedora-ocaml # -# Current branch: fedora-41-5.2.0 +# Current branch: fedora-44-5.4.0 # # ALTERNATIVELY add a patch to the end of the list (leaving the # existing patches unchanged) adding a comment to note that it should From aa50731ee38984c1d004c613e9552f79d05fceb7 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 16 Jan 2026 22:24:41 +0000 Subject: [PATCH 23/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild --- ocaml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index 194bdcd..a6bbf74 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -46,7 +46,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.4.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: OCaml compiler and programming environment @@ -463,6 +463,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Fri Jan 16 2026 Fedora Release Engineering - 5.4.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild + * Mon Oct 13 2025 Richard W.M. Jones - 5.4.0-1 - New upstream version 5.4.0 (RHBZ#2368289) From c129230259bf77640aa6604ac7894aa6e5a32a5c Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 18 Feb 2026 17:51:10 +0000 Subject: [PATCH 24/31] Move bundle to the -runtime subpackage Suggested-by: Jerry James --- ocaml.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ocaml.spec b/ocaml.spec index a6bbf74..b8e9c65 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -111,9 +111,6 @@ Requires: ocaml-runtime%{?_isa} = %{version}-%{release} BuildRequires: ocaml-srpm-macros >= 10 Requires: ocaml-srpm-macros >= 10 -# Bundles an MD5 implementation in runtime/caml/md5.h and runtime/md5.c -Provides: bundled(md5-plumb) - Provides: ocaml(compiler) = %{version} %if %{native_compiler} @@ -142,6 +139,9 @@ Summary: OCaml runtime environment Requires: util-linux Provides: ocaml(runtime) = %{version} +# Bundles an MD5 implementation in runtime/caml/md5.h and runtime/md5.c +Provides: bundled(md5-plumb) + %description runtime OCaml is a high-level, strongly-typed, functional and object-oriented programming language from the ML family of languages. From ee9df08052efbfbe77f0c08c8ba2f2b061251cdb Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 18 Feb 2026 17:52:32 +0000 Subject: [PATCH 25/31] Replace x86_64 with %{x86_64} On Rawhide this macro expands to: x86_64 x86_64_v2 x86_64_v3 x86_64_v4 amd64 em64t Suggested-by: Jerry James --- ocaml.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index b8e9c65..69ece26 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -259,7 +259,7 @@ sed -i '/^EXTRACAMLFLAGS=/aLINKOPTS=-cclib -lm' otherlibs/unix/Makefile --disable-native-compiler \ --disable-native-toplevel \ %endif -%ifarch x86_64 +%ifarch %{x86_64} %if 0%{?_include_frame_pointers} --enable-frame-pointers \ %endif From 360b98ce787a783a5085772b4392e8b46faf93fd Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 18 Feb 2026 17:53:18 +0000 Subject: [PATCH 26/31] Enable frame pointers on aarch64 Suggested-by: Jerry James --- ocaml.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index 69ece26..2876a52 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -259,7 +259,7 @@ sed -i '/^EXTRACAMLFLAGS=/aLINKOPTS=-cclib -lm' otherlibs/unix/Makefile --disable-native-compiler \ --disable-native-toplevel \ %endif -%ifarch %{x86_64} +%ifarch %{x86_64} %{arm64} %if 0%{?_include_frame_pointers} --enable-frame-pointers \ %endif From e3af15bd1127528f83a7db55a5b7396499b58d1b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 20 Feb 2026 11:20:03 +0000 Subject: [PATCH 27/31] New upstream version 5.4.0 (RHBZ#2440356) --- 0001-Don-t-add-rpaths-to-libraries.patch | 6 +++--- 0002-configure-Allow-user-defined-C-compiler-flags.patch | 8 ++++---- ocaml.spec | 9 ++++++--- sources | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/0001-Don-t-add-rpaths-to-libraries.patch b/0001-Don-t-add-rpaths-to-libraries.patch index eb7b77e..6bf857a 100644 --- a/0001-Don-t-add-rpaths-to-libraries.patch +++ b/0001-Don-t-add-rpaths-to-libraries.patch @@ -1,4 +1,4 @@ -From c8e378e67fc8fbd9ef177794d4ed831d5528bd0b Mon Sep 17 00:00:00 2001 +From 04e523e937625bf30d775681c11e00f6dc6fc00a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 Subject: [PATCH 1/2] Don't add rpaths to libraries. @@ -8,7 +8,7 @@ Subject: [PATCH 1/2] Don't add rpaths to libraries. 1 file changed, 2 deletions(-) diff --git a/configure.ac b/configure.ac -index 0535f404b0..085fba6626 100644 +index 3754ad8a39..fb60c7c14c 100644 --- a/configure.ac +++ b/configure.ac @@ -1422,8 +1422,6 @@ AS_IF([test x"$enable_shared" != "xno"], @@ -21,5 +21,5 @@ index 0535f404b0..085fba6626 100644 supports_shared_libraries=true], [mkdll='shared-libs-not-available']) -- -2.50.1 +2.52.0 diff --git a/0002-configure-Allow-user-defined-C-compiler-flags.patch b/0002-configure-Allow-user-defined-C-compiler-flags.patch index df04691..eddb8f3 100644 --- a/0002-configure-Allow-user-defined-C-compiler-flags.patch +++ b/0002-configure-Allow-user-defined-C-compiler-flags.patch @@ -1,4 +1,4 @@ -From 8323a13546c138266c609be8aa12841982d3a125 Mon Sep 17 00:00:00 2001 +From ef549c9a97838331877b139f407269db2a0fc691 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 Subject: [PATCH 2/2] configure: Allow user defined C compiler flags. @@ -8,7 +8,7 @@ Subject: [PATCH 2/2] configure: Allow user defined C compiler flags. 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 085fba6626..353e10c4fc 100644 +index fb60c7c14c..f6a493ccf5 100644 --- a/configure.ac +++ b/configure.ac @@ -997,6 +997,10 @@ AS_CASE([$ocaml_cc_vendor], @@ -22,7 +22,7 @@ index 085fba6626..353e10c4fc 100644 # Enable SSE2 on x86 mingw to avoid using 80-bit registers. AS_CASE([$target], [i686-w64-mingw32*], -@@ -2847,7 +2851,7 @@ AC_CONFIG_COMMANDS_PRE([ +@@ -2904,7 +2908,7 @@ AC_CONFIG_COMMANDS_PRE([ [mkexedebugflag="${mkexe_ldflags_prefix}${mkexedebugflag}"]) mkdll_ldflags="" AS_IF([test -n "${LDFLAGS}"], @@ -32,5 +32,5 @@ index 085fba6626..353e10c4fc 100644 done mkdll_ldflags_exp="$mkdll_ldflags"]) -- -2.50.1 +2.52.0 diff --git a/ocaml.spec b/ocaml.spec index 2876a52..698904a 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -45,8 +45,8 @@ ExcludeArch: %{ix86} %global rcver %{nil} Name: ocaml -Version: 5.4.0 -Release: 2%{?dist} +Version: 5.4.1 +Release: 1%{?dist} Summary: OCaml compiler and programming environment @@ -68,7 +68,7 @@ Source2: ocaml_files.py # # https://pagure.io/fedora-ocaml # -# Current branch: fedora-44-5.4.0 +# Current branch: fedora-45-5.4.1 # # ALTERNATIVELY add a patch to the end of the list (leaving the # existing patches unchanged) adding a comment to note that it should @@ -463,6 +463,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Fri Feb 20 2026 Richard W.M. Jones - 5.4.1-1 +- New upstream version 5.4.0 (RHBZ#2440356) + * Fri Jan 16 2026 Fedora Release Engineering - 5.4.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild diff --git a/sources b/sources index 3f99d7d..d5a609d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ocaml-5.4.0.tar.gz) = 3684468800f4528c9fd96ef3fdd6aa04f71b77180d3ae8045d429f96b32e23cb3a8a307762c7237b6c56c087f45b59b0dab672a31166e3de254bb0fb9b4eb588 +SHA512 (ocaml-5.4.1.tar.gz) = c44bc429bee4a263b107e60a4ab3b0c9c082ba2d784f63704130551676ce5624061ae1aa280688e3222d9a522555b3cb749eef784ab2145d71c0f19cac773383 From 2e0cb1fe4445b6382103f439cfa421288bae31d6 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 26 Feb 2026 12:56:55 +0000 Subject: [PATCH 28/31] Fix version in changelog - current version is 5.4.1, not 5.4.0 Fixes: commit e3af15bd1127528f83a7db55a5b7396499b58d1b --- ocaml.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index 698904a..2f5430c 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -464,7 +464,7 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog * Fri Feb 20 2026 Richard W.M. Jones - 5.4.1-1 -- New upstream version 5.4.0 (RHBZ#2440356) +- New upstream version 5.4.1 (RHBZ#2440356) * Fri Jan 16 2026 Fedora Release Engineering - 5.4.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild From 5a8dd543c6916f24f103be6ace06d70a205c92bb Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 26 Feb 2026 12:59:34 +0000 Subject: [PATCH 29/31] Backport fix for arm64 frame pointers --- 0001-Don-t-add-rpaths-to-libraries.patch | 2 +- ...-Allow-user-defined-C-compiler-flags.patch | 2 +- ...st-14589-from-xavierleroy-arm64-addi.patch | 207 ++++++++++++++++++ ocaml.spec | 11 +- 4 files changed, 219 insertions(+), 3 deletions(-) create mode 100644 0003-Merge-pull-request-14589-from-xavierleroy-arm64-addi.patch diff --git a/0001-Don-t-add-rpaths-to-libraries.patch b/0001-Don-t-add-rpaths-to-libraries.patch index 6bf857a..03c90a8 100644 --- a/0001-Don-t-add-rpaths-to-libraries.patch +++ b/0001-Don-t-add-rpaths-to-libraries.patch @@ -1,7 +1,7 @@ From 04e523e937625bf30d775681c11e00f6dc6fc00a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 1/2] Don't add rpaths to libraries. +Subject: [PATCH 1/3] Don't add rpaths to libraries. --- configure.ac | 2 -- diff --git a/0002-configure-Allow-user-defined-C-compiler-flags.patch b/0002-configure-Allow-user-defined-C-compiler-flags.patch index eddb8f3..6a6b5f7 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 ef549c9a97838331877b139f407269db2a0fc691 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 2/2] configure: Allow user defined C compiler flags. +Subject: [PATCH 2/3] configure: Allow user defined C compiler flags. --- configure.ac | 6 +++++- diff --git a/0003-Merge-pull-request-14589-from-xavierleroy-arm64-addi.patch b/0003-Merge-pull-request-14589-from-xavierleroy-arm64-addi.patch new file mode 100644 index 0000000..887ddcd --- /dev/null +++ b/0003-Merge-pull-request-14589-from-xavierleroy-arm64-addi.patch @@ -0,0 +1,207 @@ +From c2923703d02c6389b6c4594541569bf628e706b1 Mon Sep 17 00:00:00 2001 +From: Xavier Leroy +Date: Thu, 26 Feb 2026 13:43:07 +0100 +Subject: [PATCH 3/3] Merge pull request #14589 from xavierleroy/arm64-addimm + +Fix arm64 additions with large immediates + +(cherry picked from commit 4fafb9669b9a5c898b2dda0ae851b2a0e6429c43) +(cherry picked from commit 6cda6d8a928ada5dd0f58de229d3cb193cfdff53) +--- + Changes | 6 +++ + asmcomp/arm64/emit.mlp | 84 ++++++++++++++++++++---------------------- + 2 files changed, 45 insertions(+), 45 deletions(-) + +diff --git a/Changes b/Changes +index be999a8cc4..4ad8737bb0 100644 +--- a/Changes ++++ b/Changes +@@ -1,3 +1,9 @@ ++### Bug fixes: ++ ++- #14574, #14577, #14589: Fix wrong assembly code generated for ARM64 ++ with frame pointer support. ++ (Xavier Leroy, review by Vincent Laviron, report by Richard Jones) ++ + OCaml 5.4.1 (17 February 2026) + ------------------------------ + +diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp +index c821310638..3f64eebc05 100644 +--- a/asmcomp/arm64/emit.mlp ++++ b/asmcomp/arm64/emit.mlp +@@ -54,9 +54,11 @@ let emit_label_type lbl ty = + + (* Output a pseudo-register *) + +-let emit_reg = function +- {loc = Reg r} -> emit_string (register_name r) +- | _ -> fatal_error "Emit.emit_reg" ++let reg_name = function ++ | {loc = Reg r} -> register_name r ++ | _ -> fatal_error "Emit.reg_name" ++ ++let emit_reg l = emit_string (reg_name l) + + (* Likewise, but with the 32-bit name of the register *) + +@@ -249,16 +251,28 @@ let is_immediate_float bits = + let mant = Int64.logand bits 0xF_FFFF_FFFF_FFFFL in + exp >= -3 && exp <= 4 && Int64.logand mant 0xF_0000_0000_0000L = mant + ++(* Set [rd] to [rs + n]. *) ++ ++let emit_addimm_gen rd rs n = ++ let insn = if n >= 0 then "add" else "sub" in ++ let n = abs n in ++ if n <= 0xFFF then ++ ` {emit_string insn} {emit_string rd}, {emit_string rs}, #{emit_int n}\n` ++ else begin ++ assert (n <= 0xFFF_FFF); ++ let nl = n land 0xFFF and nh = n land 0xFFF_000 in ++ ` {emit_string insn} {emit_string rd}, {emit_string rs}, #{emit_int nh}\n`; ++ if nl <> 0 then ++ ` {emit_string insn} {emit_string rd}, {emit_string rd}, #{emit_int nl}\n` ++ end ++ + (* Adjust sp (up or down) by the given byte amount *) + + let emit_stack_adjustment n = +- let instr = if n < 0 then "sub" else "add" in +- let m = abs n in +- assert (m < 0x1_000_000); +- let ml = m land 0xFFF and mh = m land 0xFFF_000 in +- if mh <> 0 then ` {emit_string instr} sp, sp, #{emit_int mh}\n`; +- if ml <> 0 then ` {emit_string instr} sp, sp, #{emit_int ml}\n`; +- if n <> 0 then cfi_adjust_cfa_offset (-n) ++ if n <> 0 then begin ++ emit_addimm_gen "sp" "sp" n; ++ cfi_adjust_cfa_offset (-n) ++ end + + (* Deallocate the stack frame and reload the return address + before a return or tail call *) +@@ -278,29 +292,11 @@ let output_epilogue env f = + + (* Output add-immediate / sub-immediate / cmp-immediate instructions *) + +-let rec emit_addimm rd rs n = +- if n < 0 then emit_subimm rd rs (-n) +- else if n <= 0xFFF then +- ` add {emit_reg rd}, {emit_reg rs}, #{emit_int n}\n` +- else begin +- assert (n <= 0xFFF_FFF); +- let nl = n land 0xFFF and nh = n land 0xFFF_000 in +- ` add {emit_reg rd}, {emit_reg rs}, #{emit_int nh}\n`; +- if nl <> 0 then +- ` add {emit_reg rd}, {emit_reg rd}, #{emit_int nl}\n` +- end ++let emit_addimm rd rs n = ++ emit_addimm_gen (reg_name rd) (reg_name rs) n + +-and emit_subimm rd rs n = +- if n < 0 then emit_addimm rd rs (-n) +- else if n <= 0xFFF then +- ` sub {emit_reg rd}, {emit_reg rs}, #{emit_int n}\n` +- else begin +- assert (n <= 0xFFF_FFF); +- let nl = n land 0xFFF and nh = n land 0xFFF_000 in +- ` sub {emit_reg rd}, {emit_reg rs}, #{emit_int nh}\n`; +- if nl <> 0 then +- ` sub {emit_reg rd}, {emit_reg rd}, #{emit_int nl}\n` +- end ++let emit_subimm rd rs n = ++ emit_addimm rd rs (-n) + + let emit_cmpimm rs n = + if n >= 0 +@@ -440,9 +436,7 @@ module Size = struct + let addsub_size n = + let m = abs n in + assert (m < 0x1_000_000); +- let ml = m land 0xFFF and mh = m land 0xFFF_000 in +- max 1 ((if mh <> 0 then 1 else 0) + +- (if ml <> 0 then 1 else 0)) ++ if m <= 0xFFF then 1 else if m land 0xFFF = 0 then 1 else 2 + + let stack_adj_size n = + (* see emit_stack_adjustment *) +@@ -451,7 +445,9 @@ module Size = struct + let prologue_size f = + let stk = initial_stack_offset f in + (if stk > 0 then stack_adj_size (-stk) else 0) +- + (if f.fun_frame_required then (if fp then 2 else 1) else 0) ++ + (if f.fun_frame_required ++ then if fp then 1 + addsub_size (stk - 16) else 1 ++ else 0) + + let epilogue_size f = + let stk = initial_stack_offset f in +@@ -491,7 +487,7 @@ module Size = struct + and pre_store = + match memory_chunk, assignment, macosx, addressing_mode with + | (Word_int | Word_val), true, true, Iindexed 0 -> 0 +- | (Word_int | Word_val), true, true, _ -> 1 (* Compute dest address *) ++ | (Word_int | Word_val), true, true, Iindexed n -> addsub_size n (* Compute dest address *) + | (Word_int | Word_val), true, false, _ -> 1 (* Barrier instruction *) + | _ -> 0 + and store = match memory_chunk with Single -> 2 | _ -> 1 in +@@ -553,7 +549,7 @@ module Size = struct + + begin match lbl1 with None -> 0 | Some _ -> 1 end + + begin match lbl2 with None -> 0 | Some _ -> 1 end + | Lswitch jumptbl -> 3 + Array.length jumptbl +- | Lentertrap -> if fp then 1 else 0 ++ | Lentertrap -> if fp then 2 (* over-approximation *) else 0 + | Ladjust_trap_depth _ -> 0 + | Lpushtrap _ -> 3 + | Lpoptrap -> 1 +@@ -694,9 +690,7 @@ let emit_stlr src base addr = + let dest_reg = + match addr with + | Iindexed 0 -> base +- | Iindexed ofs -> +- ` add {emit_reg reg_tmp1}, {emit_reg base}, #{emit_int ofs}\n`; +- reg_tmp1 ++ | Iindexed ofs -> emit_addimm reg_tmp1 base ofs; reg_tmp1 + | Ibased _ -> assert false (* Ibased is not emitted under macOS *) + in + ` stlr {emit_reg src}, [{emit_reg dest_reg}]\n` +@@ -721,7 +715,7 @@ let emit_instr env i = + if n > 0 then begin + emit_stack_adjustment (-n); + if env.f.fun_frame_required && fp then +- ` add x29, sp, #{emit_int (n-16)}\n`; ++ emit_addimm_gen "x29" "sp" (n - 16) + end + | Lop(Imove | Ispill | Ireload) -> + let src = i.arg.(0) and dst = i.res.(0) in +@@ -1080,7 +1074,7 @@ let emit_instr env i = + | Lentertrap -> + if fp then begin + let delta = (frame_size env) - 16 (* return address + frame pointer *) in +- ` add x29, sp, #{emit_int delta}\n` ++ emit_addimm_gen "x29" "sp" delta + end + | Ladjust_trap_depth { delta_traps } -> + (* each trap occupies 16 bytes on the stack *) +@@ -1119,7 +1113,7 @@ let emit_instr_debug env i = + `{emit_label lbl}:\n`; + emit_instr env i; + let sz = Size.instr_size env.f i.desc * 4 in +- ` .ifne (. - {emit_label lbl}) - {emit_int sz}\n`; ++ ` .ifgt (. - {emit_label lbl}) - {emit_int sz}\n`; + ` .error \"Emit.instr_size: instruction length mismatch\"\n`; + ` .endif\n` + +@@ -1130,7 +1124,7 @@ let rec emit_all env lbl_start acc i = + if debug then begin + (* acc measures in units of 32-bit instructions *) + let sz = acc * 4 in +- ` .ifne (. - {emit_label lbl_start}) - {emit_int sz}\n`; ++ ` .ifgt (. - {emit_label lbl_start}) - {emit_int sz}\n`; + ` .error \"Emit.instr_size: instruction length mismatch\"\n`; + ` .endif\n`; + end +-- +2.52.0 + diff --git a/ocaml.spec b/ocaml.spec index 2f5430c..65557d4 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -46,7 +46,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.4.1 -Release: 1%{?dist} +Release: 4%{?dist} Summary: OCaml compiler and programming environment @@ -78,6 +78,12 @@ Source2: ocaml_files.py Patch: 0001-Don-t-add-rpaths-to-libraries.patch Patch: 0002-configure-Allow-user-defined-C-compiler-flags.patch +# Fix for arm64 frame pointers +# https://github.com/ocaml/ocaml/issues/14574 +# https://github.com/ocaml/ocaml/pull/14589 +# Upstream 6cda6d8a928ada5dd0f58de229d3cb193cfdff53 +Patch: 0003-Merge-pull-request-14589-from-xavierleroy-arm64-addi.patch + BuildRequires: make BuildRequires: git-core BuildRequires: gcc @@ -463,6 +469,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Thu Feb 26 2026 Richard W.M. Jones - 5.4.1-4 +- Backport fix for arm64 frame pointers + * Fri Feb 20 2026 Richard W.M. Jones - 5.4.1-1 - New upstream version 5.4.1 (RHBZ#2440356) From b015f12145879ed9da0317639500d50b601deedf Mon Sep 17 00:00:00 2001 From: Jerry James Date: Thu, 9 Jul 2026 08:36:23 -0600 Subject: [PATCH 30/31] New upstream version 5.5.0 (RHBZ#2442622) - Drop upstreamed fix for arm64 frame pointers - Reenable LTO - Move ld.conf, libasmrun, and libcamlrun to ocaml-runtime - Drop hardlink dependency; rpm now does this by default - Drop unused utilx-linux dependency --- 0001-Don-t-add-rpaths-to-libraries.patch | 2 +- ...-Allow-user-defined-C-compiler-flags.patch | 15 +- ...st-14589-from-xavierleroy-arm64-addi.patch | 207 ------------------ ocaml.spec | 50 ++--- sources | 2 +- 5 files changed, 26 insertions(+), 250 deletions(-) delete mode 100644 0003-Merge-pull-request-14589-from-xavierleroy-arm64-addi.patch diff --git a/0001-Don-t-add-rpaths-to-libraries.patch b/0001-Don-t-add-rpaths-to-libraries.patch index 03c90a8..6bf857a 100644 --- a/0001-Don-t-add-rpaths-to-libraries.patch +++ b/0001-Don-t-add-rpaths-to-libraries.patch @@ -1,7 +1,7 @@ From 04e523e937625bf30d775681c11e00f6dc6fc00a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jun 2014 10:00:15 +0100 -Subject: [PATCH 1/3] Don't add rpaths to libraries. +Subject: [PATCH 1/2] Don't add rpaths to libraries. --- configure.ac | 2 -- diff --git a/0002-configure-Allow-user-defined-C-compiler-flags.patch b/0002-configure-Allow-user-defined-C-compiler-flags.patch index 6a6b5f7..74de99b 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 ef549c9a97838331877b139f407269db2a0fc691 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 29 May 2012 20:44:18 +0100 -Subject: [PATCH 2/3] configure: Allow user defined C compiler flags. +Subject: [PATCH 2/2] configure: Allow user defined C compiler flags. --- configure.ac | 6 +++++- @@ -11,18 +11,7 @@ diff --git a/configure.ac b/configure.ac index fb60c7c14c..f6a493ccf5 100644 --- a/configure.ac +++ b/configure.ac -@@ -997,6 +997,10 @@ AS_CASE([$ocaml_cc_vendor], - internal_cflags="$cc_warnings"], - [common_cflags="-O"]) - -+# Allow CFLAGS and LDFLAGS to be added. -+common_cflags="$common_cflags $CFLAGS" -+cclibs="$cclibs $LDFLAGS" -+ - # Enable SSE2 on x86 mingw to avoid using 80-bit registers. - AS_CASE([$target], - [i686-w64-mingw32*], -@@ -2904,7 +2908,7 @@ AC_CONFIG_COMMANDS_PRE([ +@@ -3243,7 +3243,7 @@ AC_CONFIG_COMMANDS_PRE([ [mkexedebugflag="${mkexe_ldflags_prefix}${mkexedebugflag}"]) mkdll_ldflags="" AS_IF([test -n "${LDFLAGS}"], diff --git a/0003-Merge-pull-request-14589-from-xavierleroy-arm64-addi.patch b/0003-Merge-pull-request-14589-from-xavierleroy-arm64-addi.patch deleted file mode 100644 index 887ddcd..0000000 --- a/0003-Merge-pull-request-14589-from-xavierleroy-arm64-addi.patch +++ /dev/null @@ -1,207 +0,0 @@ -From c2923703d02c6389b6c4594541569bf628e706b1 Mon Sep 17 00:00:00 2001 -From: Xavier Leroy -Date: Thu, 26 Feb 2026 13:43:07 +0100 -Subject: [PATCH 3/3] Merge pull request #14589 from xavierleroy/arm64-addimm - -Fix arm64 additions with large immediates - -(cherry picked from commit 4fafb9669b9a5c898b2dda0ae851b2a0e6429c43) -(cherry picked from commit 6cda6d8a928ada5dd0f58de229d3cb193cfdff53) ---- - Changes | 6 +++ - asmcomp/arm64/emit.mlp | 84 ++++++++++++++++++++---------------------- - 2 files changed, 45 insertions(+), 45 deletions(-) - -diff --git a/Changes b/Changes -index be999a8cc4..4ad8737bb0 100644 ---- a/Changes -+++ b/Changes -@@ -1,3 +1,9 @@ -+### Bug fixes: -+ -+- #14574, #14577, #14589: Fix wrong assembly code generated for ARM64 -+ with frame pointer support. -+ (Xavier Leroy, review by Vincent Laviron, report by Richard Jones) -+ - OCaml 5.4.1 (17 February 2026) - ------------------------------ - -diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp -index c821310638..3f64eebc05 100644 ---- a/asmcomp/arm64/emit.mlp -+++ b/asmcomp/arm64/emit.mlp -@@ -54,9 +54,11 @@ let emit_label_type lbl ty = - - (* Output a pseudo-register *) - --let emit_reg = function -- {loc = Reg r} -> emit_string (register_name r) -- | _ -> fatal_error "Emit.emit_reg" -+let reg_name = function -+ | {loc = Reg r} -> register_name r -+ | _ -> fatal_error "Emit.reg_name" -+ -+let emit_reg l = emit_string (reg_name l) - - (* Likewise, but with the 32-bit name of the register *) - -@@ -249,16 +251,28 @@ let is_immediate_float bits = - let mant = Int64.logand bits 0xF_FFFF_FFFF_FFFFL in - exp >= -3 && exp <= 4 && Int64.logand mant 0xF_0000_0000_0000L = mant - -+(* Set [rd] to [rs + n]. *) -+ -+let emit_addimm_gen rd rs n = -+ let insn = if n >= 0 then "add" else "sub" in -+ let n = abs n in -+ if n <= 0xFFF then -+ ` {emit_string insn} {emit_string rd}, {emit_string rs}, #{emit_int n}\n` -+ else begin -+ assert (n <= 0xFFF_FFF); -+ let nl = n land 0xFFF and nh = n land 0xFFF_000 in -+ ` {emit_string insn} {emit_string rd}, {emit_string rs}, #{emit_int nh}\n`; -+ if nl <> 0 then -+ ` {emit_string insn} {emit_string rd}, {emit_string rd}, #{emit_int nl}\n` -+ end -+ - (* Adjust sp (up or down) by the given byte amount *) - - let emit_stack_adjustment n = -- let instr = if n < 0 then "sub" else "add" in -- let m = abs n in -- assert (m < 0x1_000_000); -- let ml = m land 0xFFF and mh = m land 0xFFF_000 in -- if mh <> 0 then ` {emit_string instr} sp, sp, #{emit_int mh}\n`; -- if ml <> 0 then ` {emit_string instr} sp, sp, #{emit_int ml}\n`; -- if n <> 0 then cfi_adjust_cfa_offset (-n) -+ if n <> 0 then begin -+ emit_addimm_gen "sp" "sp" n; -+ cfi_adjust_cfa_offset (-n) -+ end - - (* Deallocate the stack frame and reload the return address - before a return or tail call *) -@@ -278,29 +292,11 @@ let output_epilogue env f = - - (* Output add-immediate / sub-immediate / cmp-immediate instructions *) - --let rec emit_addimm rd rs n = -- if n < 0 then emit_subimm rd rs (-n) -- else if n <= 0xFFF then -- ` add {emit_reg rd}, {emit_reg rs}, #{emit_int n}\n` -- else begin -- assert (n <= 0xFFF_FFF); -- let nl = n land 0xFFF and nh = n land 0xFFF_000 in -- ` add {emit_reg rd}, {emit_reg rs}, #{emit_int nh}\n`; -- if nl <> 0 then -- ` add {emit_reg rd}, {emit_reg rd}, #{emit_int nl}\n` -- end -+let emit_addimm rd rs n = -+ emit_addimm_gen (reg_name rd) (reg_name rs) n - --and emit_subimm rd rs n = -- if n < 0 then emit_addimm rd rs (-n) -- else if n <= 0xFFF then -- ` sub {emit_reg rd}, {emit_reg rs}, #{emit_int n}\n` -- else begin -- assert (n <= 0xFFF_FFF); -- let nl = n land 0xFFF and nh = n land 0xFFF_000 in -- ` sub {emit_reg rd}, {emit_reg rs}, #{emit_int nh}\n`; -- if nl <> 0 then -- ` sub {emit_reg rd}, {emit_reg rd}, #{emit_int nl}\n` -- end -+let emit_subimm rd rs n = -+ emit_addimm rd rs (-n) - - let emit_cmpimm rs n = - if n >= 0 -@@ -440,9 +436,7 @@ module Size = struct - let addsub_size n = - let m = abs n in - assert (m < 0x1_000_000); -- let ml = m land 0xFFF and mh = m land 0xFFF_000 in -- max 1 ((if mh <> 0 then 1 else 0) + -- (if ml <> 0 then 1 else 0)) -+ if m <= 0xFFF then 1 else if m land 0xFFF = 0 then 1 else 2 - - let stack_adj_size n = - (* see emit_stack_adjustment *) -@@ -451,7 +445,9 @@ module Size = struct - let prologue_size f = - let stk = initial_stack_offset f in - (if stk > 0 then stack_adj_size (-stk) else 0) -- + (if f.fun_frame_required then (if fp then 2 else 1) else 0) -+ + (if f.fun_frame_required -+ then if fp then 1 + addsub_size (stk - 16) else 1 -+ else 0) - - let epilogue_size f = - let stk = initial_stack_offset f in -@@ -491,7 +487,7 @@ module Size = struct - and pre_store = - match memory_chunk, assignment, macosx, addressing_mode with - | (Word_int | Word_val), true, true, Iindexed 0 -> 0 -- | (Word_int | Word_val), true, true, _ -> 1 (* Compute dest address *) -+ | (Word_int | Word_val), true, true, Iindexed n -> addsub_size n (* Compute dest address *) - | (Word_int | Word_val), true, false, _ -> 1 (* Barrier instruction *) - | _ -> 0 - and store = match memory_chunk with Single -> 2 | _ -> 1 in -@@ -553,7 +549,7 @@ module Size = struct - + begin match lbl1 with None -> 0 | Some _ -> 1 end - + begin match lbl2 with None -> 0 | Some _ -> 1 end - | Lswitch jumptbl -> 3 + Array.length jumptbl -- | Lentertrap -> if fp then 1 else 0 -+ | Lentertrap -> if fp then 2 (* over-approximation *) else 0 - | Ladjust_trap_depth _ -> 0 - | Lpushtrap _ -> 3 - | Lpoptrap -> 1 -@@ -694,9 +690,7 @@ let emit_stlr src base addr = - let dest_reg = - match addr with - | Iindexed 0 -> base -- | Iindexed ofs -> -- ` add {emit_reg reg_tmp1}, {emit_reg base}, #{emit_int ofs}\n`; -- reg_tmp1 -+ | Iindexed ofs -> emit_addimm reg_tmp1 base ofs; reg_tmp1 - | Ibased _ -> assert false (* Ibased is not emitted under macOS *) - in - ` stlr {emit_reg src}, [{emit_reg dest_reg}]\n` -@@ -721,7 +715,7 @@ let emit_instr env i = - if n > 0 then begin - emit_stack_adjustment (-n); - if env.f.fun_frame_required && fp then -- ` add x29, sp, #{emit_int (n-16)}\n`; -+ emit_addimm_gen "x29" "sp" (n - 16) - end - | Lop(Imove | Ispill | Ireload) -> - let src = i.arg.(0) and dst = i.res.(0) in -@@ -1080,7 +1074,7 @@ let emit_instr env i = - | Lentertrap -> - if fp then begin - let delta = (frame_size env) - 16 (* return address + frame pointer *) in -- ` add x29, sp, #{emit_int delta}\n` -+ emit_addimm_gen "x29" "sp" delta - end - | Ladjust_trap_depth { delta_traps } -> - (* each trap occupies 16 bytes on the stack *) -@@ -1119,7 +1113,7 @@ let emit_instr_debug env i = - `{emit_label lbl}:\n`; - emit_instr env i; - let sz = Size.instr_size env.f i.desc * 4 in -- ` .ifne (. - {emit_label lbl}) - {emit_int sz}\n`; -+ ` .ifgt (. - {emit_label lbl}) - {emit_int sz}\n`; - ` .error \"Emit.instr_size: instruction length mismatch\"\n`; - ` .endif\n` - -@@ -1130,7 +1124,7 @@ let rec emit_all env lbl_start acc i = - if debug then begin - (* acc measures in units of 32-bit instructions *) - let sz = acc * 4 in -- ` .ifne (. - {emit_label lbl_start}) - {emit_int sz}\n`; -+ ` .ifgt (. - {emit_label lbl_start}) - {emit_int sz}\n`; - ` .error \"Emit.instr_size: instruction length mismatch\"\n`; - ` .endif\n`; - end --- -2.52.0 - diff --git a/ocaml.spec b/ocaml.spec index 65557d4..eabeb25 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -1,13 +1,6 @@ # Don't add -Wl,-dT, %undefine _package_note_flags -# OCaml 5.1 broke building with LTO. A file prims.c is generated with -# primitive function declarations, all with "void" for their parameter -# list. This does not match the real definitions, leading to lots of -# -Wlto-type-mismatch warnings. These change the output of the tests, -# leading to many failed tests. This is still a problem in 5.3. -%global _lto_cflags %{nil} - # OCaml has a bytecode backend that works on anything with a C # compiler, and a native code backend available on a subset of # architectures. A further subset of architectures support native @@ -32,7 +25,7 @@ ExcludeArch: %{ix86} # 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 s390x x86_64 +%global test_arches %{arm64} %{power64} %{riscv64} s390x %{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 @@ -45,8 +38,8 @@ ExcludeArch: %{ix86} %global rcver %{nil} Name: ocaml -Version: 5.4.1 -Release: 4%{?dist} +Version: 5.5.0 +Release: 1%{?dist} Summary: OCaml compiler and programming environment @@ -78,26 +71,17 @@ Source2: ocaml_files.py Patch: 0001-Don-t-add-rpaths-to-libraries.patch Patch: 0002-configure-Allow-user-defined-C-compiler-flags.patch -# Fix for arm64 frame pointers -# https://github.com/ocaml/ocaml/issues/14574 -# https://github.com/ocaml/ocaml/pull/14589 -# Upstream 6cda6d8a928ada5dd0f58de229d3cb193cfdff53 -Patch: 0003-Merge-pull-request-14589-from-xavierleroy-arm64-addi.patch - BuildRequires: make BuildRequires: git-core BuildRequires: gcc BuildRequires: autoconf BuildRequires: gawk -BuildRequires: hardlink BuildRequires: perl-interpreter -BuildRequires: util-linux -BuildRequires: /usr/bin/annocheck +BuildRequires: annobin-annocheck BuildRequires: pkgconfig(libzstd) # Documentation requirements BuildRequires: asciidoc -BuildRequires: python3-pygments # ocamlopt runs gcc to link binaries. Because Fedora includes # hardening flags automatically, redhat-rpm-config is also required. @@ -142,7 +126,6 @@ and a comprehensive library. # and runtime/md5.c License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception AND LicenseRef-Fedora-Public-Domain Summary: OCaml runtime environment -Requires: util-linux Provides: ocaml(runtime) = %{version} # Bundles an MD5 implementation in runtime/caml/md5.h and runtime/md5.c @@ -313,7 +296,10 @@ make -j1 tests ||: %install %make_install -perl -pi -e "s|^$RPM_BUILD_ROOT||" $RPM_BUILD_ROOT%{_libdir}/ocaml/ld.conf + +# OCaml 5.5.0 uses relative paths in ld.conf by default to support relocatable +# OCaml, which we don't need. Overwrite ld.conf with the absolute path. +echo %{_libdir}/ocaml/stublibs > $RPM_BUILD_ROOT%{_libdir}/ocaml/ld.conf echo %{version} > $RPM_BUILD_ROOT%{_libdir}/ocaml/fedora-ocaml-release @@ -326,9 +312,6 @@ install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{rpmmacrodir}/macros.ocaml-rpm mkdir -p $RPM_BUILD_ROOT%{_rpmconfigdir}/redhat install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_rpmconfigdir}/redhat -# Link, rather than copy, identical binaries -hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs - %files %license LICENSE @@ -371,7 +354,6 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %endif %{_libdir}/ocaml/expunge -%{_libdir}/ocaml/ld.conf %{_libdir}/ocaml/Makefile.config %{_libdir}/ocaml/*.a @@ -379,11 +361,9 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %{_libdir}/ocaml/*.cmxa %{_libdir}/ocaml/*.cmx %{_libdir}/ocaml/*.o -%{_libdir}/ocaml/libasmrun_shared.so %endif %{_libdir}/ocaml/*.mli %{_libdir}/ocaml/sys.ml.in -%{_libdir}/ocaml/libcamlrun_shared.so %{_libdir}/ocaml/{dynlink,runtime_events,str,threads,unix}/*.mli %if %{native_compiler} @@ -404,12 +384,18 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %doc README.html Changes %license LICENSE %{_bindir}/ocamlrun +%{_bindir}/*ocamlrun-a100 %{_bindir}/ocamlrund +%{_bindir}/*ocamlrund-a100 %{_bindir}/ocamlruni +%{_bindir}/*ocamlruni-a100 %dir %{_libdir}/ocaml +%{_libdir}/ocaml/libasmrun*.so +%{_libdir}/ocaml/libcamlrun*.so %{_libdir}/ocaml/*.cmo %{_libdir}/ocaml/*.cmi %{_libdir}/ocaml/*.cma +%{_libdir}/ocaml/ld.conf %{_libdir}/ocaml/stublibs %dir %{_libdir}/ocaml/dynlink %{_libdir}/ocaml/dynlink/META @@ -469,6 +455,14 @@ hardlink -t $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %changelog +* Tue Jun 23 2026 Jerry James - 5.5.0-1 +- New upstream version 5.5.0 (RHBZ#2442622) +- Drop upstreamed fix for arm64 frame pointers +- Reenable LTO +- Move ld.conf, libasmrun, and libcamlrun to ocaml-runtime +- Drop hardlink dependency; rpm now does this by default +- Drop unused utilx-linux dependency + * Thu Feb 26 2026 Richard W.M. Jones - 5.4.1-4 - Backport fix for arm64 frame pointers diff --git a/sources b/sources index d5a609d..7c0afd0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ocaml-5.4.1.tar.gz) = c44bc429bee4a263b107e60a4ab3b0c9c082ba2d784f63704130551676ce5624061ae1aa280688e3222d9a522555b3cb749eef784ab2145d71c0f19cac773383 +SHA512 (ocaml-5.5.0.tar.gz) = bf13c18cd1fc7b2e5e9623024ea8623710f646ff2fbc0f59dab70e4d4318ed8623bdcc3ec59ce37af07af2b767f520dea23fb474c26297b3e858b6c8e080b4e6 From cba5f7abbea9ebc52cd0bbc5cf243f7147a79166 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jul 2026 09:52:03 +0000 Subject: [PATCH 31/31] Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild --- ocaml.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocaml.spec b/ocaml.spec index eabeb25..3b39d37 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -39,7 +39,7 @@ ExcludeArch: %{ix86} Name: ocaml Version: 5.5.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: OCaml compiler and programming environment @@ -455,6 +455,9 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_rpmconfigdir}/redhat %changelog +* Thu Jul 16 2026 Fedora Release Engineering - 5.5.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild + * Tue Jun 23 2026 Jerry James - 5.5.0-1 - New upstream version 5.5.0 (RHBZ#2442622) - Drop upstreamed fix for arm64 frame pointers