Skip to content
Success

Changes

Summary

  1. Xcode 16 / macOS 15 (details)
  2. Add --with-stublibs configure option (details)
  3. Don't add a double-separator when locating ld.conf (details)
  4. ld.conf-relative path interpretation (details)
  5. Generate ld.conf using relative paths (details)
  6. Load ld.conf from all possible places (details)
  7. Remove caml_get_stdlib_location (details)
  8. Harden the parsing of ld.conf w.r.t. load and CRLF (details)
  9. Use caml_parse_ld_conf in ocamlc (details)
  10. Tidy installation of static builds (details)
  11. Fix the detection of Cygwin-like build environments (details)
  12. Preserve backslashes in --prefix (details)
  13. Harden startup of -custom executables (details)
  14. Interpret . in runtime-launch-info (details)
  15. Add --with-relative-libdir configure option (details)
  16. Add caml_standard_library_default to the runtime (details)
  17. Add -set-runtime-default (details)
  18. Add %standard_library_default (details)
  19. Bootstrap (details)
  20. Use %standard_library_default in Config (details)
  21. Allow libdir to be found relative to bindir (details)
  22. Update the installation test for enable-relative (details)
  23. Test --with-relative-libdir in CI (details)
  24. NFPR: fully test --with-relative-libdir in precheck (details)
  25. Use as directly on Cygwin, as on Linux (details)
  26. Detect but ignore -fdebug-prefix-map on mingw-w64 (details)
  27. Increase reproducibility of relative artefacts (details)
  28. Typo in stdlib/Makefile (details)
  29. Reduce tmpheader.exe to 4-5KiB on Windows (details)
  30. Stop using Caml_inline and Camlnoret in headernt.c (details)
  31. Remove unnecessary guards around unistd.h (details)
  32. Use PATH_MAX instead of MAXPATHLEN (details)
  33. Assume S_ISREG and SEEK_END (details)
  34. Move O_BINARY definition to "header" section (details)
  35. Make caml/exec.h independent (details)
  36. Re-order some header functions (no-op) (details)
  37. Share error path in headernt.c (details)
  38. Unify implementation of read_size (details)
  39. headernt.c: inline run_runtime into main (details)
  40. Check for errors from lseek in header.c (details)
  41. Refactor error display code (details)
  42. header.c: close bytecode image before exec (details)
  43. Tweak the signature of read_runtime_path (details)
  44. Use execvp in header.c (as in headernt.c) (details)
  45. headernt: make read_runtime_path more CRTish (details)
  46. Missing error case in headernt.c (details)
  47. Unify the common parts of header.c and headernt.c (details)
  48. Merge stdlib/header{,nt}.c (details)
  49. Add -launch-method to ocamlc (details)
  50. Test both bytecode header methods (details)
  51. Determine RuntimeID values in configure (details)
  52. Put Bytecode RuntimeID in runtime-launch-info (details)
  53. Bootstrap (details)
  54. Mangle the bytecode runtime names (details)
  55. Build suffixed shared runtimes (details)
  56. Add Zinc RuntimeID Mask for portability (details)
  57. Compute the Zinc runtime ID in the linker (details)
  58. Bootstrap (details)
  59. Remove Bytecode RuntimeID in runtime-launch-info (details)
  60. Add runtime suffixes to bytecode stub libraries (details)
  61. Make Windows header absolute (as on Unix) (details)
  62. Add -runtime-search to ocamlc (details)
  63. Tweak the type (details)
  64. Add --enable-runtime-search[-target] options (details)
  65. Update the installation test for camlheader-search (details)
  66. Use Config instead of runtime-launch-info (details)
  67. Update the test (details)
  68. Test --enable-runtime-search in CI (details)
  69. Compute the Zinc runtime ID (details)
  70. Bootstrap (details)
  71. NFPR: fully test --enable-runtime-search in precheck (details)
  72. Move caml_search_dll_in_path to dynlink.c (details)
  73. header.c: remove unnecessary Cygwin workaround (details)
  74. Remove caml_cds_file (details)
  75. Simplify the interface of caml_attempt_open (details)
  76. header.c: handle parasitic case of argc < 1 (details)
  77. header.c: malloc the result of searchpath (details)
  78. Move searchpath from header.c into the runtime (details)
  79. Use caml_executable_name in header.c (details)
  80. Don't check for shebang scripts on Windows (details)
  81. Preserve argv[0] on Unix in the executable header (details)
  82. Harden the cloexec.ml test on Windows (details)
  83. Possible alternate approach... (details)
  84. ... and the bug-fix which goes with it (details)
  85. Fix STARTUPINFO structure in stdlib/header.c (details)
  86. Share image fd between header.c and startup_byt.c (details)
  87. Add comments on the handling of blank env vars (details)
  88. Ignore empty TMPDIR in the Filename module (details)
  89. Ignore empty TMPDIR in ocamlyacc (details)
  90. Propagate non-empty tmpdir in ocamlyacc (details)
  91. Ignore CAML_DEBUG_FILE if it's "Set But Null" (details)
  92. Ignore OCAMLPROF_DUMP if it's "Set But Null" (details)
  93. Use non-raising Sys.getenv_opt in win32unix (details)
  94. Ignore empty strings in Compmisc.set_from_env (details)
  95. Ignore empty environment variables in ocamltest (details)
  96. Ignore empty MAKE variable in ocamltest (details)
  97. Treat OCAML_BINANNOT_WITHENV as unset when empty (details)
  98. Harden processing of SOURCE_DATE_EPOCH in ocamldoc (details)
  99. Add some limited information about CAMLSIGPIPE (details)
  100. Ignore empty OCAML_RUNTIME_EVENTS_ variables (details)
  101. Ignore blank OCAMRUNPARAM, OCAMLLIB and CAMLLIB (details)
  102. Ignore empty components in PATH-like things (details)
  103. Fix C library options for win32unix (details)
  104. Build and install threads.cmxs (details)
  105. Fix inclusion of libraries when partial linking (details)
  106. Use entrypoint flexdll branch (details)
  107. Revert "accept unknown options" (details)
  108. Stop installing and documenting config_main, etc. (details)
  109. Use clang-cl for flexdll support objects (details)
  110. Add %shared_libraries primitive (details)
  111. Bootstrap (details)
  112. Improve the "dynamic loading not supported" error (details)
  113. Free tables after handing off to Dynlink (details)
  114. Move print_magic and print_config out of caml_params (details)
  115. Preserve option R in caml_runtime_parameters (details)
  116. Swap the V and v in caml_runtime_parameters (details)
  117. Add -set-runtime-default to the compilers (details)
  118. Test -set-runtime-default in test-in-prefix (details)
  119. Re-order initialisations in bytecode (details)
  120. Support c=1 mode in ocamlrun (details)
Commit baba9257616ab49e2cd2203a66c1bd3f39473bad by david.allsopp
Xcode 16 / macOS 15
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit bd7c392edf384a6e904176d56fdede2b02194d5d by david.allsopp
Add --with-stublibs configure option

--with-stublibs is intended for use in opam and allows an additional
directory to be added at the top of $(ocamlc -where)/ld.conf.
The file was modifiedconfigure.ac
The file was modifiedconfigure
The file was modifiedMakefile
The file was modifiedocaml-variants.opam
Commit dea4758baa9a65e2886bbfc1215f64061f0a0bf1 by david.allsopp
Don't add a double-separator when locating ld.conf

When calculating the full path for ld.conf, the runtime unconditionally
concatenated "/ld.conf". This is harmless when the separators appear in
the middle of a path ("/usr/local/lib/ocaml//ld.conf" is equivalent to
the version with only single slashes), but it is technically incorrect
for two corners cases with OCAMLLIB and CAMLLIB:

- if either is explicitly set to "/" then "//ld.conf" is _not_ the same
  file as "/ld.conf". This is mildly relevant on Windows and Cygwin
  where the two initial slashes (including as "\/" for native Windows)
  will be interpreted as a UNC path
