New upstream version 4.10.1
authorStephane Glondu <steph@glondu.net>
Thu, 3 Sep 2020 12:52:11 +0000 (14:52 +0200)
committerStéphane Glondu <glondu@debian.org>
Thu, 3 Sep 2020 12:52:11 +0000 (14:52 +0200)
35 files changed:
Changes
Makefile
Makefile.common.in
VERSION
appveyor.yml
boot/ocamlc
boot/ocamllex
bytecomp/bytelink.ml
configure
configure.ac
manual/manual/library/builtin.etex
ocaml-variants.opam
otherlibs/Makefile.otherlibs.common
otherlibs/dynlink/Makefile
otherlibs/systhreads/Makefile
runtime/Makefile
runtime/backtrace_byt.c
runtime/caml/freelist.h
runtime/caml/misc.h
runtime/caml/startup.h
runtime/compact.c
runtime/freelist.c
runtime/startup_byt.c
stdlib/Compflags
stdlib/Makefile
stdlib/sys.mli
testsuite/Makefile
testsuite/tests/output-complete-obj/github9344.ml [new file with mode: 0644]
testsuite/tests/output-complete-obj/github9344.reference [new file with mode: 0644]
testsuite/tests/output-complete-obj/github9344.sh [new file with mode: 0644]
testsuite/tests/output-complete-obj/puts.c
testsuite/tests/output-complete-obj/test2.ml
testsuite/tests/output-complete-obj/test2.reference
tools/Makefile
tools/ci/appveyor/appveyor_build.cmd

diff --git a/Changes b/Changes
index fc5591eb4b8b3e9246656531f05ac110231e18d5..15fd521d9db66d2d193053b94fb1f423e8f87c6b 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,45 @@
+OCaml 4.10.1 (20 August 2020)
+-----------------------------
+
+### Runtime system:
+
+- #9344, #9368: Disable exception backtraces in bytecode programs
+  built with "-output-complete-exe". At the moment, such programs do
+  not embed debug information and exception backtraces where causing
+  them to crash.
+  (Jérémie Dimino, review by Nicolás Ojeda Bär)
+
+### Build system:
+
+- #9531: fix support for the BFD library on FreeBSD
+  (Hannes Mehnert, review by Gabriel Scherer and David Allsopp)
+
+### Bug fixes:
+
+- #9068, #9437: ocamlopt -output-complete-obj failure on FreeBSD 12
+  (Xavier Leroy, report by Hannes Mehnert, review by Sébastien Hinderer)
+
+- #9165, #9840: Add missing -function-sections flag in Makefiles.
+  (Greta Yorsh, review by David Allsopp)
+
+- #9495: fix a bug where bytecode binaries compiled with `-output-complete-exe`
+  would not execute `at_exit` hooks at program termination (in particular,
+  output channels would not be flushed).
+  (Nicolás Ojeda Bär, review by David Allsopp)
+
+- #9714, #9724: Use the C++ alignas keyword when compiling in C++ in MSVC.
+  Fixes a bug with MSVC C++ 2015 onwards.
+  (Antonin Décimo, review by David Allsopp and Xavier Leroy)
+
+- #9736, #9749: Compaction must start in a heap where all free blocks are
+  blue, which was not the case with the best-fit allocator.
+  (Damien Doligez, report and review by Leo White)
+
+### Tools:
+
+- #9552: restore ocamloptp build and installation
+  (Florian Angeletti, review by David Allsopp and Xavier Leroy)
+
 OCaml 4.10.0 (21 February 2020)
 -------------------------------
 
@@ -49,7 +91,7 @@ OCaml 4.10.0 (21 February 2020)
    (KC Sivaramakrishnan and Stephen Dolan,
     compatibility hacking by David Allsopp, Florian Angeletti, Kate Deplaix,
     Jacques Garrigue, Guillaume Munch-Maccagnoni and Nicolás Ojeda Bär,
-    review by David Allsopp, Alain Frisch, Nicolas Ojeda Bar,
+    review by David Allsopp, Alain Frisch, Nicolás Ojeda Bär,
     Gabriel Scherer, Damien Doligez, and Guillaume Munch-Maccagnoni)
 
 - #8993: New C functions caml_process_pending_actions{,_exn} in
@@ -226,7 +268,7 @@ OCaml 4.10.0 (21 February 2020)
   (Florian Angeletti, review and suggestion by Gabriel Scherer)
 
 - #9088, #9097: fix operator character classes
