Commit Graph

646 Commits (master)

Author SHA1 Message Date
Florian Angeletti 21c33a53cd first commit after branching 4.12 2020-10-19 16:19:49 +02:00
Florian Angeletti 24dbb0976a last commit before branching 4.12 2020-10-19 16:08:29 +02:00
Xavier Leroy 53ed75072d configure --enable-reserved-header-bits=N: fix range of accepted N
It ranges between 0 and 31, not 0 and 21.
2020-10-09 14:50:13 +02:00
Nicolás Ojeda Bär 540996d21e Remove Spacetime 2020-10-08 20:28:12 +02:00
Xavier Leroy af48d9fe8f
Add a naked pointers dynamic checker (#9956)
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>
2020-10-05 14:44:31 +02:00
David Allsopp 92ae58e9c1 Fix typo in configure.ac 2020-08-19 20:56:33 +01:00
Sébastien Hinderer 478127ff43 Build system: use OC_CFLAGS and CFLAGS even during the link stage 2020-08-10 13:52:47 +02:00
Sébastien Hinderer f3ff1337a1 Build system: honour the CFLAGS and CPPFLAGS build variables
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.
2020-08-06 14:30:50 +02:00
EduardoRFS 5e7f7c77b0 ios: add support on configure script 2020-07-25 08:37:38 +00:00
EduardoRFS 8cd474f008 ios: Sys.command is not supported 2020-07-25 08:37:06 +00:00
EduardoRFS 863e20e919 configure prevent adding -lpthread when Android 2020-07-17 12:44:33 -03:00
EduardoRFS 8c45f14f0a check if shmat is available to use afl
* Android has sys/shm.h but doesn't have shmat
2020-07-17 12:44:16 -03:00
Xavier Leroy efc11853fe Spurious comma in the endianness test, big-endian case 2020-07-14 19:24:44 +02:00
Nicolás Ojeda Bär f1b42faf9c autogen 2020-07-02 06:40:10 +02:00
David Allsopp 9c0412f41a Always permit triplet-prefixed ld in PACKLD
Fixes #7121
2020-05-13 10:21:46 +01:00
Xavier Leroy 41227a1eba configure: add a NAKED_POINTERS parameter to Makefile.config
We have NAKED_POINTERS=false if configured with --disable-naked-pointers,
NAKED_POINTERS=true otherwise.
2020-06-22 14:20:05 +02:00
David Allsopp 2f38a52086
Merge pull request #9625 from dra27/warn-error
--enable-warn-error configure option
2020-06-10 11:32:13 +01:00
David Allsopp d192a2c284 Eliminate MKEXE_ANSI from build system 2020-06-06 13:36:15 +01:00
Xavier Leroy 4bf7a79137
Turn debugger off in programs launched by the program being debugged (#9594)
* 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.
2020-06-01 19:10:12 +02:00
David Allsopp 9f9d8063af Rename $gcc_warnings to $cc_warnings in configure 2020-06-01 18:07:10 +01:00
David Allsopp 75c9cd3b38 Add --enable-warn-error
On by default if +dev appears in VERSION and also fixed for MSVC.
2020-06-01 17:34:41 +01:00
Jacques-Henri Jourdan 3d63a106b6
Memprof: optimize random sampling (#9466)
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.
2020-05-25 09:51:15 +02:00
Xavier Leroy a364988ba8
Update link options for PowerPC 32 bits Linux (#9572)
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.
2020-05-20 15:12:41 +02:00
Xavier Leroy 82af966ebd Detect availability of <spawn.h> and posix_spawn function 2020-05-19 19:21:18 +02:00
Hannes Mehnert 3f7e56c40d
configure: support bfd on FreeBSD (#9531)
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
2020-05-04 14:26:32 +01:00
David Allsopp ac2a9dd188 Cease committing C dependendency information
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).
2020-04-17 14:11:22 +01:00
David Allsopp 3a40b2fd94 Introduce Makefile.build_config.in
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.
2020-04-17 13:53:49 +01:00
Enguerrand Decorne b7f0494df5 Rewrite the instrumented runtime to store traces in the CTF format.
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).
2020-04-30 10:32:01 +02:00
Anarchos abfd5d87bb
Compiling for Haiku OS: network functions reside in libnetwork (#9486)
Compiling for Haiku : network functions reside in libnetwork
2020-04-27 10:36:28 +01:00
Xavier Leroy 4d3b4311ac
configure: move -fexcess-precision=standard to the internal cflags (#9496)
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.
2020-04-24 18:00:05 +02:00
Nicolás Ojeda Bär 8f3833c4d0
Add RISC-V native-code backend (#9441)
This is a port of ocamlopt for the RISC-V processor in 64-bit mode.
2020-04-24 16:04:50 +02:00
Damien Doligez ea4542d819 first commit after branching 4.11.0 2020-04-22 17:33:19 +02:00
Damien Doligez e92d13c986 last commit before branching 4.11 2020-04-22 17:28:08 +02:00
David Allsopp 2b4fe09dc7 Eliminate Config.ocamlopt_c{,pp}flags
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.
2019-04-20 13:00:30 +01:00
Xavier Leroy da12974492
Turn off PIE for musl-based Linux on platforms other than amd64 and s390x (#9456)
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
2020-04-18 11:16:23 +02:00
Xavier Leroy 88a1bceb1b
configure: use cc as assembler with clang and for all FreeBSD platforms (#9437)
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
2020-04-11 11:17:11 +02:00
Xavier Leroy e35babe426 configure: use m4_normalize to reformat long messages 2020-04-08 19:17:11 +02:00
Xavier Leroy 797698d8b0 configure: quote [] inside cases of AS_CASE construct
Patterns such as `gcc-[012]-*` are expanded as `gcc-012-*`.
An extra quoting is needed: `gcc-[[012]]-*` is expanded as `gcc-[012]-*`.
2020-04-08 19:17:11 +02:00
Xavier Leroy c5afa9303d configure: add GCC option -fexcess-precision=standard
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
2020-04-08 19:17:11 +02:00
Xavier Leroy 743ca1baff configure for mingw: GCC optimization options
Require GCC >= 5.0 and use the same GCC optimization options as for
the other ports.
2020-04-08 19:17:11 +02:00
Sébastien Hinderer eb2fe19be7 Yet another fix to BFD support
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.
2020-02-17 14:46:28 +01:00
David Allsopp 648d7a4a3f
Merge pull request #9250 from dra27/disable-ocamltest
Add --disable-ocamltest to configure
2020-02-14 10:32:43 +00:00
Florian Angeletti 9b36ee9cda
Merge pull request #9302 from shindere/bfd-ld
Fix support for the bfd library
2020-02-14 10:15:51 +01:00
David Allsopp fd6c0e3a03 Don't built ocamltest on release builds
--enable-ocamltest is paranoidly included in the CI scripts, although
the trees are never pushed with a release VERSION at the tip.
2020-02-13 16:53:07 +00:00
Sébastien Hinderer 4199406243 Fix support for the bfd library
There was a regression: -ldl was not tried to link with the bfd library.

This commit fixes this regression.
2020-02-13 17:42:10 +01:00
David Allsopp a87ad8f18b Use -Wdeclaration-after-statement
This GCC flag encourages development of C files which will compile
without error on older Microsoft C compilers.
2020-02-11 10:07:04 +00:00
David Allsopp b03c1c78c7 Add --disable-ocamltest 2020-01-16 16:50:27 +00:00
David Allsopp 075154df54 Define ARCH_ALIGN_INT64
Missed in the autoconf conversion
2020-01-16 16:03:17 +00:00
Xavier Leroy 04c37411a3 Restore CPPFLAGS correctly
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).
2019-12-22 15:38:28 +01:00
Xavier Leroy 06db4c995c Activate the -fno-common flag of GCC and Clang
So that problems with multiple definitions of global C variables
are detected early during development (see #9144 and #9176 for examples).
2019-12-12 16:43:00 +01:00