- if either is explicitly blank, then "ld.conf" (i.e. ld.conf in the
  current directory) is a less illogical file to open than "/ld.conf"
The file was modifiedruntime/caml/osdeps.h
The file was modifiedruntime/dynlink.c
Commit 5ed071788f5c3e16955c285f5a7c502005fe8963 by david.allsopp
ld.conf-relative path interpretation

Explicit relative paths in ld.conf are now interpreted relative to the
directory containing ld.conf.
The file was modifiedruntime/caml/osdeps.h
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedbytecomp/dll.ml
The file was modifiedruntime/dynlink.c
Commit d8950ae7641981e3a621ee0534c8b3ad0837261b by david.allsopp
Generate ld.conf using relative paths
The file was modifiedtestsuite/in_prefix/README.md
The file was modifiedconfigure
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedconfigure.ac
The file was modifiedocaml-variants.opam
Commit fba6a2ec1a54d8ce85881a3474ea05a1c06051c3 by david.allsopp
Load ld.conf from all possible places

Before, the first ld.conf found from $OCAMLLIB, $CAMLLIB or the
preconfigured standard library location was loaded. Now all of these
are loaded.
The file was modifiedruntime/dynlink.c
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedutils/config.mli
The file was modifiedmanual/src/cmds/runtime.etex
The file was modifiedruntime/caml/dynlink.h
The file was modifiedbytecomp/dll.ml
Commit 0f6e15cc36729c44a716c6790425fdf0c2fe98f2 by david.allsopp
Remove caml_get_stdlib_location

The function was only ever added to share the logic between dynlink.c
and startup_byt.c - now that dynlink.c doesn't require it, move the
function to startup_byt.c and make it internal again.
The file was modifiedruntime/dynlink.c
The file was modifiedruntime/startup_byt.c
The file was modifiedruntime/caml/dynlink.h
Commit 3b5cbe2e3d80752bcaca0c08d2c0865d52163f74 by david.allsopp
Harden the parsing of ld.conf w.r.t. load and CRLF
The file was modifiedruntime/dynlink.c
The file was modifiedbytecomp/dll.ml
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit d8d2698718d0a5611d906b3865f52dff5404ae23 by david.allsopp
Use caml_parse_ld_conf in ocamlc

Eliminate the need for two implementations of the parsing logic for
ld.conf by sharing the C implementation (which must exist, since it's
part of bytecode startup) with the bytecode compiler, replacing
Dll.ld_conf_contents
The file was modifiedbytecomp/dll.ml
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedruntime/dynlink.c
The file was modifiedruntime/caml/dynlink.h
The file was modifiedruntime/startup_byt.c
Commit f8fb79c5917b109084c34cf5097492e5cfbe463a by david.allsopp
Tidy installation of static builds

- $libdir/stublibs is no longer created for a --disable-shared build
- When $libdir/stublibs is not created, it is also not added to ld.conf
The file was modifiedconfigure
The file was modifiedconfigure.ac
The file was modifiedMakefile
The file was modifiedotherlibs/systhreads/Makefile
The file was modifiedotherlibs/Makefile.otherlibs.common
Commit 32c07e16f0d0663b59cc72c77618d54d8c4658d6 by david.allsopp
Fix the detection of Cygwin-like build environments

Both Cygwin and MSYS2 are now consistently detected on MSYS2. In
particular, this means that ./configure --prefix $PWD/install and
similar will cause the prefix to be correctly translated to a Windows
path, as already happens on Cygwin.
The file was modifiedconfigure
The file was modifiedconfigure.ac
Commit 478ea61b892f5528efbbf0dd6a94d9b0a84ed23a by david.allsopp
Preserve backslashes in --prefix

Previously, the --prefix argument was always normalised with cygpath -m
which meant that regardless of the argument, the paths used in the
compiler would always use slashes.

This behaviour is preserved if a slash is detected in the argument, i.e.
the caller explicitly uses mixed notation (e.g. `--prefix=C:/Prefix` or
`--prefix $PWD/install`). In particular, it means that a Cygwin-style
path will be correctly converted to a Windows-style path.

If the path uses backslashes, then it is still converted to use forward
slashes for the installation commands, but the backslashes are otherwise
preserved and used within the build itself.
The file was modifiedtools/ci/appveyor/appveyor_build.sh
The file was modifiedconfigure
The file was modified.github/workflows/build-msvc.yml
The file was modifiedconfigure.ac
Commit 4ebf0c1ab34b215d575a7ef91c0aaf553205eb86 by david.allsopp
Harden startup of -custom executables

By default, ocamlrun first tries to resolve argv[0] to determine where
the bytecode image is and then tries opening the executable image
itself. This is obviously correct for ocamlrun, when being called using
a shebang or executable header, but it's not correct for -custom
executables where we _know_ that the bytecode image should be with the
executable. To achieve this, a new mode is added to
caml_byte_program_mode (and the existing ones renamed) such that
caml_byte_program_mode is now STANDARD (for ocamlrun - the existing
behaviour), APPENDED (for -custom executables - the new behaviour) and
EMBEDDED (for -output-complete-exe/-output-obj - the original use of
it).

The mode is also set directly by the linker, rather than having a
default in libcamlrun which is then overridden by the startup code for
-output-complete-exe.

In the new APPENDED mode, if caml_executable_name is implemented (i.e.
it returns a string) then this file _must_ contain the bytecode image
and no other mechanisms are used. On platforms where
caml_executable_name is not implemented, APPENDED falls back to STANDARD
for compatibility.

Technically, this stops an argv[0] injection attack on setuid/setgid
-custom bytecode executables, although setuid should be used with
-output-complete-exe, if at all.
The file was modifiedruntime/backtrace_byt.c
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedbytecomp/bytelink.ml
The file was modifiedruntime/gen_primsc.sh
The file was modifiedruntime/caml/startup.h
The file was modifiedruntime/startup_byt.c
Commit c7c3889c6a6ee743ae055cfc99a26c0da403e88e by david.allsopp
Interpret . in runtime-launch-info

The runtime-launch-info file includes the location of the binary
directory. The compiler is extended so that . refers to the directory of
the compiler binary.
The file was modifiedbytecomp/bytelink.ml
The file was modifiedboot/ocamllex
The file was modifiedboot/ocamlc
Commit 54afc9c8a63705cbf3c6e19638746562e2376c1e by david.allsopp
Add --with-relative-libdir configure option

--with-relative-libdir can be used instead of --libdir to specify a
directory relative to --bindir which is used by the compiler to compute
the location of the Standard Library.
The file was modifiedconfigure
The file was modifiedconfigure.ac
The file was modifiedMakefile.build_config.in
Commit e8b3a3cd4ef7b83fdee5304a4cb1924d5ee3f2ba by david.allsopp
Add caml_standard_library_default to the runtime

Previously, the bytecode runtime just use OCAML_STDLIB_DIR from
build_config.h. This value is now stored once in stdlib.o as
caml_standard_library_default.
The file was modifiedruntime/startup_byt.c
The file was modifiedruntime/caml/startup.h
The file was addedruntime/stdlib.c
The file was modifiedMakefile
The file was modifiedruntime/dynlink.c
Commit 18fc50bd858052819683227671ff469d2fb9e0d3 by david.allsopp
Add -set-runtime-default

