When building for the first time, the only requirement is that generated
header files have been built (jumptbl.h, version.h and opnames.h).
Detailed dependency information is only required when headers have been
edited.
COMPUTE_DEPS in Makefile.config controls whether C dependency
information should be generated on a per-file basis. This variable is
controlled by a new --disable-dependency-generation in configure which
is enabled for Git checkouts and disabled for tarballs (i.e. releases).
The Microsoft C compiler (cl) cannot generate dependencies in a
consistent way which we can consume, so for a Git checkout configure
searches for an additional C compiler in order to compute dependencies.
This is obviously not required for a user-build.
As a result, the MSVC port can now safely run make alldepend, since only
OCaml dependency information is committed to the repo after this change.
CI does not need to waste time testing the dependency information,
because it only tests a single build. A single Travis job has been added
which tests the build system code to generate the dependency information
(and provides a single `make -j` run in CI, although Inria's CI also
tests parallel building continuously).
This moves the configure-generated parts of Makefile.common to a
separate (generated) Makefile, allowing Makefile.common to be a normal
Makefile.
OCaml's build system Makefile's now include Makefile.build_config (which
itself includes Makefile.config) but Makefile.config is still installed
as before. This allows configure to generate variables which are
specific to the build process and are not intended to be exported to the
installation.
The instrumentation code in the instrumented runtime was replaced
with new APIs to gather runtime statistics and output them in a new format
(Common Trace Format).
This commit also exposes new functions in the Gc module to pause or resume
instrumentation during a program execution (Gc.eventlog_pause and
Gc.eventlog_resume).
Follow-up to c5afa9303.
The GCC option -fexcess=precision is supported for C but not for C++.
Some users use ocamlc -c or ocamlopt -c to compile C++ source files,
causing errors since -fexcess-precision=standard was added to the
common C flags in commit c5afa9303.
This commit moves -fexcess-precision=standard to the internal C flags,
so that ocamlc -c and ocamlopt -c will not apply it to C / C++ source files.
Config.ocamlopt_cflags and Config.ocamlopt_cppflags were solely used by
the driver when compiling .c files passed on the command line. The
behaviour of this should be the same as for `ocamlc -c` and the
inclusion of `-fPIC` in `ocamlc_cflags` only on some systems causes
problems for `ocamlmklib` which behaves as though the two drivers
compile C files identically.
This PR eliminates the separate settings in configure.ac and deprecates
the old variables in Config.
Alpine Linux and perhaps other musl-based Linux distributions produce
position-independent executables (PIEs) by default. If non-PIC object
files are given to the linker, it silently produces a wrong executable
that crashes when run. This is the case for ocamlopt-generated code,
which by default is not PIC except on amd64 (x86_64) and s390x (Z systems).
Closes: #7562
In recent FreeBSD, `cc` is Clang and `ld` is LLD, the LLVM linker, but
`as` is still GNU binutils. Moreover, Clang contains its own
assembler and does not call `as`. Consequently, object files produced
by invoking `as` directly are slightly different from those produced
by `cc`.
This can cause obscure errors such as issue #9068: `ld -r` fails when
combining objects produced by `as` and objects produced by `cc`.
The workaround is to use `cc` as the assembler. We already did that
for the ARM and ARM64 targets, but #9068 shows that it is necessary
for AMD64 too. Just use `cc` as assembler for all FreeBSD targets.
Similar issues were reported under Linux when clang and LLD are used
instead of GCC and binutils. We already used clang as the preprocessed
assembler in this case. Also use clang as the assembler in this case.
Closes: #9068
This option forces GCC to follow the ISO C standards concerning
rounding of intermediate FP results. It avoids some FP issues
with the x86 32 bits ports of OCaml, which can run into
excess precision problems due to the x87 FP unit.
Closes: #7917
This commit uses the previously computed set of options for linking
dynamic libraries (DLLIBS) in stead of hard-coding "-ldl" when trying
to find which libraries to link to get BFD support.
For instance, this fixes the build on OpenBSD64 where the use of
"-ldl" caused an error.
CPPFLAGS was saved, then extended with -D_GNU_SOURCE for the purpose of
testing secure_getenv, then not restored because of a typo.
This caused later tests to succeed (because of -D_GNU_SOURCE) while
they should have failed (because of restrictive flags like -std=c99).
Prefix may be passed to configure using a Cygwin-style PATH (e.g.
`./configure --prefix ~/local`). Use cygpath to ensure that the correct
version gets written to Makefile.config, or the resulting compiler has
an invalid default stdlib path.
Disallow function sections on arm32, as the simplest way to address issue #9124 and get the CI working on the newer versions of GNU binutils for Raspbian. After this change, configure --enable-function-sections is an error on arm32. When the issue with GNU ld is resolved, this can be added back with appropriate checks on version of binutils.
Closes: #9124
This commit makes it possible to build the OCaml compiler according to
its configuration by simply runnning make. There is no need to specify
neither world nor world.opt explicitly, although the two targets
remain available.
This commit also introduces (and starts making use of) the
NATIVE_COMPILER build variable whosse value is true when the native
compiler is enabled and false otherwise.
* Enable force-safe-string by default
* Run the autogen script
* Add a line to the changelog
* Remove test using the -unsafe-string argument
* Disable program comparison for tests giving different binaries between ocamlopt.opt and ocamlopt.byte after switching to force-safe-string by default
* Add a comment where the compare_programs tests have been disabled to refer to an explaination of the problem
If the user explicitly requests function sections by calling configure
with --enable-function-sections on a target that does not support it,
it's an error at configure time.
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.
--with-pic should be adding -fPIC (or equivalent) to $internal_cflags,
not $common_cflags. Additionally, unused variable aspp was being
updated, instead of ASPP.
This commit replaces a few configure command-line options by configuration
variables:
- "--with-dllibs" is replaced by DLLIBS
- "--with-reserved-header-bits" is replaced by RESERVED_HEADER_BITS
- "--with-default-string" is replaced by DEFAULT_STRING
A #! line should not exceed 128 characters (including the \0
terminator). This adds a test - both to the generation of the camlheader
files and also to the -use-runtime flag which falls back to #!/bin/sh
and uses exec to invoke the the interpreter.