This is selected at configure-time, option --enable-naked-pointers-checker.
The major GC warns when it detects out-of-heap pointers that could cause the no-naked-pointers runtime system to crash.
This is supported on x86-64 only, but on all ports (Unix and Windows).
Added tests involving naked pointers in tests/runtime-naked-pointers
Co-authored-by: KC Sivaramakrishnan <kc@kcsrk.info>
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
Co-authored-by: Enguerrand Decorne <decorne.en@gmail.com>
With this commit, it becomes possible to provide C compiler and preprocessor
flags to use in addition to those defined by the build system.
As required by the GNU coding standards, the flags can be provided
either at configure or at make invocation.
The provided CFLAGS and CPPFLAGS will also be taken into account
when C code is compiled by ocamlc/ocamlopt.
This commit removes the explicit reference to CFLAGS in the
configuration for the xlc compiler, since it is not necessary any longer.
* Undefine the CAML_DEBUG_SOCKET variable early
So that if the debugged program creates or executes another program
that happens to be an OCaml bytecode executable, said program does
not try to connect to the debugger at beginning of execution.
Fixes: #8678
* Check availability of setenv() and unsetenv()
And guard the use of unsetenv() in runtime/debugger.c.
Instead of using the stdlib logf function for computing logarithms, we
use a faster polynomial-based approximation.
We use the xoshiro PRNG instead of the Mersenne Twister. xoshiro is
simpler and faster.
We generate samples by batches so that compilers can vectorize the
generation loops using SIMD instructions when possible.
On PowerPC 32 bits Linux, recent versions of GCC produce "secure PLT"
relocatable code by default, while ocamlopt still generates "BSS PLT"
relocatable code. This causes a warning at link-time when "BSS PLT"
object files (produced by ocamlopt) are being linked.
This PR makes sure that "-mbss-plt" is added to the OC_LDFLAGS and
MKSHAREDLIB variables on PowerPC 32 bits Linux.
On FreeBSD, libbfd is - similarly to OpenBSD - not installed by default, but
can be added via the devel/libbfd port. This will install libbfd into the
/usr/local prefix, thus configure needs to look there for include and library
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