Allows the default location used by the bytecode runtime for the
Standard Library to be overridden when creating bytecode executables.
The file was modifiedMakefile
The file was modifiedutils/config.common.ml.in
The file was modifiedutils/clflags.mli
The file was modifieddriver/maindriver.ml
The file was modifiedutils/config.mli
The file was modifieddriver/compenv.ml
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifieddriver/compenv.mli
The file was modifiedutils/clflags.ml
The file was modifiedbytecomp/bytelink.ml
The file was modifieddriver/main_args.mli
The file was modifieddriver/optmaindriver.ml
The file was modifieddriver/main_args.ml
Commit 8b93714b8a6baa6762d6aa0f08d07d755719e035 by david.allsopp
Add %standard_library_default
The file was modifiedlambda/translprim.ml
The file was modifiedbytecomp/bytesections.ml
The file was modifiedasmcomp/asmpackager.ml
The file was modifiedlambda/lambda.ml
The file was modifiedlambda/lambda.mli
The file was modifiedmiddle_end/compilenv.ml
The file was modifiedfile_formats/cmx_format.mli
The file was modifiedruntime/sys.c
The file was modifiedasmcomp/cmm_helpers.mli
The file was modifiedmiddle_end/closure/closure.ml
The file was modified.depend
The file was modifiedruntime/startup_byt.c
The file was modifiedtools/objinfo.ml
The file was modifiedmiddle_end/compilenv.mli
The file was modifiedbytecomp/bytelink.ml
The file was modifiedmiddle_end/flambda/closure_conversion.ml
The file was modifiedbytecomp/bytegen.ml
The file was modifiedbytecomp/bytesections.mli
The file was modifiedasmcomp/asmlink.ml
The file was modifiedasmcomp/cmm_helpers.ml
The file was modifiedlambda/printlambda.ml
Commit a3066e2e3d61a920f95205cab2c5d142f4c95529 by david.allsopp
Bootstrap
The file was modifiedboot/ocamlc
The file was modifiedboot/ocamllex
Commit 22ad2fc8db8cb0f5cf3ee611e3902037e164112c by david.allsopp
Use %standard_library_default in Config
The file was modifiedMakefile.build_config.in
The file was modifiedutils/config.generated.ml.in
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedMakefile.cross
Commit 894b3869f7613eb0d4416b770a654964d6c83682 by david.allsopp
Allow libdir to be found relative to bindir

When configured with --with-relative-libdir, the runtime uses the
directory of the executable to determine the location of the Standard
Library. Thus, ocamlrun and the compilers look for ../lib/ocaml by
default.

This is implemented by changing caml_standard_library_default to be a
relative path, and then computing the actual value at startup (for
bytecode) and when queried (for native, since it is only ever used if
Dynlink is being used).

Executables (and objects) produced by the compiler always have an
absolute value of caml_standard_library_default. ocamlc.opt and
ocamlopt.opt are built using -set-global-string to force
caml_standard_library_default to stay a relative value.
The file was modifiedocamltest/ocaml_tests.ml
The file was modifiedocamltest/ocamltest_config.mli
The file was modifiedutils/config.common.ml.in
The file was modifiedruntime/unix.c
The file was modifiedruntime/stdlib.c
The file was modifiedocamltest/ocamltest_config.ml.in
The file was modifiedbytecomp/dll.ml
The file was modifiedruntime/caml/sys.h
The file was modifiedruntime/dynlink.c
The file was modifiedconfigure
The file was modifiedruntime/startup_nat.c
The file was modifiedconfigure.ac
The file was modifiedbytecomp/bytelink.ml
The file was modifiedtools/stripdebug.ml
The file was modifiedutils/config.generated.ml.in
The file was modifiedasmcomp/asmlink.ml
The file was modifiedruntime/startup_aux.c
The file was modifiedMakefile
The file was modifiedutils/config.fixed.ml
The file was modifiedruntime/sys.c
The file was modifiedruntime/caml/osdeps.h
The file was modifiedruntime/caml/s.h.in
The file was modifiedMakefile.common
The file was modifiedruntime/caml/startup_aux.h
The file was modifiedtools/ocamlmklib.ml
The file was modifiedruntime/win32.c
The file was modifiedutils/config.mli
The file was modifiedruntime/caml/startup.h
The file was modifiedruntime/startup_byt.c
Commit b0a62da885f6d9f82e819799f9289925caa6bc43 by david.allsopp
Update the installation test for enable-relative
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedtestsuite/in_prefix/Makefile.test
The file was modifiedtestsuite/in_prefix/README.md
Commit bf9b87143c731ea7c014fd91a785ba0044d053b9 by david.allsopp
Test --with-relative-libdir in CI
The file was modified.github/workflows/build.yml
The file was modifiedappveyor.yml
The file was modifiedtools/ci/appveyor/appveyor_build.sh
The file was modifiedMakefile
The file was modifiedtools/ci/actions/runner.sh
The file was modified.github/workflows/build-msvc.yml
Commit f0e7614031899f72eb763d20b06891a9f26b4bb7 by david.allsopp
NFPR: fully test --with-relative-libdir in precheck
The file was modifiedtools/ci/inria/main
Commit 2bec8f7e05e5dae6b4e2d10446ac7d1f2e0a638e by david.allsopp
Use as directly on Cygwin, as on Linux
The file was modifiedconfigure.ac
The file was modifiedconfigure
Commit d68147550cf557de2bb4daf17be46f18fa4b2527 by david.allsopp
Detect but ignore -fdebug-prefix-map on mingw-w64

mingw-w64 is based on GCC, so supports -fdebug-prefix-map, but the test
for it is skipped in configure. The test is no longer skipped (which
means that Config.c_has_debug_prefix_map returns true) but the flag is
still explicitly not used by the compilers (as before).
The file was modifiedutils/ccomp.ml
The file was modifiedconfigure
The file was modifiedconfigure.ac
Commit 0a2287d94b5c27bc4d7fa0624d49af0074789e27 by david.allsopp
Increase reproducibility of relative artefacts
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedtestsuite/tests/native-debugger/linux-lldb-amd64.ml
The file was modifiedconfigure
The file was modifiedMakefile.common
The file was modifiedconfigure.ac
The file was modifiedtestsuite/tests/native-debugger/linux-lldb-arm64.ml
The file was modifiedtestsuite/tests/tool-debugger/find-artifacts/debuggee.ml
Commit 1da346fd5282118231e18435efa59f9b98002e7f by david.allsopp
Typo in stdlib/Makefile

Affects forced recompilation of runtime-launch-info
The file was modifiedstdlib/Makefile
Commit 48c95fb467298ca95220d7407c55fb43f8af5e6b by david.allsopp
Reduce tmpheader.exe to 4-5KiB on Windows

stdlib/headernt.c was adapted in OCaml 3.00 to reduce its size by
avoiding the use of the CRT and using Windows API functions directly
(this is a well-studied trick on Windows, principally as a puzzle for
producing tiny binaries).

This got "regressed" slightly in OCaml 4.06, in the complex introduction
of wide character support for Windows, as the mingw-w64 incantation
required was unclear, so the entry point was changed to wmain, and the
size of the header increased.

By switching from wcslen (a CRT function) to lstrlen (a Win32 API
function), headernt.c again only requires kernel32.dll.

Additional flags are added for both ld (mingw-w64) and link (MSVC) to
squeeze every last byte out of tmpheader.exe. The MSVC version of the
header is once again no longer passed through strip, as this was found
to be corrupting the executable (and had never been reducing its size
anyway).
The file was modifiedstdlib/headernt.c
The file was modifiedstdlib/Makefile
Commit 099cf67f27a15a806f5d722ff0a47d653bd759d9 by david.allsopp
Stop using Caml_inline and Camlnoret in headernt.c

headernt.c will never be compiled with a C++ compiler, so _Noreturn can
be used directly, and modern C compilers are sufficiently intelligent to
work out when to inline!
The file was modifiedstdlib/headernt.c
Commit 00394a256ad9c136bb52b3f12a356453144526e2 by david.allsopp
Remove unnecessary guards around unistd.h

Already updated to remove the actual test in s.h, since XPG1 (1985)
required it and it is therefore part of the Single Unix
Specification (1992), but the _WIN32 guard and the loading of s.h are
unnecessary.
The file was modifiedstdlib/header.c
Commit 2d3da283fb822ac730f75bcff37fe5fb5fe67cc3 by david.allsopp
Use PATH_MAX instead of MAXPATHLEN
The file was modifiedstdlib/header.c
Commit 6840c5350584032b3b42b5a1d9ed7b28b6eeba4a by david.allsopp
Assume S_ISREG and SEEK_END

