parent
6a01cf817c
commit
dda940a849
@ -1 +1 @@
|
||||
SOURCES/ocaml-4.11.1.tar.xz
|
||||
SOURCES/ocaml-5.2.0.tar.gz
|
||||
|
@ -1 +1 @@
|
||||
2bfc9e3af2a679b87f692e3b991034b920b8b3c3 SOURCES/ocaml-4.11.1.tar.xz
|
||||
b404edd5d605b271a1b094a00bdff011a2d5ac17 SOURCES/ocaml-5.2.0.tar.gz
|
||||
|
@ -0,0 +1,90 @@
|
||||
From 5538fa66e94fad3d2b4f110d23bef3b4d2d6342c Mon Sep 17 00:00:00 2001
|
||||
From: Florian Angeletti <florian.angeletti@inria.fr>
|
||||
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
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 4c7732daae8f0d2a622f91f5ff3add5c2248a2e3 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 24 Jun 2014 10:00:15 +0100
|
||||
Subject: [PATCH 1/6] Don't add rpaths to libraries.
|
||||
|
||||
---
|
||||
tools/Makefile | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/Makefile b/tools/Makefile
|
||||
index dbad0b74f..c920a5337 100644
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -154,8 +154,8 @@ $(call byte_and_opt,ocamlmklib,ocamlmklibconfig.cmo config.cmo \
|
||||
ocamlmklibconfig.ml: $(ROOTDIR)/Makefile.config Makefile
|
||||
(echo 'let bindir = "$(BINDIR)"'; \
|
||||
echo 'let supports_shared_libraries = $(SUPPORTS_SHARED_LIBRARIES)';\
|
||||
- echo 'let default_rpath = "$(RPATH)"'; \
|
||||
- echo 'let mksharedlibrpath = "$(MKSHAREDLIBRPATH)"'; \
|
||||
+ echo 'let default_rpath = ""'; \
|
||||
+ echo 'let mksharedlibrpath = ""'; \
|
||||
echo 'let toolpref = "$(TOOLPREF)"';) \
|
||||
> ocamlmklibconfig.ml
|
||||
|
||||
--
|
||||
2.32.0
|
||||
|
@ -0,0 +1,515 @@
|
||||
From 7a20c9322f827923baa6a9907998f670463ce447 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Angeletti <florian.angeletti@inria.fr>
|
||||
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
|
||||
|
@ -1,27 +0,0 @@
|
||||
From 441ad77a0c89f4abdf104c668d579607f338a052 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 29 May 2012 20:44:18 +0100
|
||||
Subject: [PATCH 2/6] configure: Allow user defined C compiler flags.
|
||||
|
||||
---
|
||||
configure.ac | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index aa5f26f28..5153853b7 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -609,6 +609,10 @@ AS_CASE([$host],
|
||||
internal_cflags="$gcc_warnings"],
|
||||
[common_cflags="-O"])])
|
||||
|
||||
+# Allow CFLAGS and LDFLAGS to be added.
|
||||
+common_cflags="$common_cflags $CFLAGS"
|
||||
+cclibs="$cclibs $LDFLAGS"
|
||||
+
|
||||
internal_cppflags="-DCAML_NAME_SPACE $internal_cppflags"
|
||||
|
||||
# Enable SSE2 on x86 mingw to avoid using 80-bit registers.
|
||||
--
|
||||
2.32.0
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 507a1382cb82160c2a6cfc0ea5bcb3e33ece7307 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 24 Jun 2014 10:00:15 +0100
|
||||
Subject: [PATCH 3/7] Don't add rpaths to libraries.
|
||||
|
||||
---
|
||||
configure.ac | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 0c9d63859a..48aa9f0a29 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -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,"
|
||||
- mksharedlibrpath="-Wl,-rpath,"
|
||||
natdynlinkopts="-Wl,-E"
|
||||
supports_shared_libraries=true],
|
||||
[mkdll='shared-libs-not-available'])
|
||||
--
|
||||
2.44.0
|
||||
|
@ -1,43 +0,0 @@
|
||||
From 3318c5b805d8d6ae1d571f18f682c9f701b712e2 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 26 Apr 2019 16:16:29 +0100
|
||||
Subject: [PATCH 3/6] configure: Remove incorrect assumption about
|
||||
cross-compiling.
|
||||
|
||||
See https://github.com/ocaml/ocaml/issues/8647#issuecomment-487094390
|
||||
---
|
||||
configure.ac | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 5153853b7..4e97474a2 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -511,10 +511,11 @@ AS_IF(
|
||||
|
||||
# Are we building a cross-compiler
|
||||
|
||||
-AS_IF(
|
||||
- [test x"$host" = x"$target"],
|
||||
- [cross_compiler=false],
|
||||
- [cross_compiler=true])
|
||||
+#AS_IF(
|
||||
+# [test x"$host" = x"$target"],
|
||||
+# [cross_compiler=false],
|
||||
+# [cross_compiler=true])
|
||||
+cross_compiler=false
|
||||
|
||||
# Checks for programs
|
||||
|
||||
@@ -1021,7 +1022,7 @@ AS_CASE([$arch],
|
||||
|
||||
# Assembler
|
||||
|
||||
-AS_IF([test -n "$host_alias"], [toolpref="${host_alias}-"], [toolpref=""])
|
||||
+#AS_IF([test -n "$host_alias"], [toolpref="${host_alias}-"], [toolpref=""])
|
||||
|
||||
# We first compute default values for as and aspp
|
||||
# If values have been given by the user then they take precedence over
|
||||
--
|
||||
2.32.0
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 01d8e3f82adb382fb90af15879f722e824834c84 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 18 Jan 2020 11:31:27 +0000
|
||||
Subject: [PATCH 4/6] Remove configure from .gitattributes.
|
||||
|
||||
It's not a binary file.
|
||||
---
|
||||
.gitattributes | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
diff --git a/.gitattributes b/.gitattributes
|
||||
index 200eb49c6..d871764de 100644
|
||||
--- a/.gitattributes
|
||||
+++ b/.gitattributes
|
||||
@@ -29,10 +29,6 @@
|
||||
|
||||
/boot/menhir/parser.ml* -diff
|
||||
|
||||
-# configure is declared as binary so that it doesn't get included in diffs.
|
||||
-# This also means it will have the correct Unix line-endings, even on Windows.
|
||||
-/configure binary
|
||||
-
|
||||
# 'union' merge driver just unions textual content in case of conflict
|
||||
# http://krlmlr.github.io/using-gitattributes-to-avoid-merge-conflicts/
|
||||
/.mailmap merge=union
|
||||
--
|
||||
2.32.0
|
||||
|
@ -0,0 +1,45 @@
|
||||
From edd903fc73b98eb784b307a47110985967cb1d09 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 29 May 2012 20:44:18 +0100
|
||||
Subject: [PATCH 4/7] 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 48aa9f0a29..fc29c88f50 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -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"
|
||||
+cclibs="$cclibs $LDFLAGS"
|
||||
+
|
||||
# Enable SSE2 on x86 mingw to avoid using 80-bit registers.
|
||||
AS_CASE([$host],
|
||||
[i686-*-mingw32*],
|
||||
@@ -2648,7 +2652,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"])
|
||||
@@ -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
|
||||
|
@ -1,69 +0,0 @@
|
||||
From 122db7141d292d63cfbe2c7d7a4280cc73194ece Mon Sep 17 00:00:00 2001
|
||||
From: Xavier Leroy <xavierleroy@users.noreply.github.com>
|
||||
Date: Wed, 5 Aug 2020 11:17:52 +0200
|
||||
Subject: [PATCH 5/6] Fix type mismatches between definition and declaration
|
||||
(#9830)
|
||||
|
||||
The C global variable caml_fl_merge and the C function
|
||||
caml_spacetime_my_profinfo (bytecode version) were declared and
|
||||
defined with different types. This is undefined behavior and
|
||||
can cause link-time errors with link-time optimization (LTO).
|
||||
|
||||
Closes: #9825
|
||||
---
|
||||
runtime/major_gc.c | 4 ++--
|
||||
runtime/spacetime_byt.c | 7 ++++++-
|
||||
2 files changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/runtime/major_gc.c b/runtime/major_gc.c
|
||||
index 5e4f06bce..c8f5a3281 100644
|
||||
--- a/runtime/major_gc.c
|
||||
+++ b/runtime/major_gc.c
|
||||
@@ -63,7 +63,7 @@ uintnat caml_dependent_size, caml_dependent_allocated;
|
||||
double caml_extra_heap_resources;
|
||||
uintnat caml_fl_wsz_at_phase_change = 0;
|
||||
|
||||
-extern char *caml_fl_merge; /* Defined in freelist.c. */
|
||||
+extern value caml_fl_merge; /* Defined in freelist.c. */
|
||||
|
||||
static char *markhp, *chunk, *limit;
|
||||
static double p_backlog = 0.0; /* backlog for the gc speedup parameter */
|
||||
@@ -570,7 +570,7 @@ static void sweep_slice (intnat work)
|
||||
break;
|
||||
case Caml_blue:
|
||||
/* Only the blocks of the free-list are blue. See [freelist.c]. */
|
||||
- caml_fl_merge = Bp_hp (hp);
|
||||
+ caml_fl_merge = (value) Bp_hp (hp);
|
||||
break;
|
||||
default: /* gray or black */
|
||||
CAMLassert (Color_hd (hd) == Caml_black);
|
||||
diff --git a/runtime/spacetime_byt.c b/runtime/spacetime_byt.c
|
||||
index 2b0bf1dc2..b75fb0980 100644
|
||||
--- a/runtime/spacetime_byt.c
|
||||
+++ b/runtime/spacetime_byt.c
|
||||
@@ -12,8 +12,12 @@
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
+#define CAML_INTERNALS
|
||||
+
|
||||
#include "caml/fail.h"
|
||||
#include "caml/mlvalues.h"
|
||||
+#include "caml/io.h"
|
||||
+#include "caml/spacetime.h"
|
||||
|
||||
int caml_ensure_spacetime_dot_o_is_included = 42;
|
||||
|
||||
@@ -22,7 +26,8 @@ CAMLprim value caml_spacetime_only_works_for_native_code(value foo, ...)
|
||||
caml_failwith("Spacetime profiling only works for native code");
|
||||
}
|
||||
|
||||
-uintnat caml_spacetime_my_profinfo (void)
|
||||
+uintnat caml_spacetime_my_profinfo (spacetime_unwind_info_cache * cached,
|
||||
+ uintnat wosize)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.32.0
|
||||
|
@ -0,0 +1,114 @@
|
||||
From acdc441ff1acb5390467e649bc9a9bfddd7df774 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Weimer <fweimer@redhat.com>
|
||||
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
|
||||
|
@ -1,103 +0,0 @@
|
||||
From 24a9db7784ddfcf0af2d2be2f51616ed960ae7e8 Mon Sep 17 00:00:00 2001
|
||||
From: Xavier Leroy <xavierleroy@users.noreply.github.com>
|
||||
Date: Fri, 5 Mar 2021 19:14:07 +0100
|
||||
Subject: [PATCH 6/6] Dynamically allocate the alternate signal stack (#10266)
|
||||
|
||||
In Glibc 2.34 and later, SIGSTKSZ may not be a compile-time constant.
|
||||
It is no longer possible to statically allocate the alternate signal
|
||||
stack for the main thread, as we've been doing for the last 25 years.
|
||||
|
||||
This commit implements dynamic allocation of the alternate signal stack
|
||||
even for the main thread. It reuses the code already in place to allocate
|
||||
the alternate signal stack for other threads.
|
||||
|
||||
Fixes: #10250.
|
||||
(cherry picked from commit fc9534746bf5d08a4c109f22e344cf49d5d46d54)
|
||||
---
|
||||
runtime/caml/signals.h | 2 +-
|
||||
runtime/signals_byt.c | 2 +-
|
||||
runtime/signals_nat.c | 25 ++++++++++++++-----------
|
||||
3 files changed, 16 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/runtime/caml/signals.h b/runtime/caml/signals.h
|
||||
index 7ec1ad3ba..98b75107b 100644
|
||||
--- a/runtime/caml/signals.h
|
||||
+++ b/runtime/caml/signals.h
|
||||
@@ -82,7 +82,7 @@ void caml_set_action_pending (void);
|
||||
value caml_do_pending_actions_exn (void);
|
||||
value caml_process_pending_actions_with_root (value extra_root); // raises
|
||||
int caml_set_signal_action(int signo, int action);
|
||||
-void caml_setup_stack_overflow_detection(void);
|
||||
+CAMLextern int caml_setup_stack_overflow_detection(void);
|
||||
|
||||
CAMLextern void (*caml_enter_blocking_section_hook)(void);
|
||||
CAMLextern void (*caml_leave_blocking_section_hook)(void);
|
||||
diff --git a/runtime/signals_byt.c b/runtime/signals_byt.c
|
||||
index 040de03c5..9bd2b20c6 100644
|
||||
--- a/runtime/signals_byt.c
|
||||
+++ b/runtime/signals_byt.c
|
||||
@@ -86,4 +86,4 @@ int caml_set_signal_action(int signo, int action)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-void caml_setup_stack_overflow_detection(void) {}
|
||||
+CAMLexport int caml_setup_stack_overflow_detection(void) { return 0; }
|
||||
diff --git a/runtime/signals_nat.c b/runtime/signals_nat.c
|
||||
index fc5a77f84..f56fce6b7 100644
|
||||
--- a/runtime/signals_nat.c
|
||||
+++ b/runtime/signals_nat.c
|
||||
@@ -195,8 +195,6 @@ DECLARE_SIGNAL_HANDLER(trap_handler)
|
||||
#error "CONTEXT_SP is required if HAS_STACK_OVERFLOW_DETECTION is defined"
|
||||
#endif
|
||||
|
||||
-static char sig_alt_stack[SIGSTKSZ];
|
||||
-
|
||||
/* Code compiled with ocamlopt never accesses more than
|
||||
EXTRA_STACK bytes below the stack pointer. */
|
||||
#define EXTRA_STACK 256
|
||||
@@ -282,28 +280,33 @@ void caml_init_signals(void)
|
||||
#endif
|
||||
|
||||
#ifdef HAS_STACK_OVERFLOW_DETECTION
|
||||
- {
|
||||
- stack_t stk;
|
||||
+ if (caml_setup_stack_overflow_detection() != -1) {
|
||||
struct sigaction act;
|
||||
- stk.ss_sp = sig_alt_stack;
|
||||
- stk.ss_size = SIGSTKSZ;
|
||||
- stk.ss_flags = 0;
|
||||
SET_SIGACT(act, segv_handler);
|
||||
act.sa_flags |= SA_ONSTACK | SA_NODEFER;
|
||||
sigemptyset(&act.sa_mask);
|
||||
- if (sigaltstack(&stk, NULL) == 0) { sigaction(SIGSEGV, &act, NULL); }
|
||||
+ sigaction(SIGSEGV, &act, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
-void caml_setup_stack_overflow_detection(void)
|
||||
+/* Allocate and select an alternate stack for handling signals,
|
||||
+ especially SIGSEGV signals.
|
||||
+ Each thread needs its own alternate stack.
|
||||
+ The alternate stack used to be statically-allocated for the main thread,
|
||||
+ but this is incompatible with Glibc 2.34 and newer, where SIGSTKSZ
|
||||
+ may not be a compile-time constant (issue #10250). */
|
||||
+
|
||||
+CAMLexport int caml_setup_stack_overflow_detection(void)
|
||||
{
|
||||
#ifdef HAS_STACK_OVERFLOW_DETECTION
|
||||
stack_t stk;
|
||||
stk.ss_sp = malloc(SIGSTKSZ);
|
||||
+ if (stk.ss_sp == NULL) return -1;
|
||||
stk.ss_size = SIGSTKSZ;
|
||||
stk.ss_flags = 0;
|
||||
- if (stk.ss_sp)
|
||||
- sigaltstack(&stk, NULL);
|
||||
+ return sigaltstack(&stk, NULL);
|
||||
+#else
|
||||
+ return 0;
|
||||
#endif
|
||||
}
|
||||
--
|
||||
2.32.0
|
||||
|
@ -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
|
||||
|
@ -0,0 +1,178 @@
|
||||
From 4eb80b13779125fcd76a445ab0004ca064fab634 Mon Sep 17 00:00:00 2001
|
||||
From: Miod Vallat <miod@tarides.com>
|
||||
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
|
||||
|
@ -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}}
|
@ -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)
|
Loading…
Reference in new issue