Add --enable-function-sections option to configure. With this option,
the compiler will emit each function in a separate named text section,
on supported targets. This enables function reordering using a linker
script. With this option, the compiler also emits caml_hot__code_begin
and caml_hot__code_end sections. This allows a linker script to
move function sections outside of the segments they belong to,
without breaking caml_code_segments.
There were some issues in the way parameters from Makefile.config
are inserted in utils/config.mlp to produce utils/config.ml:
- Some of the make functions involved used parameter "$2" yet
were called with only one argument, causing a warning by
"make --warn-undefined-variables".
- Despite heroic attempts, special characters in the parameters
were not always quoted or quoted enough. For example,
if FLEXDLL_DIR is C:\foo, the generated utils/config.ml
contains "C:\foo", which is not a valid OCaml string literal.
This commit fixes these issues by:
- Revising and commenting the make functions that produce
the properly-quoted sed substitution commands.
- Adding an extra round of quoting for variables used inside
OCaml's string literals "..." (function SUBST_STRING)
- Adding two round-trip tests (make test-subst, make test-subst-string)
to make sure that all printable characters are properly quoted.
This commit removes support for gprof-based profiling (the -p option to ocamlopt). It follows a discussion on the core developers' list, which indicated that removing gprof support was a reasonable thing to do. The rationale is that there are better easy-to-use profilers out there now, such as perf for Linux and Instruments on macOS; and the gprof support has always been patchy across targets. We save a whole build of the runtime and simplify some other parts of the codebase by removing it.