Defined in sys/stat.h and unistd.h respectively by the Single Unix
Specification.
The file was modifiedstdlib/header.c
Commit 82cae00dcd8498eeef2795c288a9813539267a5f by david.allsopp
Move O_BINARY definition to "header" section

O_BINARY is added for maximum Cygwin compatibility, but it's not a Posix
flag.
The file was modifiedstdlib/header.c
Commit bf81067520bf9aac9a59379e90ded737d5d72236 by david.allsopp
Make caml/exec.h independent

Have exec.h include <stdint.h> itself. The bytecode executable header
now only depends on exec.h.
The file was modifiedstdlib/header.c
The file was modifiedstdlib/headernt.c
The file was modifiedruntime/caml/exec.h.in
Commit 6a29c243ad85efa13a153c15b3aed657c101accd by david.allsopp
Re-order some header functions (no-op)
The file was modifiedstdlib/header.c
The file was modifiedstdlib/headernt.c
Commit e0735ffe1b31537ef82b57d494c520f88fe75d9b by david.allsopp
Share error path in headernt.c
The file was modifiedstdlib/headernt.c
Commit 041c7a7db5b970392535a7fe141973736d98d4a5 by david.allsopp
Unify implementation of read_size

Modernisations applied in headernt.c but not applied to header.c - use
uint32_t rather than unsigned long
The file was modifiedstdlib/headernt.c
The file was modifiedstdlib/header.c
Commit ea531e6435415edc46ef544f7072f62cb0a82e03 by david.allsopp
headernt.c: inline run_runtime into main
The file was modifiedstdlib/headernt.c
Commit 20bd9c686c66ac26ba54bd14121bbee5e07d6620 by david.allsopp
Check for errors from lseek in header.c
The file was modifiedstdlib/header.c
Commit fe180aad5502de6a5224ac2dee97c6940ba4b27b by david.allsopp
Refactor error display code
The file was modifiedstdlib/header.c
The file was modifiedstdlib/headernt.c
Commit a9eef9a21fc7928501f0752aebca253f5ae638eb by david.allsopp
header.c: close bytecode image before exec

Leaking fd
The file was modifiedstdlib/header.c
Commit 07ce7b54ac5bbbe49093442c0e6a23551a49633a by david.allsopp
Tweak the signature of read_runtime_path
The file was modifiedstdlib/header.c
The file was modifiedstdlib/headernt.c
Commit db405ee41ae7f7fc33d90158513d339dd026fa9f by david.allsopp
Use execvp in header.c (as in headernt.c)

Brings the behaviour of the two headers into line with each other - if
RNTM is ocamlrun on Unix, ocamlrun will now be sought in PATH.
The file was modifiedstdlib/header.c
Commit 40785ced7ea20c704375599c21e3dbc98f0526ef by david.allsopp
headernt: make read_runtime_path more CRTish
The file was modifiedstdlib/headernt.c
Commit 817c3eb410b9c7451235ee226bb9d93da59d166e by david.allsopp
Missing error case in headernt.c
The file was modifiedstdlib/headernt.c
Commit d6a8ccef16b3984481a218297c07a6ea6e91e5ac by david.allsopp
Unify the common parts of header.c and headernt.c
The file was modifiedstdlib/header.c
The file was modifiedstdlib/headernt.c
Commit 3fb5aabfcdf9dd3f610286b4bd9bbf159a945499 by david.allsopp
Merge stdlib/header{,nt}.c
The file was modifiedstdlib/header.c
The file was removedstdlib/headernt.c
The file was modifiedtestsuite/in_prefix/README.md
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedstdlib/Makefile
Commit 6c7cff317a86406bf8fb0207ba3ec4455ae8406d by david.allsopp
Add -launch-method to ocamlc

When linking a normal bytecode executable, allows an explicit selection
of either the executable or shebang header, regardless of the value in
runtime-launch-info.
The file was modifieddriver/main_args.mli
The file was modifiedutils/clflags.ml
The file was modifiedbytecomp/bytelink.ml
The file was modifiedutils/clflags.mli
The file was modifieddriver/main_args.ml
Commit 8a9006bbc5c8fb51387417bd8e462949b1f86d6a by david.allsopp
Test both bytecode header methods
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedutils/config.fixed.ml
The file was modifiedutils/config.mli
The file was modifiedutils/config.generated.ml.in
Commit b46f7b4f60a2e224e89feda889d7a5e0262226e9 by david.allsopp
Determine RuntimeID values in configure
The file was modifiedbuild-aux/ocaml_version.m4
The file was modifiedMakefile
The file was modifiedutils/config.common.ml.in
The file was modifiedconfigure.ac
The file was modifiedutils/config.generated.ml.in
The file was modifiedconfigure
The file was modifiedutils/config.fixed.ml
The file was modifiedMakefile.build_config.in
The file was modifiedMakefile.config.in
The file was addedruntime/Mangling.md
The file was modifiedutils/config.mli
The file was modifiedruntime/caml/version.h.in
Commit 5da000ff483d9ee37bc8ce9c6fb271922de1c04a by david.allsopp
Put Bytecode RuntimeID in runtime-launch-info
The file was modifiedbytecomp/bytelink.ml
Commit f6d4995aadd4df9199e2b9d4c56f2e4db0513979 by david.allsopp
Bootstrap
The file was modifieddriver/main_args.ml
The file was modifiedboot/ocamlc
The file was modifiedbytecomp/bytelink.mli
The file was modifiedboot/ocamllex
Commit 7f6030aaf60c723114918ac5a6e155909211d9d1 by david.allsopp
Mangle the bytecode runtime names
The file was modifiedconfigure
The file was modifiedbytecomp/bytelink.ml
The file was modifiedMakefile
The file was modifiedruntime/startup_byt.c
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedconfigure.ac
Commit d7a33f1a5904fd05476b6df203bfcb4e24c926c1 by david.allsopp
Build suffixed shared runtimes

New names for libcamlrun_shared.so and libasmrun_shared.so without the
_shared suffix and using the target triplet and runtime ID. Both ocamlc
and ocamlopt explicitly recognise `-runtime-variant _shared` and select
the correct name.

Symbolic links for libcamlrun_shared.so and libasmrun_shared.so to allow
any C programs which linked against the the output of `-output-obj` to
continue to work.
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedMakefile
The file was modifiedasmcomp/asmlink.ml
The file was modifiedbytecomp/bytelink.ml
Commit 953e3fa9f9c02b955cf36c0fd8cc484e53621464 by david.allsopp
Add Zinc RuntimeID Mask for portability
The file was modifiedMakefile.build_config.in
The file was modifiedconfigure
The file was modifiedutils/config.generated.ml.in
The file was modifiedruntime/Mangling.md
The file was modifiedMakefile
The file was modifiedutils/config.fixed.ml
The file was modifiedutils/config.mli
The file was modifiedconfigure.ac
Commit 30850677a912d4062eee3f9fa4fe39ded329f34f by david.allsopp
Compute the Zinc runtime ID in the linker

WIP work towards the use int31 bit (not completed) and the
additional_runtimes setting is present, although it's to be removed.
The file was modifiedMakefile
The file was modifiedconfigure.ac
The file was modifiedutils/misc.ml
The file was modifiedutils/config.fixed.ml
The file was modifiedutils/config.generated.ml.in
The file was modifiedbytecomp/symtable.mli
The file was modifiedbytecomp/bytelink.ml
The file was modifiedconfigure
The file was modifiedutils/config.mli
The file was modifiedbytecomp/symtable.ml
The file was modifiedMakefile.build_config.in
The file was modifiedutils/misc.mli
The file was modifiedutils/config.common.ml.in
Commit 5c18131f546a41b2ee67e49043c434cfe8f87e43 by david.allsopp
Bootstrap
The file was modifiedboot/ocamlc
Commit bc9dcf2325b17f2e0f912964df1b49416a9d0a72 by david.allsopp
Remove Bytecode RuntimeID in runtime-launch-info
The file was modifiedconfigure
The file was modifiedconfigure.ac
The file was modifiedbytecomp/bytelink.ml
Commit 189b6f5f1097e3d355444d059cbd467b884256d7 by david.allsopp
Add runtime suffixes to bytecode stub libraries