-  (Florian Angelettion, review by Gabriel Scherer,
+  (Florian Angeletti, review by Gabriel Scherer,
    report by Clément Busschaert)
 
 - #9169: better documentation for the best-fit allocation policy
@@ -286,7 +328,7 @@ OCaml 4.10.0 (21 February 2020)
 * #6792, #8654 ocamldebug now supports programs using Dynlink. This
   changes ocamldebug messages, which may break compatibility
   with older emacs modes.
-  (Whitequark and Jacques-Henri Jourdan, review by Gabriel Scherer
+  (whitequark and Jacques-Henri Jourdan, review by Gabriel Scherer
    and Xavier Clerc)
 
 - #8621: Make ocamlyacc a Windows Unicode application
@@ -432,7 +474,7 @@ OCaml 4.10.0 (21 February 2020)
   (Florian Angeletti, review by Gabriel Scherer)
 
 - #9015: fix fatal error in pprint_ast (#8789)
-  (Damien Doligez, review by ...)
+  (Damien Doligez, review by Thomas Refis)
 
 ### Bug fixes:
 
@@ -513,6 +555,14 @@ OCaml 4.10.0 (21 February 2020)
 OCaml 4.09 maintenance branch:
 ------------------------------
 
+### Build system:
+
+- #9383: Don't assume that AWKPATH includes .
+  (David Allsopp, report by Ian Zimmerman)
+
+OCaml 4.09.1 (16 Mars 2020):
+----------------------------
+
 - #8855, #8858: Links for tools not created when installing with
   --disable-installing-byecode-programs (e.g. ocamldep.opt installed, but
   ocamldep link not created)
@@ -594,7 +644,7 @@ OCaml 4.09.0 (19 September 2019):
 * #2318: Delete the graphics library. This library is now available
   as a separate "graphics" package in opam. Its new home is:
   https://github.com/ocaml/graphics
-  (Jérémie Dimino, review by Nicolas Ojeda Bar, Xavier Leroy and
+  (Jérémie Dimino, review by Nicolás Ojeda Bär, Xavier Leroy and
    Sébastien Hinderer)
 
 * #2289: Delete the vmthreads library. This library was deprecated in 4.08.0.
@@ -658,7 +708,7 @@ OCaml 4.09.0 (19 September 2019):
 
 - #2278: Remove native code generation support for 32-bit Intel macOS,
   iOS and other Darwin targets.
-  (Mark Shinwell, review by Nicolas Ojeda Bar and Xavier Leroy)
+  (Mark Shinwell, review by Nicolás Ojeda Bär and Xavier Leroy)
 
 - #8547: Optimize matches that are an affine function of the input.
   (Stefan Muenzel, review by Alain Frisch, Gabriel Scherer)
@@ -718,7 +768,7 @@ OCaml 4.09.0 (19 September 2019):
   fix in #8582 by Mark Shinwell, Xavier Leroy and Anil Madhavapeddy)
 
 - #2265: Add bytecomp/opcodes.mli
-  (Mark Shinwell, review by Nicolas Ojeda Bar)
+  (Mark Shinwell, review by Nicolás Ojeda Bär)
 
 - #2268: Improve packing mechanism used for building compilerlibs modules
   into the Dynlink libraries
@@ -992,7 +1042,7 @@ OCaml 4.08.0 (13 June 2019)
   pred, is_finite, is_infinite, is_nan, is_integer, trunc, round,
   next_after, sign_bit, min, max, min_max, min_num, max_num,
   min_max_num to module Float.
-  (Christophe Troestler, review by Alain Frish, Xavier Clerc and Daniel Bünzli)
+  (Christophe Troestler, review by Alain Frisch, Xavier Clerc and Daniel Bünzli)
 
 - #1354, #2177: Add fma support to Float module.
   (Laurent Thévenoux, review by Alain Frisch, Jacques-Henri Jourdan,
@@ -1126,7 +1176,7 @@ OCaml 4.08.0 (13 June 2019)
     - #2094, rewording for "constructor has no type" error
     - #7565, #2140, more context for universal variable escape
       in method type
-  (Florian Angeletti, reviews by Jacques Garrique, Armaël Guéneau,
+  (Florian Angeletti, reviews by Jacques Garrigue, Armaël Guéneau,
    Gabriel Radanne, Gabriel Scherer and Jeremy Yallop)
 
 - #1913: new flag -dump-into-file to print debug output like -dlambda into
@@ -1332,6 +1382,11 @@ OCaml 4.08.0 (13 June 2019)
 - #7676, #2144: Remove old GC heuristic
   (Damien Doligez, report and review by Alain Frisch)
 
+* #1683: Change Marshal format to make Custom_tag objects store their
+  length. Old versions of OCaml will no longer be able to parse new marshalled
+  files containing custom blocks, but old files will still parse.
+  (Stephen Dolan)
+
 - #1723: Remove internal Meta.static_{alloc,free} primitives.
   (Stephen Dolan, review by Gabriel Scherer)
 
@@ -1415,7 +1470,7 @@ OCaml 4.08.0 (13 June 2019)
   (steinuil, review by Marcello Seri, Gabriel Scherer and Florian Angeletti)
 
 - #1797: remove the deprecated Makefile.nt files.
-  (Sébastien Hinderer, review by Nicolas Ojeda Bar)
+  (Sébastien Hinderer, review by Nicolás Ojeda Bär)
 
 - #1805: fix the bootstrap procedure and its documentation.
   (Sébastien Hinderer, Xavier Leroy and Damien Doligez; review by
@@ -1452,7 +1507,7 @@ OCaml 4.08.0 (13 June 2019)
   (Sébastien Hinderer, review by Damien Doligez and David Allsopp)
 
 - #2148: fix a parallel build bug involving CamlinternalLazy.
-  (Stephen Dolan, review by Gabriel Scherer and Nicolas Ojeda Bar)
+  (Stephen Dolan, review by Gabriel Scherer and Nicolás Ojeda Bär)
 
 - #2264, #7904: the configure script now sets the Unicode handling mode
   under Windows according to the value of the variable WINDOWS_UNICODE_MODE. If
@@ -2052,11 +2107,6 @@ OCaml 4.07.0 (10 July 2018)
 - #1753: avoid potential off-by-one overflow in debugger socket path length.
   (Anil Madhavapeddy)
 
-* #1683: Change Marshal format to make Custom_tag objects store their
-  length. Old versions of OCaml will no longer be able to parse new marshalled
-  files containing custom blocks, but old files will still parse.
-  (Stephen Dolan)
-
 ### Tools:
 
 - #7643, #1377: ocamldep, fix an exponential blowup in presence of nested
@@ -2361,7 +2411,7 @@ OCaml 4.07.0 (10 July 2018)
 
 - #1623: Segfault on Windows 64 bits when expanding wildcards in arguments.
   (Marc Lasson, review by David Allsopp, Alain Frisch, Sébastien Hinderer,
-   Xavier Leroy, Nicolas Ojeda Bar)
+   Xavier Leroy, Nicolás Ojeda Bär)
 
 - #1661: more precise principality warning regarding record fields
   disambiguation.
@@ -2554,7 +2604,7 @@ OCaml 4.06.0 (3 Nov 2017):
   with thread support, will now only suppress Sys_error exceptions in
   Pervasives.flush_all.  This should allow exceedingly unlikely assertion
   exceptions to escape, which could help reveal bugs in the standard library.
-  (Markus Mottl, review by Hezekiah M. Carty, Jeremie Dimino, Damien Doligez,
+  (Markus Mottl, review by Hezekiah M. Carty, Jérémie Dimino, Damien Doligez,
   Alain Frisch, Xavier Leroy, Gabriel Scherer and Mark Shinwell)
 
 - #1034: List.init : int -> (int -> 'a) -> 'a list
index 802196d1efb6d8cb76531a74fea6f0ebc199c14e..0a95d3195fd233c3286c6151280163d475484699 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -48,11 +48,6 @@ INCLUDES=-I utils -I parsing -I typing -I bytecomp -I file_formats \
 COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66 \
          -warn-error A \
           -bin-annot -safe-string -strict-formats $(INCLUDES)
-ifeq "$(FUNCTION_SECTIONS)" "true"
-OPTCOMPFLAGS= -function-sections
-else
-OPTCOMPFLAGS=
-endif
 LINKFLAGS=
 
 ifeq "$(strip $(NATDYNLINKOPTS))" ""
index f389d5b02fd5c114c0598607b98ce5b1aec257b4..4087e4ba3c1b6407507ca1262535b10b8bdfdc6b 100644 (file)
@@ -66,6 +66,10 @@ else
   ocamlopt_cmd = $(FLEXLINK_ENV) $(ocamlopt)
 endif
 
+OPTCOMPFLAGS=
+ifeq "$(FUNCTION_SECTIONS)" "true"
+OPTCOMPFLAGS += -function-sections
+endif
 # By default, request ocamllex to be quiet
 OCAMLLEX_FLAGS ?= -q
 
diff --git a/VERSION b/VERSION
index 98eeedd7843a1280655dd900f92ccb1720e049d8..636ba8d797e14e10bf8c78584d4faf1e03d8f18f 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
-4.10.0
+4.10.1
 
 # The version string is the first line of this file.
 # It must be in the format described in stdlib/sys.mli
index e055683f47e6b4c067ec3d63cc8daef85956d7ad..5b4e821aed873ef12270be712baa656d327578ef 100644 (file)
@@ -26,7 +26,7 @@ environment:
     CYG_ROOT: C:/cygwin64
     CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/
     CYG_CACHE: C:/cygwin64/var/cache/setup
-    FLEXDLL_VERSION: 0.37
+    FLEXDLL_VERSION: 0.38
     OCAMLRUNPARAM: v=0,b
   matrix:
     - PORT: mingw32
index 71fcc11fb71cf38d7bac1c82fb78e194de627488..047bb0081721ec41227d81b5632d9516ba5e7f15 100755 (executable)
Binary files a/boot/ocamlc and b/boot/ocamlc differ
index fb586c1fedc10196ec06b62188ac6ae79804bb82..462fe17b57c20c2ed6cbfd940ca165cfc2d7d465 100755 (executable)
Binary files a/boot/ocamllex and b/boot/ocamllex differ
index 0065ebd350a91749fca0c99502e5bbe35717698b..d980054ced5a8ec1eab8a70e8e5dbb1a9a5b681a 100644 (file)
@@ -505,11 +505,13 @@ let link_bytecode_as_c tolink outfile with_main =
 \nint main(int argc, char **argv)\
 \n#endif\
 \n{\
+\n  caml_byte_program_mode = COMPLETE_EXE;\
 \n  caml_startup_code(caml_code, sizeof(caml_code),\
 \n                    caml_data, sizeof(caml_data),\
 \n                    caml_sections, sizeof(caml_sections),\
 \n                    /* pooling */ 0,\
 \n                    argv);\
+\n  caml_sys_exit(Val_int(0));\
 \n  return 0; /* not reached */\
 \n}\n"
        end else begin
@@ -594,9 +596,15 @@ let fix_exec_name name =
 
 let link objfiles output_name =
   let objfiles =
-    if !Clflags.nopervasives then objfiles
-    else if !Clflags.output_c_object then "stdlib.cma" :: objfiles
-    else "stdlib.cma" :: (objfiles @ ["std_exit.cmo"]) in
+    match
+      !Clflags.nopervasives,
+      !Clflags.output_c_object,
+      !Clflags.output_complete_executable
+    with
+    | true, _, _         -> objfiles
+    | false, true, false -> "stdlib.cma" :: objfiles
+    | _                  -> "stdlib.cma" :: objfiles @ ["std_exit.cmo"]
+  in
   let tolink = List.fold_right scan_file objfiles [] in
   let missing_modules =
     Ident.Set.filter (fun id -> not (Ident.is_predef id)) !missing_globals
index b8f74728f783e9ab1eacb93844e82d1ddeb33c57..2dbde09f177790c38bc74b298b01ebdfc4000828 100755 (executable)
--- a/configure
+++ b/configure
@@ -56,7 +56,7 @@ if test -e '.git' ; then :
   fi
 fi
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for OCaml 4.10.0.
+# Generated by GNU Autoconf 2.69 for OCaml 4.10.1.
 #
 # Report bugs to <caml-list@inria.fr>.
 #
@@ -646,8 +646,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='OCaml'
 PACKAGE_TARNAME='ocaml'
-PACKAGE_VERSION='4.10.0'
-PACKAGE_STRING='OCaml 4.10.0'
+PACKAGE_VERSION='4.10.1'
+PACKAGE_STRING='OCaml 4.10.1'
 PACKAGE_BUGREPORT='caml-list@inria.fr'
 PACKAGE_URL='http://www.ocaml.org'
 
@@ -1480,7 +1480,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures OCaml 4.10.0 to adapt to many kinds of systems.
+\`configure' configures OCaml 4.10.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1546,7 +1546,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of OCaml 4.10.0:";;
+     short | recursive ) echo "Configuration of OCaml 4.10.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1708,7 +1708,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-OCaml configure 4.10.0
+OCaml configure 4.10.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2371,7 +2371,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by OCaml $as_me 4.10.0, which was
+It was created by OCaml $as_me 4.10.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2720,8 +2720,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring OCaml version 4.10.0" >&5
-$as_echo "$as_me: Configuring OCaml version 4.10.0" >&6;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring OCaml version 4.10.1" >&5
+$as_echo "$as_me: Configuring OCaml version 4.10.1" >&6;}
 
 # Configuration variables
 
@@ -2797,7 +2797,7 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 
 
-VERSION=4.10.0
+VERSION=4.10.1
 
 
 # Note: This is present for the flexdll bootstrap where it exposed as the old
@@ -12461,7 +12461,7 @@ case $ocaml_cv_cc_vendor in #(
   msvc-*) :
     outputobj=-Fo; gcc_warnings="" ;; #(
   *) :
-    outputobj='-o $(EMPTY)'; case 4.10.0 in #(
+    outputobj='-o $(EMPTY)'; case 4.10.1 in #(
   *+dev*) :
     gcc_warnings="-Wall -Werror" ;; #(
   *) :
@@ -13852,22 +13852,20 @@ esac ;; #(
   s390x,elf) :
     default_as="${toolpref}as -m 64 -march=$model"
     default_aspp="${toolpref}gcc -c -Wa,-march=$model" ;; #(
-  arm,freebsd|arm64,freebsd) :
-    default_as="${toolpref}cc -c"
-    default_aspp="${toolpref}cc -c" ;; #(
-  *,dragonfly) :
-    default_as="${toolpref}as"
-    default_aspp="${toolpref}cc -c" ;; #(
   *,freebsd) :
+    default_as="${toolpref}cc -c -Wno-trigraphs"
+    default_aspp="${toolpref}cc -c -Wno-trigraphs" ;; #(
+  *,dragonfly) :
     default_as="${toolpref}as"
     default_aspp="${toolpref}cc -c" ;; #(
   amd64,*|arm,*|arm64,*|i386,*) :
-    default_as="${toolpref}as"
     case $ocaml_cv_cc_vendor in #(
   clang-*) :
-    default_aspp="${toolpref}clang -c -Wno-trigraphs" ;; #(
+    default_as="${toolpref}clang -c -Wno-trigraphs"
+                  default_aspp="${toolpref}clang -c -Wno-trigraphs" ;; #(
   *) :
-    default_aspp="${toolpref}gcc -c" ;;
+    default_as="${toolpref}as"
+      default_aspp="${toolpref}gcc -c" ;;
 esac ;; #(
   *) :
      ;;
@@ -16011,7 +16009,7 @@ fi
       if test -z "$BFD_LIB_DIR"; then :
   BFD_LIB_DIR="/opt/local/lib"
 fi ;; #(
-  *-*openbsd*) :
+  *-*-openbsd*|*-*-freebsd*) :
     if test -z "$BFD_INCLUDE_DIR"; then :
   BFD_INCLUDE_DIR="/usr/local/include"
 fi
@@ -17405,7 +17403,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by OCaml $as_me 4.10.0, which was
+This file was extended by OCaml $as_me 4.10.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -17472,7 +17470,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-OCaml config.status 4.10.0
+OCaml config.status 4.10.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index e3e28fb6fc6b07658b37667025b3686c1910e11b..f0987d0aa8ee457b6976e9ff92acec4faca2fa1c 100644 (file)
@@ -1006,20 +1006,18 @@ AS_CASE(["$arch,$system"],
   [s390x,elf],
     [default_as="${toolpref}as -m 64 -march=$model"
     default_aspp="${toolpref}gcc -c -Wa,-march=$model"],
-  [arm,freebsd|arm64,freebsd],
-    [default_as="${toolpref}cc -c"
-    default_aspp="${toolpref}cc -c"],
-  [*,dragonfly],
-    [default_as="${toolpref}as"
-    default_aspp="${toolpref}cc -c"],
   [*,freebsd],
+    [default_as="${toolpref}cc -c -Wno-trigraphs"
+    default_aspp="${toolpref}cc -c -Wno-trigraphs"],
+  [*,dragonfly],
     [default_as="${toolpref}as"
     default_aspp="${toolpref}cc -c"],
   [amd64,*|arm,*|arm64,*|i386,*],
-    [default_as="${toolpref}as"
-    AS_CASE([$ocaml_cv_cc_vendor],
-      [clang-*], [default_aspp="${toolpref}clang -c -Wno-trigraphs"],
-      [default_aspp="${toolpref}gcc -c"])])
+    [AS_CASE([$ocaml_cv_cc_vendor],
+      [clang-*], [default_as="${toolpref}clang -c -Wno-trigraphs"
+                  default_aspp="${toolpref}clang -c -Wno-trigraphs"],
+      [default_as="${toolpref}as"
+      default_aspp="${toolpref}gcc -c"])])
 
 AS_IF([test "$with_pic"],
   [fpic=true
@@ -1497,7 +1495,7 @@ AS_IF([test x"$with_bfd" != "xno"],
         [BFD_INCLUDE_DIR="/opt/local/include"])
       AS_IF([test -z "$BFD_LIB_DIR"],
         [BFD_LIB_DIR="/opt/local/lib"])],
-    [*-*openbsd*],
+    [*-*-openbsd*|*-*-freebsd*],
       [AS_IF([test -z "$BFD_INCLUDE_DIR"],
         [BFD_INCLUDE_DIR="/usr/local/include"])
       AS_IF([test -z "$BFD_LIB_DIR"],
index f63d324872431842af271401d0865e64524665bc..4b1d805661158112963813e9cddae28489997dcd 100644 (file)
@@ -6,7 +6,7 @@ compilation environment, but are not part of any module.  As a
 consequence, they can only be referred by their short names.
 
 %\vspace{0.1cm}
-\subsection{ss:builtin-types}*{Built-in types}
+\subsection*{ss:builtin-types}{Built-in types}
 %\vspace{0.1cm}
 
 \begin{ocamldoccode}
index 2af999ea1ae8b9ec7b162667a50ef2e6c912f347..ac81f897e4bb9b7a85aeb552885159b006a94bb6 100644 (file)
@@ -1,8 +1,8 @@
 opam-version: "2.0"
-version: "4.10.0"
+version: "4.10.1"
 synopsis: "OCaml development version"
 depends: [
-  "ocaml" {= "4.10.0" & post}
+  "ocaml" {= "4.10.1" & post}
   "base-unix" {post}
   "base-bigarray" {post}
   "base-threads" {post}
index b800ca918451d7410cb6973969d828a3af22c5a9..49a146f6deaabff298c92ba217e928b4cd73f153 100644 (file)
@@ -32,12 +32,7 @@ OC_CPPFLAGS += -I$(ROOTDIR)/runtime
 COMPFLAGS=-absname -w +a-4-9-41-42-44-45-48 -warn-error A -bin-annot -g \
           -safe-string -strict-sequence -strict-formats $(EXTRACAMLFLAGS)
 ifeq "$(FLAMBDA)" "true"
-OPTCOMPFLAGS=-O3
-else
-OPTCOMPFLAGS=
-endif
-ifeq "$(FUNCTION_SECTIONS)" "true"
-OPTCOMPFLAGS += -function-sections
+OPTCOMPFLAGS += -O3
 endif
 MKLIB=$(CAMLRUN) $(ROOTDIR)/tools/ocamlmklib
 
index 41cfb4857ebc7533a60b0a0f2508ea496f79550f..1ec5812488d4eeb746b943ce3edb90cd8dc860de 100644 (file)
@@ -35,9 +35,7 @@ COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66 \
          -warn-error A \
           -bin-annot -safe-string -strict-formats
 ifeq "$(FLAMBDA)" "true"
-OPTCOMPFLAGS=-O3
-else
-OPTCOMPFLAGS=
+OPTCOMPFLAGS += -O3
 endif
 
 COMPFLAGS += -I byte
index 668fb4d19abd5e2a9de188a67c288890c6f4919d..8c3853a7d26a83eb2b8a32b73e5aadfd97a47e69 100644 (file)
@@ -36,9 +36,7 @@ CAMLOPT=$(BEST_OCAMLOPT) $(LIBS)
 MKLIB=$(CAMLRUN) $(ROOTDIR)/tools/ocamlmklib
 COMPFLAGS=-w +33..39 -warn-error A -g -bin-annot -safe-string
 ifeq "$(FLAMBDA)" "true"
-OPTCOMPFLAGS=-O3
-else
-OPTCOMPFLAGS=
+OPTCOMPFLAGS += -O3
 endif
 
 LIBNAME=threads
index 963c6dd8fcad578e66d49afd676b14e5c1e6c5bd..b30f12052608b7ce9bc2182d62cf0c33fb9479ac 100644 (file)
@@ -359,10 +359,10 @@ $(foreach object_type,$(subst %,,$(object_types)), \
        $(ASPP) $(ASPPFLAGS) $(SHAREDLIB_CFLAGS) -o $@ $<
 
 domain_state64.inc: caml/domain_state.tbl gen_domain_state64_inc.awk
-       awk -f gen_domain_state64_inc.awk $< > $@
+       $(AWK) -f ./gen_domain_state64_inc.awk $< > $@
 
 domain_state32.inc: caml/domain_state.tbl gen_domain_state32_inc.awk
-       awk -f gen_domain_state32_inc.awk $< > $@
+       $(AWK) -f ./gen_domain_state32_inc.awk $< > $@
 
 amd64nt.obj: amd64nt.asm domain_state64.inc
        $(ASM)$@ $(ASMFLAGS) $<
index 428e758927fd9dba520ceb40ef6dfdc5aa82bf35..9760300d072752c73d22fdef6ea4c7178428791b 100644 (file)
@@ -320,6 +320,14 @@ static void read_main_debug_info(struct debug_info *di)
   CAMLassert(di->already_read == 0);
   di->already_read = 1;
 
+  /* At the moment, bytecode programs built with --output-complete-exe
+     do not contain any debug info.
+
+     See  https://github.com/ocaml/ocaml/issues/9344 for details.
+  */
+  if (caml_cds_file == NULL && caml_byte_program_mode == COMPLETE_EXE)
+    CAMLreturn0;
+
   if (caml_cds_file != NULL) {
     exec_name = caml_cds_file;
   } else {
index 657e6883b7cb615173e0a4b16e16397366c58bcc..8ceae4a5d8e2a3a5e078adf6e2f8c7d4486ada73 100644 (file)
@@ -28,7 +28,6 @@ extern asize_t caml_fl_cur_wsz;
 /* See [freelist.c] for usage info on these functions. */
 extern header_t *(*caml_fl_p_allocate) (mlsize_t wo_sz);
 extern void (*caml_fl_p_init_merge) (void);
-extern void (*caml_fl_p_reset) (void);
 extern header_t *(*caml_fl_p_merge_block) (value bp, char *limit);
 extern void (*caml_fl_p_add_blocks) (value bp);
 extern void (*caml_fl_p_make_free_blocks)
@@ -43,9 +42,6 @@ static inline header_t *caml_fl_allocate (mlsize_t wo_sz)
 static inline void caml_fl_init_merge (void)
   { (*caml_fl_p_init_merge) (); }
 
-static inline void caml_fl_reset (void)
-  { (*caml_fl_p_reset) (); }
-
 static inline header_t *caml_fl_merge_block (value bp, char *limit)
   { return (*caml_fl_p_merge_block) (bp, limit); }
 
@@ -57,6 +53,7 @@ static inline void caml_make_free_blocks
   { (*caml_fl_p_make_free_blocks) (p, size, do_merge, color); }
 
 extern void caml_set_allocation_policy (intnat);
+extern void caml_fl_reset_and_switch_policy (intnat);
 
 #ifdef DEBUG
 static inline void caml_fl_check (void)
index 7fea2b14435c6cf34e74f665865fb22657ec67c9..8eb09931ab44716b98cde8541de4b5ee41feeedd 100644 (file)
@@ -101,6 +101,8 @@ CAMLdeprecated_typedef(addr, char *);
 /* we need to be able to compute the exact offset of each member. */
 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
 #define CAMLalign(n) _Alignas(n)
+#elif defined(__cplusplus) && _MSC_VER >= 1900
+#define CAMLalign(n) alignas(n)
 #elif defined(SUPPORTS_ALIGNED_ATTRIBUTE)
 #define CAMLalign(n) __attribute__((aligned(n)))
 #elif _MSC_VER >= 1500
index a069a457fed7c691144968b7c124193cbf48de66..abbcd596d2aa95d1f809341f7bab16b011ab09ea 100644 (file)
@@ -47,6 +47,14 @@ extern int32_t caml_seek_optional_section(int fd, struct exec_trailer *trail,
 extern int32_t caml_seek_section(int fd, struct exec_trailer *trail,
                                  char *name);
 
+enum caml_byte_program_mode
+  {
+   STANDARD /* normal bytecode program requiring "ocamlrun" */,
+   COMPLETE_EXE /* embeding the vm, i.e. compiled with --output-complete-exe */
+  };
+
+extern enum caml_byte_program_mode caml_byte_program_mode;
+
 #endif /* CAML_INTERNALS */
 
 #endif /* CAML_STARTUP_H */
index 75c973fab92d92109646bb8c5dd3b17b0a287a31..4196776ef345edb24455fad4bfb26d76af2598d6 100644 (file)
@@ -168,6 +168,13 @@ static void do_compaction (intnat new_allocation_policy)
   caml_heap_check ();
 #endif
 
+  /* Make sure the heap is in the right state for compaction:
+     - all free blocks are blue
+     - all other blocks are white and contain valid pointers
+  */
+  caml_fl_reset_and_switch_policy (new_allocation_policy);
+
+
   /* First pass: encode all noninfix headers. */
   {
     ch = caml_heap_start;
@@ -410,10 +417,7 @@ static void do_compaction (intnat new_allocation_policy)
      structures from scratch. */
   {
     ch = caml_heap_start;
-    if (new_allocation_policy != -1){
-      caml_set_allocation_policy (new_allocation_policy);
-    }
-    caml_fl_reset ();
+    caml_fl_init_merge ();
     while (ch != NULL){
       if (Chunk_size (ch) > Chunk_alloc (ch)){
         caml_make_free_blocks ((value *) (ch + Chunk_alloc (ch)),
index 19c355900da03b3bb07dc556b60e3ffc7bf13cee..97392403d380fdb81f94b38d6dc2e0b3462cfd68 100644 (file)
@@ -246,12 +246,16 @@ static void nf_init_merge (void)
 #endif
 }
 
-static void nf_reset (void)
+static void nf_init (void)
 {
   Next_small (Nf_head) = Val_NULL;
   nf_prev = Nf_head;
   caml_fl_cur_wsz = 0;
-  nf_init_merge ();
+}
+
+static void nf_reset (void)
+{
+  nf_init ();
 }
 
 /* Note: the [limit] parameter is unused because we merge blocks one by one. */
@@ -693,12 +697,16 @@ static void ff_truncate_flp (value changed)
   }
 }
 
-static void ff_reset (void)
+static void ff_init (void)
 {
   Next_small (Ff_head) = Val_NULL;
   ff_truncate_flp (Ff_head);
   caml_fl_cur_wsz = 0;
-  ff_init_merge ();
+}
+
+static void ff_reset (void)
+{
+  ff_init ();
 }
 
 /* Note: the [limit] parameter is unused because we merge blocks one by one. */
@@ -1661,7 +1669,7 @@ static void bf_init_merge (void)
   }
 }
 
-static void bf_reset (void)
+static void bf_init (void)
 {
   mlsize_t i;
 
@@ -1673,7 +1681,30 @@ static void bf_reset (void)
   bf_large_tree = NULL;
   bf_large_least = NULL;
   caml_fl_cur_wsz = 0;
-  bf_init_merge ();
+}
+
+/* Make sure all free blocks are blue and tear down the BF data structures. */
+static void bf_reset (void)
+{
+  mlsize_t i;
+
+  for (i = 1; i <= BF_NUM_SMALL; i++){
+    /* At the beginning of each small free list is a segment of remnants
+       that were pushed back to the list after splitting. These are white
+       and they are not in order. We must make them blue before we can
+       compact or change the allocator policy.
+    */
+    value p = bf_small_fl[i].free;
+    while (1){
+      if (p == Val_NULL || Color_val (p) == Caml_blue) break;
+      CAMLassert (Color_val (p) == Caml_white);
+      Hd_val (p) = Bluehd_hd (Hd_val (p));
+      p = Next_small (p);
+    }
+  }
+  /* We have no malloced data structures, so we can just call [bf_init] to
+     clear all our pointers. */
+  bf_init ();
 }
 
 static header_t *bf_merge_block (value bp, char *limit)
@@ -1812,8 +1843,9 @@ header_t *(*caml_fl_p_allocate) (mlsize_t wo_sz) = &nf_allocate;
 /* Initialize the merge_block machinery (at start of sweeping). */
 void (*caml_fl_p_init_merge) (void) = &nf_init_merge;
 
-/* This is called by caml_compact_heap. */
-void (*caml_fl_p_reset) (void) = &nf_reset;
+/* These are called internally. */
+static void (*caml_fl_p_init) (void) = &nf_init;
+static void (*caml_fl_p_reset) (void) = &nf_reset;
 
 /* [caml_fl_merge_block] returns the head pointer of the next block after [bp],
    because merging blocks may change the size of [bp]. */
@@ -1851,6 +1883,7 @@ void caml_set_allocation_policy (intnat p)
     caml_fl_p_allocate = &nf_allocate;
     caml_fl_p_init_merge = &nf_init_merge;
     caml_fl_p_reset = &nf_reset;
+    caml_fl_p_init = &nf_init;
     caml_fl_p_merge_block = &nf_merge_block;
     caml_fl_p_add_blocks = &nf_add_blocks;
     caml_fl_p_make_free_blocks = &nf_make_free_blocks;
@@ -1863,6 +1896,7 @@ void caml_set_allocation_policy (intnat p)
     caml_fl_p_allocate = &ff_allocate;
     caml_fl_p_init_merge = &ff_init_merge;
     caml_fl_p_reset = &ff_reset;
+    caml_fl_p_init = &ff_init;
     caml_fl_p_merge_block = &ff_merge_block;
     caml_fl_p_add_blocks = &ff_add_blocks;
     caml_fl_p_make_free_blocks = &ff_make_free_blocks;
@@ -1875,6 +1909,7 @@ void caml_set_allocation_policy (intnat p)
     caml_fl_p_allocate = &bf_allocate;
     caml_fl_p_init_merge = &bf_init_merge;
     caml_fl_p_reset = &bf_reset;
+    caml_fl_p_init = &bf_init;
     caml_fl_p_merge_block = &bf_merge_block;
     caml_fl_p_add_blocks = &bf_add_blocks;
     caml_fl_p_make_free_blocks = &bf_make_free_blocks;
@@ -1884,3 +1919,14 @@ void caml_set_allocation_policy (intnat p)
     break;
   }
 }
+
+/* This is called by caml_compact_heap. */
+void caml_fl_reset_and_switch_policy (intnat new_allocation_policy)
+{
+  /* reset the fl data structures */
+  (*caml_fl_p_reset) ();
+  if (new_allocation_policy != -1){
+    caml_set_allocation_policy (new_allocation_policy);
+    (*caml_fl_p_init) (); /* initialize the new allocation policy */
+  }
+}
index 4e9ba799b2ebfc08c9065c9b26cb7f4484e1f01b..3fcad7dbf0b5ef0367843f939c441f0875dceca5 100644 (file)
@@ -98,6 +98,8 @@ static int read_trailer(int fd, struct exec_trailer *trail)
       ? 0 : WRONG_MAGIC;
 }
 
+enum caml_byte_program_mode caml_byte_program_mode = STANDARD;
+
 int caml_attempt_open(char_os **name, struct exec_trailer *trail,
                       int do_open_script)
 {
index 8aa243982149eca2568a789ca5d5e4c2f9cecdae..e2262d3cb6b300b93e46331ead0116d77a5bb69b 100755 (executable)
@@ -17,7 +17,7 @@
 case $1 in
   stdlib.cm[iox])
       echo ' -nopervasives -no-alias-deps -w -49' \
-           ' -pp "$AWK -f expand_module_aliases.awk"';;
+           ' -pp "$AWK -f ./expand_module_aliases.awk"';;
   camlinternalOO.cmx) echo ' -inline 0 -afl-inst-ratio 0';;
   camlinternalLazy.cmx) echo ' -afl-inst-ratio 0';;
     # never instrument camlinternalOO or camlinternalLazy (PR#7725)
index 6d609bc9103b186765202c6d877078a3fc9a2db3..5cd25f247f091829bfdcc53eea8d830db62eaf22 100644 (file)
@@ -26,12 +26,7 @@ COMPFLAGS=-strict-sequence -absname -w +a-4-9-41-42-44-45-48 \
           -g -warn-error A -bin-annot -nostdlib \
           -safe-string -strict-formats
 ifeq "$(FLAMBDA)" "true"
-OPTCOMPFLAGS=-O3
-else
-OPTCOMPFLAGS=
-endif
-ifeq "$(FUNCTION_SECTIONS)" "true"
-OPTCOMPFLAGS += -function-sections
+OPTCOMPFLAGS += -O3
 endif
 OPTCOMPILER=$(ROOTDIR)/ocamlopt
 CAMLOPT=$(CAMLRUN) $(OPTCOMPILER)
@@ -258,7 +253,7 @@ SPACE := $(EMPTY) $(EMPTY)
 depend:
        $(CAMLDEP) $(DEPFLAGS) $(filter-out stdlib.%,$(wildcard *.mli *.ml)) \
          > .depend.tmp
-       $(CAMLDEP) $(DEPFLAGS) -pp "$(AWK) -f remove_module_aliases.awk" \
+       $(CAMLDEP) $(DEPFLAGS) -pp "$(AWK) -f ./remove_module_aliases.awk" \
          stdlib.ml stdlib.mli >> .depend.tmp
        sed -Ee \
          's#(^| )(${subst ${SPACE},|,${UNPREFIXED_OBJS}})[.]#\1stdlib__\2.#g' \
index eed700a863c40110cd057ccf79bcecb102661879..0be4ed1a28831f56a44410afcf0924bfc3b56f52 100644 (file)
@@ -330,7 +330,7 @@ val enable_runtime_warnings: bool -> unit
 (** Control whether the OCaml runtime system can emit warnings
     on stderr.  Currently, the only supported warning is triggered
     when a channel created by [open_*] functions is finalized without
-    being closed.  Runtime warnings are enabled by default.
+    being closed.  Runtime warnings are disabled by default.
 
     @since 4.03.0 *)
 
index fb33f638a877c5a9e1451e59f6f7e5fa3c7883f2..9d7d6dc72517e053690c75877a1f0516851b7a71 100644 (file)
@@ -259,7 +259,7 @@ clean:
 .PHONY: report
 report:
        @if [ ! -f $(TESTLOG) ]; then echo "No $(TESTLOG) file."; exit 1; fi
-       @awk -f summarize.awk < $(TESTLOG)
+       @$(AWK) -f ./summarize.awk < $(TESTLOG)
 
 .PHONY: retry-list
 retry-list:
@@ -274,8 +274,8 @@ retry-list:
 
 .PHONY: retries
 retries:
-       @awk -v retries=1 -v max_retries=$(MAX_TESTSUITE_DIR_RETRIES) \
-            -f summarize.awk < $(TESTLOG) > _retries
+       @$(AWK) -v retries=1 -v max_retries=$(MAX_TESTSUITE_DIR_RETRIES) \
+            -f ./summarize.awk < $(TESTLOG) > _retries
        @test `cat _retries | wc -l` -eq 0 || $(MAKE) $(NO_PRINT) retry-list
        @rm -f _retries
 
diff --git a/testsuite/tests/output-complete-obj/github9344.ml b/testsuite/tests/output-complete-obj/github9344.ml
new file mode 100644 (file)
index 0000000..430e5ec
--- /dev/null
@@ -0,0 +1,14 @@
+(* TEST
+
+use_runtime = "false"
+
+* setup-ocamlc.byte-build-env
+** ocamlc.byte
+flags = "-w a -output-complete-exe -ccopt -I${ocamlsrcdir}/runtime"
+program = "github9344"
+*** run
+program = "sh ${test_source_directory}/github9344.sh"
+**** check-program-output
+*)
+
+raise Not_found
diff --git a/testsuite/tests/output-complete-obj/github9344.reference b/testsuite/tests/output-complete-obj/github9344.reference
new file mode 100644 (file)
index 0000000..5626c6c
--- /dev/null
@@ -0,0 +1 @@
+Fatal error: exception Not_found
diff --git a/testsuite/tests/output-complete-obj/github9344.sh b/testsuite/tests/output-complete-obj/github9344.sh
new file mode 100644 (file)
index 0000000..7e53231
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+export OCAMLRUNPARAM=b=1
+./github9344 || true
index 528cd94691fd0d4833f343915130498d8b10f40d..0fe82138ba641afadcea100b3d2e2205cccf874a 100644 (file)
@@ -4,5 +4,6 @@
 value caml_puts(value s)
 {
   puts(String_val(s));
+  fflush(stdout);
   return Val_unit;
 }
index 5207823a505d52ce4851b51e1a4413b1abf163f5..bee3d38268856595bc6a447bbc8eec14f75f1557 100644 (file)
@@ -16,6 +16,8 @@ program = "./test2"
 
 external puts: string -> unit = "caml_puts"
 
+let _ = at_exit (fun () -> print_endline "Program terminated")
+
 let () =
   Unix.putenv "FOO" "Hello OCaml!";
   puts (Unix.getenv "FOO")
index 6a561060c6e7060ee12efad05a52e9b0c145e0d9..32151005ede4da0f261fb24e4c09ea801e9efcb9 100644 (file)
@@ -1 +1,2 @@
 Hello OCaml!
+Program terminated
index 18aead93597a10257215e862404e48eb2f07e811..0a7b31b1458e609e47561d5f8e3e390cb0252b08 100644 (file)
@@ -30,7 +30,7 @@ DESTDIR ?=
 # Setup GNU make variables storing per-target source and target,
 # a list of installed tools, and a function to quote a filename for
 # the shell.
-override installed_tools := ocamldep ocamlprof ocamlcp \
+override installed_tools := ocamldep ocamlprof ocamlcp ocamloptp \
                    ocamlmktop ocamlmklib ocamlobjinfo
 
 install_files :=
@@ -126,6 +126,7 @@ ocamlcp_cmos = config.cmo build_path_prefix_map.cmo misc.cmo profile.cmo \
                main_args.cmo
 
 $(call byte_and_opt,ocamlcp,$(ocamlcp_cmos) ocamlcp.cmo,)
+$(call byte_and_opt,ocamloptp,$(ocamlcp_cmos) ocamloptp.cmo,)
 
 opt:: profiling.cmx
 
index 1c3d3078fabd3ab03a2bb20e531a9ae4ca9205e1..e2c42547faf9fedcd136225b383aa61442121f54 100644 (file)
@@ -58,8 +58,8 @@ if "%PORT%" equ "mingw32" (
 )\r
 \r
 cd "%APPVEYOR_BUILD_FOLDER%"\r
-appveyor DownloadFile "https://github.com/alainfrisch/flexdll/archive/0.37.tar.gz" -FileName "flexdll.tar.gz" || exit /b 1\r
-appveyor DownloadFile "https://github.com/alainfrisch/flexdll/releases/download/0.37/flexdll-bin-0.37.zip" -FileName "flexdll.zip" || exit /b 1\r
+appveyor DownloadFile "https://github.com/alainfrisch/flexdll/archive/%FLEXDLL_VERSION%.tar.gz" -FileName "flexdll.tar.gz" || exit /b 1\r
+appveyor DownloadFile "https://github.com/alainfrisch/flexdll/releases/download/%FLEXDLL_VERSION%/flexdll-bin-%FLEXDLL_VERSION%.zip" -FileName "flexdll.zip" || exit /b 1\r
 rem flexdll.zip is processed here, rather than in appveyor_build.sh because the\r
 rem unzip command comes from MSYS2 (via Git for Windows) and it has to be\r
 rem invoked via cmd /c in a bash script which is weird(er).\r