Conversation
Previously Windows unconditionally uses `cp`, doubling the size required for the OCaml binaries. `configure` now determines if `ln` creates native symlinks and only uses `cp` if that fails. Users of the compiler are simply required to enable Developer Mode (or build OCaml using an elevated shell). (cherry picked from commit b082fd1)
Slightly easier detection, and a somewhat hardened implementation. (cherry picked from commit e0467cc)
Co-authored-by: David Allsopp <david.allsopp@metastack.com> (cherry picked from commit 49755db)
(cherry picked from commit c815cfa)
echo cannot portably be used to display strings containing backslashes and the echo builtin in dash in particular always transforms \\ to \ which breaks the transformation in sak. Use printf instead. Co-authored-by: Samuel Hym <samuel@tarides.com> (cherry picked from commit 9d31646)
Previously, the flexdll support objects were placed in both byte/bin and opt/bin with the copy of flexlink.exe when flexlink was being bootstrapped with OCaml. The objects are small, so the copying was not particulary onerous. However, if opt/bin/flexlink.exe is a native Windows symlink (pointing to ../../flexlink.opt.exe) then Sys.executable_name when flexlink runs will point to the wrong place. While flexlink ought to be checking Sys.argv.(0) rather than Sys.executable_name, a better hardening is to be explicit and set the FLEXDIR environment variable to point to the directory containing the support objects. This also allows byte/bin/flexlink.exe and opt/bin/flexlink.exe to share the same copy of the objects. (cherry picked from commit 8447496)
Unify the two executable header implementations (cherry picked from commit 076b435)
Relocatable OCaml - explicit-relative paths in `ld.conf` (cherry picked from commit 1e05f34)
boot/ocamlc doesn't yet support -set-runtime-default and %standard_library_default.
Misc.String.to_utf_8_seq was added in PR#14014 for the testsuite, but isn't part of the backport. It's only needed in Bytelink, so share it from there instead.
boot/ocamlc still uses the old runtime-launch-info format and doesn't yet support -launch-method or -runtime-search.
Config.shebangscripts was added in PR#14014 for the testuiste, but isn't part of the backport. Similarly, Bytelink.read_runtime_launch_info was exposed, only to be deleted as part of PR#14245, so the backport cuts out this intermediate step by temporarily copying Bytelink.read_rutime_launch_info, which therefore needs deleting here.
- Byterntm removed from ocamlbytecomp and linked directly in
ocamlobjinfo (the test-in-prefix driver likewise links it directly)
- Cmm_helpers.emit_global_string_constant inlined into its single use in
Asmlink.make_startup_file
- Compenv.parse_runtime_parameter inlined into its single use in
Main_args and Compenv.fatalf consequently removed
- Config.as_is_cc moved to Toolchain.as_is_cc
- Config.target_{unix,win32,cygwin} removed and uses of
Config.target_win32 inlined
Virtually elimates changes to the runtime headers: - caml_parse_ld_conf (protected by CAML_INTERNALS) changes arguments, but this function was already checked for not being used outside the runtime as part of OCaml 5.5 - exec.h now includes <stdint.h> (protected by CAML_INTERNALS) - version.h now defines OCAML_RELEASE_NUMBER
In OCaml 5.5, the suffixing mode is enabled by default. For compatibility, the backports only enable this mode by default if --enable-runtime-search and/or --enable-runtime-search-target is specified (the usual validation rules for these flags still applies - i.e. --disable-suffixing is still prohibited if either --enable-runtime-search or --enable-runtime-search-target is specified)
Cmo_format.library.lib_dllibs is able to change type without a bootstrap because the bootstrap cycle never reads a .cma which has any entries for dllibs (it fundamentally can't, because that would imply a dependency on dynamic loading, which isn't permitted in ultra-portable bootstrap) However, the format absolutely cannot change without ultimately changing the cma magic number, which is non-trivial, because we don't normally change the magic numbers in maintenance releases, and the numbering scheme consequently doesn't reserve space for them. This is worked around instead by leaving Cmo_format.library unaltered and instead writing a _second_ list after the Cmo_format.library in the cma format. This list is guarded with the cma magic number, but written in reverse. If this magic number is present, then the list must follow and must be the same length as lib_dllibs. If the magic number is not present, then the suffixed member of each lib_dllibs is assumed to be false, which is used also used as an "optimisation" to avoid writing the extra list at all when none of entries have suffixed:true.
As with Cmo_format.library, the type of Cmx_format.unit_infos cannot change without changing the cmx and cmxa magic numbers, which is similarly awkward. The workaround here is slightly simpler, if also somewhat more devious. Cmx_format.unit_infos is handily a fully mutable record, meaning that there are few if any optimisation assumptions which will ever be made around it. For the compiler, the interface is altered to add Compilenv.needs_stdlib_location which takes a Cmx_format.unit_infos and "accesses" its ui_need_stdlib field. In parallel, Compilenv.write_unit_info gains an optional ui_need_stdlib argument which allows the field to be specified when a Cmx_format.unit_infos is written to a file. The devious part is that instead of writing a Cmx_format.unit_infos value, Compilenv.write_unit_info writes a tuple with one extra element for the ui_need_stdlib field to be added in. Compilenv.needs_stdlib_location looks to see if the Cmx_format.unit_infos it has been passed in fact contains an extra field in the block and, if it does, reads it.
Improve installation time in opam by shrinking the Git-generated source archives (cherry picked from commit 172b5c5)
dra27
force-pushed
the
relocatable-ocaml-5.3
branch
from
September 3, 2026 10:59
6b1c5cf to
e22c7e5
Compare
dra27
force-pushed
the
relocatable-ocaml-5.3
branch
from
September 3, 2026 11:01
d3e8ec4 to
e22c7e5
Compare
dra27
force-pushed
the
relocatable-ocaml-5.3
branch
from
September 3, 2026 13:41
e22c7e5 to
cbe13b4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.