ocamlc -dllib-suffixed appends the runtime's host triplet and bytecode
runtime ID to the supplied name when searching for the DLL, and records
the base name only in .cma / executable files.

ocamlmklib -suffixed instructs ocamlmklib to use -dllib-suffixed when
generating .cma files instead of -dllib.

The effect is that stub libraries built this way have names which will
be unique for a given configuration of OCaml and so will be ignored by
other runtimes.
The file was modifiedbytecomp/dll.ml
The file was modifiedotherlibs/systhreads/Makefile
The file was modifiedruntime/dynlink.c
The file was modifiedtools/ocamlmklib.ml
The file was modifieddriver/main_args.ml
The file was modifiedutils/clflags.mli
The file was modifieddriver/main_args.mli
The file was modifiedocamltest/ocaml_actions.ml
The file was modifieddriver/compenv.ml
The file was modifiedotherlibs/dynlink/byte/dynlink_symtable.ml
The file was modifiedotherlibs/dynlink/dynlink_config.ml.in
The file was modifiedfile_formats/cmo_format.mli
The file was modifieddriver/compenv.mli
The file was modifiedotherlibs/Makefile.otherlibs.common
The file was modifiedboot/ocamllex
The file was modifiedbytecomp/bytelink.mli
The file was modifiedbytecomp/dll.mli
The file was modifiedotherlibs/dynlink/byte/dynlink_symtable.mli
The file was modifiedotherlibs/dynlink/dynlink_config.mli
The file was modifiedboot/ocamlc
The file was modifiedutils/clflags.ml
The file was modifiedbytecomp/bytelink.ml
The file was modifiedtools/objinfo.ml
Commit 19d195002552f04162ce3e06ef107efc2ff45427 by david.allsopp
Make Windows header absolute (as on Unix)
The file was modifiedboot/ocamlc
The file was modifiedbytecomp/bytelink.ml
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit f203f34f1e8b81ba8c2279e4e677b5a962b305d7 by david.allsopp
Add -runtime-search to ocamlc

-runtime-search {disable|enable|always} adds new features to the
launcher used for bytecode executables which do not embed their own
runtime. By default, the header continues to behave as before - the
launcher will attempt to start the runtime using the absolute path which
the compiler was configured with.

The new search mode will then search for the runtime first in the
directory containing the running executable and then in PATH.
The file was modifiedstdlib/Makefile
The file was modifiedtools/ocamlsize
The file was modifiedutils/clflags.ml
The file was modifiedconfigure
The file was modifiedbytecomp/bytelink.ml
The file was modifieddriver/main_args.ml
The file was modifiedstdlib/header.c
The file was modifiedutils/clflags.mli
The file was modifiedconfigure.ac
The file was modifieddriver/main_args.mli
The file was modifiedruntime/caml/s.h.in
Commit 184a0c901a079d21f2d9a7aba498ef574d09270c by david.allsopp
Tweak the type
The file was modifiedutils/clflags.mli
The file was modifiedbytecomp/bytelink.ml
The file was modifieddriver/main_args.ml
The file was modifiedutils/clflags.ml
Commit e68250ecfb98bbccf5a813b47981c0a088d8769b by david.allsopp
Add --enable-runtime-search[-target] options

--enable-runtime-search controls the -runtime-search setting used to
build the compiler's own bytecode executables;
--enable-runtime-search-target controls the default value of
-runtime-search that ocamlc itself uses.
The file was modifiedconfigure.ac
The file was modifiedbytecomp/bytelink.ml
The file was modifieddriver/main_args.ml
The file was modifiedMakefile.build_config.in
The file was modifiedconfigure
The file was modifiedbytecomp/bytelink.mli
The file was modifiedboot/ocamlc
The file was modifiedutils/clflags.mli
Commit cdb9004a474610ee21be1449b5a600263241888d by david.allsopp
Update the installation test for camlheader-search
The file was modifiedtestsuite/in_prefix/Makefile.test
The file was modifiedtestsuite/in_prefix/README.md
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit c914cc0baa24c32373c958658a86f9406baa96d1 by david.allsopp
Use Config instead of runtime-launch-info
The file was modifiedutils/clflags.ml
The file was modifiedMakefile.common
The file was modifiedconfigure
The file was modifiedboot/ocamlc
The file was modifieddriver/main_args.ml
The file was modifiedMakefile.build_config.in
The file was modifiedbytecomp/bytelink.mli
The file was modifiedbytecomp/bytelink.ml
The file was modifiedutils/config.fixed.ml
The file was modifiedMakefile
The file was modifiedutils/config.generated.ml.in
The file was modifiedutils/clflags.mli
The file was modifiedutils/config.mli
The file was modifiedconfigure.ac
Commit 794b263df8ff6293ae0309774fdfb0024ee3b535 by david.allsopp
Update the test
The file was modifiedtestsuite/in_prefix/Makefile.test
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit 5e098544294d42d1f4d2d9921ce9355f3487b930 by david.allsopp
Test --enable-runtime-search in CI
The file was modifiedtools/ci/actions/runner.sh
The file was modifiedtools/ci/appveyor/appveyor_build.sh
The file was modified.github/workflows/build.yml
The file was modified.github/workflows/build-msvc.yml
Commit c7e222c1d00a21d4e5a8e2e21816ce83e011f755 by david.allsopp
Compute the Zinc runtime ID

WIP work towards the use int31 bit (not completed) and the
additional_runtimes setting is present, although it's to be removed.
The file was modifiedbytecomp/bytelink.ml
The file was modifiedstdlib/header.c
Commit d150e625475913d70fdf747d642744546f96682f by david.allsopp
Bootstrap
The file was modifiedboot/ocamlc
Commit fdbb1ad6e31fe9c2c82601e6833fe2d630b393bb by david.allsopp
NFPR: fully test --enable-runtime-search in precheck
The file was modifiedtools/ci/inria/main
Commit f73fda7aa18b09a5c654614afbfd2c058be91aa1 by david.allsopp
Move caml_search_dll_in_path to dynlink.c

Eliminates code duplication between unix.c and win32.c
The file was modifiedruntime/caml/osdeps.h
The file was modifiedruntime/unix.c
The file was modifiedruntime/dynlink.c
The file was modifiedruntime/win32.c
Commit 066bc1ab85a6c08187fbdf03a455eac7b0a3dba8 by david.allsopp
header.c: remove unnecessary Cygwin workaround

This is no longer required (nor does it work). Cygwin 1.5.20 (July 2006)
added the transparent_exe option to the CYGWIN environment variable which
made open behave in the same way as stat. Cygwin 1.7.1 (December 2009 and,
despite the version number, the first release of Cygwin 1.7) made this
behaviour default (and removed the ability to turn it off).
The file was modifiedstdlib/header.c
Commit 07ecf352274e9284aa53b4a63885bd936954c4b9 by david.allsopp
Remove caml_cds_file

OCaml 4.x global which should have been removed with OCaml 5.0
The file was modifiedruntime/caml/backtrace.h
The file was modifiedruntime/backtrace_byt.c
Commit 36bd2bf474d2baf96695ad620c83ee3ce1a5f3a9 by david.allsopp
Simplify the interface of caml_attempt_open

Previously, caml_attempt_open received a pointer to the string and
passed this string to caml_search_exe_in_path. This function allocates a
fresh string which was then assigned to that pointer.

