Commit Graph

77 Commits (ac2a9dd188f0738a87018f5ee6e6b0b301bb1b63)

Author SHA1 Message Date
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
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
Sébastien Hinderer 69316099b0 Fix BFD support on OpenBSD 2019-11-28 16:20:03 +01:00
Konstantin Romanov d11a60bc22 Add attribute(align()) detection and fix XLC build. 2019-11-25 20:39:52 +01:00
David Allsopp 75983ab9b1 Ensure Makefile.config gets Windows-style prefix
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.
2019-11-25 14:14:59 +01:00
Greta Yorsh 4da56cb632 Disallow function sections for arm32 (#9125)
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
2019-11-18 17:15:11 +01:00
Kate e0ee2f7a05 Fix configure: Define the CAML_SAFE_STRING variable when force-safe-string is on 2019-11-14 11:18:43 +00:00
Damien Doligez 01bdd5bbc4
best-fit allocator (#8809) 2019-10-15 13:52:16 +02:00
Gabriel Scherer e232369580
Merge pull request #8835 from dra27/save-the-planet
New configure option to disable building and installing library manpages
2019-10-05 16:52:16 +02:00
Sébastien Hinderer 987b0814d7 Let make's default target build the compiler
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.
2019-09-30 16:01:29 +02:00
David Allsopp 0912745754 Make STDLIB_MANPAGES a boolean, not a target 2019-09-27 17:13:42 +01:00
David Allsopp 2d717cb71a Add --disable-stdlib-manpages to configure 2019-09-27 17:13:24 +01:00
Sébastien Hinderer ff20676fdc configure: improve support for the BFD library
This commit adds:

- The --with-bfd command-line option

- The BFD_INCLUDE_DIR and BFD_LIB_DIR configuration variables
2019-09-23 14:48:48 +02:00
Sébastien Hinderer e3b33a5750 Build system: introduce the BFD_LDFLAGS variable
This variable is not really used yet but will be used soon.
2019-09-23 14:45:54 +02:00
Sébastien Hinderer 762fe0abaa Build system: rename the LIBBFD_INCLUDE variable to BFD_CPPFLAGS 2019-09-23 14:45:54 +02:00
Sébastien Hinderer d718cd9db3 Build system: rename the LIBBFD_LINK variable to BFD_LDFLAGS 2019-09-23 14:45:54 +02:00
Sébastien Hinderer 3d642545e8 configure: fix typo in variable name 2019-09-23 14:45:54 +02:00
Kate c01dbc1bab Enable force-safe-string by default (#1859)
* 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
2019-09-10 17:49:20 +02:00
Stephen Dolan 5e4b55d3bd Use the autoconf- or system-provided off_t rather than redetecting. (#8843)
Fixes: #8841
2019-07-31 13:56:26 +02:00
David Allsopp c43d198cfa Merge pull request #8830 from glondu/4.08-configure-fixes
Small fixes in configure.ac

(cherry-picked from commit 1e610e2703927144786c2e62907cd07e28677a0f)
2019-07-30 10:55:58 +01:00
Greta Yorsh 2857be6cf7 Error in configure --enable-function-sections if target doesn't support it
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.
2019-07-15 10:25:26 +01:00
Greta Yorsh 351edb49bb Add compile-time option -function-sections 2019-07-15 10:25:26 +01:00
Greta Yorsh 27a92a9445 Emit each function in a separate section (amd64,i386,arm,arm64)
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.
2019-07-15 10:25:26 +01:00
David Allsopp 6c87f5e391 Use AC_PREREQ to force Autoconf 2.69 2019-06-11 09:56:01 +02:00
David Allsopp c37a6e5d90
Fix --with-pic in configure (#8632)
--with-pic should be adding -fPIC (or equivalent) to $internal_cflags,
not $common_cflags. Additionally, unused variable aspp was being
updated, instead of ASPP.
2019-05-21 11:07:47 +01:00
Sébastien Hinderer b694e84aff configure: fix libunwind and spacetime support 2019-05-20 16:37:41 +02:00
Sébastien Hinderer 17feab2a4f
configure: use variables rather than arguments for a few options (#8616)
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
2019-05-09 16:39:06 +02:00
David Allsopp b818e2af91 Correct MKEXEDEBUGFLAG for msvc (#8638) 2019-05-03 09:25:37 +02:00
David Allsopp 8838dc7527 Don't generate #! headers over 127 characters
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.
2019-05-02 20:29:49 +02:00