This interface was a little cryptic to follow - in particular, there
were several scenarios in which the result was not being freed. It's
also not entirely clear that caml_attempt_open involved a PATH-search,
which appears to have been applied in error when CAML_DEBUG_FILE was
added.
The file was modifiedruntime/startup_byt.c
The file was modifiedruntime/backtrace_byt.c
The file was modifiedruntime/caml/startup.h
The file was modifiedruntime/startup_aux.c
Commit 66d74a0e9f76ebdf45bb00cf6276811798d9dc1a by david.allsopp
header.c: handle parasitic case of argc < 1
The file was modifiedstdlib/header.c
Commit 5c293f7ba862e22756c8ff91d06ec909fb3ae879 by david.allsopp
header.c: malloc the result of searchpath
The file was modifiedstdlib/header.c
Commit 0554548e5fa8a3f64735df44f0539a6bc74a7119 by david.allsopp
Move searchpath from header.c into the runtime

Merge the path-searching code from stdlib/header.c with the runtime's
version.
The file was modifiedruntime/caml/osdeps.h
The file was modifiedMakefile.cross
The file was modifiedMakefile
The file was addedruntime/unix_searchpath.c
The file was modifiedstdlib/Makefile
The file was modifiedstdlib/header.c
The file was modifiedruntime/unix.c
Commit 7583dd81f0d6df8a6e56fe0c98b8aaaf185f92b6 by david.allsopp
Use caml_executable_name in header.c
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was removedruntime/unix_searchpath.c
The file was modifiedMakefile
The file was modifiedruntime/unix.c
The file was addedruntime/unix_executable.c
The file was modifiedstdlib/header.c
Commit 3e35526d5216a834cabafa7f83f6d6f606f9559b by david.allsopp
Don't check for shebang scripts on Windows

Bytecode startup includes a check which has no place on Windows.
The file was modifiedruntime/startup_byt.c
Commit 0899ad41b8fcfd0f00ff1221322ff5f0e41dffd9 by david.allsopp
Preserve argv[0] on Unix in the executable header

Makes the behaviour of the Unix and Windows versions of the header
equivalent, in particular it means that if argv[0] doesn't describe the
executable, more things fail for Cygwin.
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedstdlib/header.c
Commit 063b7649be3b3c2e7fe161a9c6cbedc66387e5a1 by david.allsopp
Harden the cloexec.ml test on Windows

On slower machines, it's possible for the main part of the test (in
fdstatus_main.ml) to complete before the cloexec.ml has actually
terminated as part of `Unix.execv` (this is an artefact of how the
underlying CRT `execv` call is implemented on Windows).

Strictly on native Windows, cloexec.ml creates an additional dummy file
and takes a write lock on it (with `Unix.lockf`). Before running, if
this file exists, fdstatus_main.ml will also try to take a write lock on
it, providing a way of fdstatus_main.ml being sure that its ancestor has
fully terminated without actually having to know its PID.
The file was modifiedtestsuite/tests/lib-unix/common/cloexec.ml
The file was modifiedtestsuite/tests/lib-unix/common/fdstatus_main.ml
Commit 396e693ced27c0e6f35b922213b428fc7a8c1d88 by david.allsopp
Possible alternate approach...
The file was modifiedtestsuite/tests/lib-unix/common/cloexec.ml
The file was modifiedtestsuite/tests/lib-unix/common/fdstatus_aux.c
The file was modifiedtestsuite/tests/lib-unix/common/fdstatus_main.ml
Commit 10f837eb420f16a6d57abe87b4d6875c28d1615a by david.allsopp
... and the bug-fix which goes with it
The file was modifiedotherlibs/unix/channels_win32.c
Commit c45a01c66f9806d055ef974cc9c77268846287f5 by david.allsopp
Fix STARTUPINFO structure in stdlib/header.c

If a CRT application (including, therefore, another OCaml program),
exec's a bytecode program which uses the executable header, the
cbReserved2 and lpReserved2 fields of the STARTUPINFO structure are
quietly used by the CRT to pass handle information about open fds.

The status checker in the cloexec.ml test has C stubs, which causes
ocamltest to compile the bytecode version with -custom. The test is
split to have an additional intermediate pure OCaml program which simply
repeats either the Unix.execv or Unix.create_process call with the
Sys.argv it was applied. In bytecode, ocamltest compiles this program
just with -use-runtime, which means it uses the executable header on
Windows.

Without the change to header.c in this commit, that test begins to fail
in bytecode on Windows, because the CRT information about inherited
handles is not passed on to the status checker (the HANDLE values will
have been inherited, as that's a kernel function, but the CRT structures
regarding the fds are not initialised, which is what the checker than
looks at).

The fix here simplifies the code considerably - rather than initialising
a fresh STARTUPINFO structure, we simply use GetStartupInfo to retrieve
the one which was used to create the process itself and pass that to
CreateProcess - cbReserved2 and lpReserved2 are therefore passed on, and
the cloexec.ml test passes again.
The file was modifiedtestsuite/tests/lib-unix/common/cloexec.ml
The file was addedtestsuite/tests/lib-unix/common/cloexec_leap.ml
The file was modifiedstdlib/header.c
The file was modifiedtestsuite/tests/lib-unix/common/fdstatus_main.ml
Commit 869dd51d413872f1728b3e068848bf78802a93c9 by david.allsopp
Share image fd between header.c and startup_byt.c

The bytecode executable launcher (stdlib/header.c) can _only_ invoke
ocamlrun after it has opened itself in order to find out the name of the
runtime to execute. However, once ocamlrun is exec'd, the knowledge of
this file was previously lost and if it could not be recovered from
argv[0], then execution fails.

This new approach, for both Windows and Unix, instead keeps the fd for
the bytecode image open and passes its number to ocamlrun as
__OCAML_EXEC_FD in the environment. ocamlrun detects this environment
variable and uses that fd to load the bytecode image. If this fails, the
runtime does _not_ fallback to any other mechanisms.

On Windows, it is possible to recover the filename from a HANDLE. It is
not portably possible to do this on Unix, so the filename which was
opened by the stdlib/header.c is instead appended to the environment
variable.
The file was modifiedstdlib/header.c
The file was modifiedruntime/startup_byt.c
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit 10b786037067ae7961663cfd0d93f11be2f15399 by david.allsopp
Add comments on the handling of blank env vars

Clarify in various places the behaviour of reading an environment
variable which is "Set But Null" (i.e. equal to the empty string as
opposed to unset)
The file was modifiedtoplevel/topcommon.ml
The file was modifiedruntime/unix.c
The file was modifiedbytecomp/dll.ml
The file was modifieddebugger/unix_tools.ml
Commit c59bca011ac13defdcc2d7a272c8fcb34c7551ec by david.allsopp
Ignore empty TMPDIR in the Filename module

For Unix, the Filename module now treats TMPDIR being set to the
empty string, as if it were not set at all (which causes it to use /tmp
instead).
The file was modifiedstdlib/filename.ml
Commit 07d74966d4d9e8ebe491ea11f6a541e05b2d97d5 by david.allsopp
Ignore empty TMPDIR in ocamlyacc

If TMPDIR is set to the empty string, the Unix build of ocamlyacc now
defaults to /tmp (as it would if TMPDIR were not set at all).

The Windows default for when TMPDIR is not set is alredy the current
directory, so no change is required.
The file was modifiedyacc/main.c
Commit 0c412672ff40c4585407d85256010fcb16ae7684 by david.allsopp
Propagate non-empty tmpdir in ocamlyacc

By making tmpdir explicitly "." in the rare corner-case of TMPDIR being
set to the empty string on Windows, it becomes unnecessary to keep
checking whether tmpdir is zero-length.
The file was modifiedyacc/main.c
Commit daaa76c932d5bf39486a6ac3b571ce2596d2a6a7 by david.allsopp
Ignore CAML_DEBUG_FILE if it's "Set But Null"
The file was modifiedruntime/startup_aux.c
Commit ed6b61b088f851b2e4a688504629848f654557a8 by david.allsopp
Ignore OCAMLPROF_DUMP if it's "Set But Null"
The file was modifiedtools/profiling.ml
Commit 779c1289fc69067a236b6d37ab501d254d457437 by david.allsopp
Use non-raising Sys.getenv_opt in win32unix

Use the non-raising Sys.getenv_opt internally in the Windows
implementation of the Unix module. In passing, treat the highly unlikely
corner case of COMSPEC being "Set But Null" as if COMSPEC were not set.
The file was modifiedotherlibs/unix/unix_win32.ml
Commit 03a50c6c122f233efcbb66e9a3e854e7f90201ad by david.allsopp
Ignore empty strings in Compmisc.set_from_env

Previously, invocations such as

OCAML_COLOR= ocamlopt

emitted warning 46 (bad-env-variable) which is not particularly helpful.
At present, Compmisc.set_from_env is used to implement OCAML_COLOR and
OCAML_ERROR_STYLE, neither of which attached significance to the empty
string. Compmisc.set_from_env is there changed to explictly ignore the
environment variable value if it is "".
The file was modifieddriver/compmisc.ml
The file was modifieddriver/compmisc.mli
Commit ffd9eff801a6df525c023213c9cb79f77b9dfa55 by david.allsopp
Ignore empty environment variables in ocamltest

Most uses in ocamltest were via its safe_getenv function which already
made unset and empty equivalent. This generalises the underlying
getenv_with_default_value function always to return the default value if
the variable is _either_ unset or set to the empty string.
The file was modifiedocamltest/ocamltest_stdlib.ml
Commit 9a8b31be6970a99a3ca07f88a9aa60d9df3d2de5 by david.allsopp
Ignore empty MAKE variable in ocamltest
The file was modifiedocamltest/main.ml
Commit 83a6988a2a031ae171b979e4766a81021b2a3246 by david.allsopp
Treat OCAML_BINANNOT_WITHENV as unset when empty

This environment is intended to be used in the context of
OCAML_BINANNOT_WITHENV=1 to enable it, so treat OCAML_BINANNOT_WITHENV=
as if it weren't set at all.
The file was modifiedfile_formats/cmt_format.ml
Commit 9e63e6150206182f32c8366afc75250b9c7112fa by david.allsopp
Harden processing of SOURCE_DATE_EPOCH in ocamldoc

Previously, running:

SOURCE_DATE_EPOCH= ocamldoc

resulted in an uncaught Failure "float_of_string" exception. The
processing of SOURCE_DATE_EPOCH is firstly hardened to cope with parsing
errors and then a one-time warning is displayed the first time it's
actually used (at present it's only required in Odoc_man).
The file was modified.depend
The file was modifiedocamldoc/odoc_misc.ml
The file was modifiedocamldoc/odoc_misc.mli
The file was modifiedocamldoc/odoc_man.ml
Commit f84e9003bb40346681d379ee00e700824f5126d1 by david.allsopp
Add some limited information about CAMLSIGPIPE
The file was modifiedruntime/win32.c
The file was modifiedruntime/startup_byt.c
Commit 2986941b386f6e133f405f0c8a530f7eedadda43 by david.allsopp
Ignore empty OCAML_RUNTIME_EVENTS_ variables

The handling of OCAML_RUNTIME_EVENTS_DIR was incorrect if the value as
"Set But Null" and the intention in the manual for
OCAML_RUNTIME_EVENTS_START and OCAML_RUNTIME_EVENTS_PRESERVE is clearly
that they should be set to non-empty values in order to trigger the
required effect.

All three variables are now ignored if they are set, but to an empty
string.
The file was modifiedotherlibs/runtime_events/runtime_events.mli
The file was modifiedruntime/runtime_events.c
Commit e36cc23a561ca9f69682b8418e819be8aff010fd by david.allsopp
Ignore blank OCAMRUNPARAM, OCAMLLIB and CAMLLIB

Previously, if OCAMLRUNPARAM was "Set But Null", CAMLRUNPARAM was
completely ignored. Similarly, a "Set But Null" value for OCAMLLIB
caused CAMLLIB and subsequently the default location of the Standard
Library to be ignored. Especially for OCAMLLIB/CAMLLIB, this behaviour
is counter-intuitive, as it's highly unlikely to be useful.

Now, if OCAMLLIB is set, but to the empty string, then CAMLLIB is
checked and, more importantly, if it is either not set or also set to
the empty string then the default location of the Standard Library is
still used. For consistency, if OCAMLRUNPARAM is set, but to the empty string,
then CAMLRUNPARAM is read.
The file was modifiedruntime/dynlink.c
The file was modifiedtestsuite/tests/backtrace/backtrace2.reference
The file was modifiedstdlib/hashtbl.ml
The file was modifiedstdlib/.depend
The file was modifiedutils/config.common.ml.in
The file was modifiedruntime/startup_aux.c
Commit ee304ed33ff0ca22ab6bfe258d5614ff962179bc by david.allsopp
Ignore empty components in PATH-like things

POSIX recognises empty components in a PATH-like variable as meaning "."
(the current directory). This is reflected in the processing of
OCAMLTOP_INCLUDE_PATH, CAML_LD_LIBRARY_PATH and ld.conf where either a
blank component or a blank line is interpreted as "."

Somewhat confusingly, this processing is applied inconsistently between
Unix and Windows (it's confusing given that Windowsm more readily
includes the current working directory by default in PATH searches).

It also has the side-effect that a "Set But Null" environment variable
is interpreted as "." which counter-intuitively makes
CAML_LD_LIBRARY_PATH= ocamlrun add the current working directory to the
search path.

Blank lines and empty components of both OCAMLTOP_INCLUDE_PATH and
CAML_LD_LIBRARY_PATH are now ignored. The current working directory can
still be explicitly included, of course, by adding a "." entry/line
where required.
The file was modifiedutils/misc.ml
The file was modifiedruntime/unix.c
The file was modifiedruntime/win32.c
The file was modifiedtoplevel/topcommon.ml
The file was modifiedbytecomp/dll.ml
The file was modifiedutils/misc.mli
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedruntime/dynlink.c
The file was modifiedruntime/startup_byt.c
Commit 59328552e2012631217a71d719c52444b60d2126 by david.allsopp
Fix C library options for win32unix

-lws2_32 and -ladvapi32 are already supplied by default, so they don't
need to be in unix.cma/unix.cmxa. However, they do need to be passed
when building unix.cmxs, and they were previously acquired via
unix.cmxa. Tweak the way LDOPTS is used in Makefile.otherlibs.common
(which now is only used for the unix library) so that it's correctly
passed to both ocamlopt and ocamlmklib.
The file was modifiedotherlibs/unix/Makefile
The file was modifiedotherlibs/Makefile.otherlibs.common
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit 986020bd90e85f5668c0230cae3df1c53934a399 by david.allsopp
Build and install threads.cmxs

Crucially, the corrects the flags used for creating a DLL on Windows,
allowing threads.cmxs to be loaded in ocamlnat.
The file was modifiedotherlibs/systhreads/Makefile
The file was modifiedotherlibs/systhreads/st_stubs.c
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit e65ca93db331fd909053248e162be4fe10fa136d by david.allsopp
Fix inclusion of libraries when partial linking

ld -r (certainly in GNU binutils) has an empty search path - co-opt the
MSVC search code and always resolve libraries when partial linking,
except this time _ignore_ the ones which are missing. This seems to fit
the rest of -output-complete-obj, given that the _standard_ C libraries
are also omitted (-lm, -lpthread, etc.)
The file was modifiedutils/ccomp.ml
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit 7c97641ab4301425846bfda54ed3687a751d2b02 by david.allsopp
Use entrypoint flexdll branch

Fixes loading unix.cmxs in Cygwin64
The file was modifiedflexdll
The file was modifiedtools/ci/inria/main
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit 1a1bc16a08bcf3eb66fad7b17ef357f2e6465ec1 by david.allsopp
Revert "accept unknown options"

This reverts commit 31cbd26c16f81c8a273ad3ba988c49db6b0dbe38.
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedtools/ocamlmklib.ml
Commit 62bd725c9154bb9bda01040718ae4a55a21da998 by david.allsopp
Stop installing and documenting config_main, etc.

Config_main and Config_boot are built to ensure in the build that
utils/config.generated.ml.in and utils/config.fixed.ml are kept in sync
(so that the next bootstrap doesn't unexpectedly break). However,
because these files were generated in the utils directory, they were
picked up both by the install recipe and also when generating API
documentation.

It's slightly hairy to remove the wildcards and use filter, because we
can easily end up with command lines which are too long (even on Unix),
so instead these two modules are now generated in utils/config/
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modified.depend
The file was modified.gitignore
The file was modifiedMakefile
Commit 915bcfb7270e32b79334e5b8247d5af169cefa20 by david.allsopp
Use clang-cl for flexdll support objects
The file was modifiedtestsuite/tools/test_in_prefix.ml
The file was modifiedMakefile
Commit 4c01b1f23cbe254fb5abb08396c8285852f19a1d by david.allsopp
Add %shared_libraries primitive

Exposes the value of SUPPORT_DYNAMIC_LINKING.
The file was modifiedlambda/translprim.ml
The file was modifiedmiddle_end/flambda/closure_conversion.ml
The file was modifiedlambda/lambda.mli
The file was modifiedlambda/printlambda.ml
The file was modifiedlambda/lambda.ml
The file was modifiedruntime/win32.c
The file was modifiedmiddle_end/closure/closure.ml
The file was modifiedbytecomp/bytegen.ml
The file was modifiedruntime/unix.c
Commit f6574c5b53ab8e7390ec99d08d569c9cbe2a5b1f by david.allsopp
Bootstrap
The file was modifiedboot/ocamllex
The file was modifiedboot/ocamlc
Commit 63ab0dea6b5b56139af5c93398fcd695e13b38d4 by david.allsopp
Improve the "dynamic loading not supported" error

It is possible, especially when using Dynlink, to end up in the
situation where a bytecode runtime which doesn't support dynamic loading
is asked to load support DLLs (e.g. a bytecode image with a DLLS
section, or a cma archive passed to the toplevel/Dynlink which has a
non-empty lib_dllibs list).

Previously, the error message would refer to the name of the first DLL
being loaded and simply state that dynamic loading is not supported. The
confusing part is that typically this would refer to a DLL which is not
on the system.

Now, the bytecode linker only writes DLLS and DLPT when there are
entries to write in them, and the runtime, toplevel and Dynlink provide
a direct explanation that dynamic loading is needed, but is not
available. In particular, the error now refers to the file which is
being loaded (i.e. the bytecode executable or the .cma file) rather than
a .so file which doesn't exist.
The file was modifiedruntime/startup_byt.c
The file was modifiedotherlibs/dynlink/byte/dynlink.ml
The file was modifiedtoplevel/byte/topeval.ml
Commit f45c1784c4ebf01e8cbddd648cb95c101854688e by david.allsopp
Free tables after handing off to Dynlink

In the debug runtime, caml_prim_name_table remains for the lifetime of
the program, as it's used by instrtrace.c, but in normal operation, once
the list of primitives has been handed over to Dynlink, its no longer
required. In the normal runtime, it's now freed after this handover.

In passing, strings themselves are no longer duplicated, as the code
path is a good deal simpler than it used to be, and the bytecode section
itself can reliably be used as the underlying buffer for
caml_prim_name_table.

caml_shared_libs_path is only kept at all to be handed over to Dynlink.
It, along with the two underlying buffers for CAML_LD_LIBRARY_PATH and
ld.conf are freed after the call.
The file was modifiedruntime/dynlink.c
The file was modifiedruntime/startup_byt.c
Commit c2c6c22610f5e139d11ac05bbf97d7c3dcf523ce by david.allsopp
Move print_magic and print_config out of caml_params

They are only used by the bytecode runtime and can be made static to
startup_byt.
The file was modifiedruntime/startup_aux.c
The file was modifiedruntime/startup_byt.c
The file was modifiedruntime/caml/startup_aux.h
Commit 78d7beb3125c8c8d784e7207f88cc895af226a9e by david.allsopp
Preserve option R in caml_runtime_parameters

The setting for R was previous omitted in Sys.runtime_parameters, since
it was only processed directly by the Hashtbl module and not stored in
the runtime. Option R is now processed in caml_parase_ocamlrunparam and
stored to be accessed and updated via new primitives for the Hashtbl
module.

Co-authored-by: David Allsopp <david.allsopp@metastack.com>
The file was modifiedruntime/gc_ctrl.c
The file was modifiedruntime/startup_aux.c
The file was modifiedruntime/caml/gc_ctrl.h
The file was modifiedtestsuite/tests/backtrace/backtrace2.reference
The file was modifiedstdlib/hashtbl.ml
The file was modifiedstdlib/.depend
Commit a8f02176f365b26f5e4faade05a94d90ffa1d919 by david.allsopp
Swap the V and v in caml_runtime_parameters

Consistency - options displayed in alphabetical order with the uppercase
letter appearing before the lowercase letter
The file was modifiedruntime/gc_ctrl.c
Commit 7ae2a2957c2f4918f57d10f23a0fb0f18ad79b68 by david.allsopp
Add -set-runtime-default to the compilers

When linking an executable, allows to set default to OCAMLRUNPARAM
values. This new OCAMLRUNPARAM string is accessible using the
"caml_executable_ocamlrunparam" symbol or is embedded in a bytecode
section.

Co-authored-by: David Allsopp <david.allsopp@metastack.com>
The file was modifiedruntime/caml/startup_aux.h
The file was modifiedbytecomp/bytelink.ml
The file was modifiedasmcomp/asmlink.ml
The file was modifieddriver/maindriver.ml
The file was modified.depend
The file was modifiedruntime/gc_ctrl.c
The file was modifiedutils/clflags.mli
The file was modifiedruntime/startup_aux.c
The file was modifiedruntime/startup_byt.c
The file was modifiedruntime/gen_primsc.sh
The file was modifiedutils/clflags.ml
The file was modifiedtools/objinfo.ml
The file was modifiedbytecomp/bytesections.mli
The file was modifiedasmcomp/cmm_helpers.mli
The file was modifieddriver/compenv.mli
The file was modifiedmanual/src/cmds/runtime.etex
The file was modifiedasmcomp/cmm_helpers.ml
The file was modifiedbytecomp/bytesections.ml
The file was modifieddriver/compenv.ml
The file was modifiedman/ocamlrun.1
Commit b9f9f2c2b5cbf906fd4d9618a389f4fdb5f108db by david.allsopp
Test -set-runtime-default in test-in-prefix

The test programs in the run after the prefix has been renamed are
compiled with `-set-runtime-default R`, and the test program verifies
that Hashtbl.is_randomized returns the expected value.
The file was modifiedtestsuite/tools/test_in_prefix.ml
Commit 62f924aa46df4e3f61f8d3398178afb3504b443d by david.allsopp
Re-order initialisations in bytecode

In bytecode startup, defer allocating memory until after the bytecode
image has been loaded as far as possible.
The file was modifiedruntime/startup_byt.c
Commit 347e68ced3ad39c626d71117686aa799a65f3328 by david.allsopp
Support c=1 mode in ocamlrun

The runtime's pooling mode has a slight Catch-22 problem for ocamlrun
when enabled using -set-runtime-default. Opening the bytecode file and
reading the ORUN section requires the memory subsystem.

In this revised version, caml_main in bytecode is particularly careful
to track exactly what will have been allocated prior to reading the ORUN
section and if ORUN requires the system to start pooling mode, the
runtime now takes temporary malloc'd copies of everything which has been
made so far so that it can be safely copied with a caml_stat_alloc
_after_ pooling mode has been enabled.
The file was modifiedruntime/startup_byt.c
The file was modifieddriver/maindriver.ml
The file was modifiedruntime/caml/misc.h