Enable LTO again.

NOTE: I did not build this in Rawhide, because building it appears to
change some of the ocamlx() dependencies, which would require
everything in Rawhide to be rebuilt.  I will build all OCaml packages
in Rawhide once OCaml 4.11.0 has been released which should be in a
week or two.
This commit is contained in:
Richard W.M. Jones 2020-08-04 12:29:58 +01:00
parent 493a29c315
commit cf41d3d77d
9 changed files with 69 additions and 22 deletions

View File

@ -1,7 +1,7 @@
From 1b1a2ad3294327e5bbbc753f306d1199b0a2a583 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 24 Jun 2014 10:00:15 +0100
Subject: [PATCH 1/7] Don't add rpaths to libraries.
Subject: [PATCH 1/8] Don't add rpaths to libraries.
---
tools/Makefile | 4 ++--
@ -23,5 +23,5 @@ index 96a4244cc..076411a91 100644
> ocamlmklibconfig.ml
--
2.24.1
2.28.0.rc2

View File

@ -1,7 +1,7 @@
From 8ea0bc7713a89cd6340e35b4dae048be63c50aec Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 May 2012 20:44:18 +0100
Subject: [PATCH 2/7] configure: Allow user defined C compiler flags.
Subject: [PATCH 2/8] configure: Allow user defined C compiler flags.
---
configure.ac | 4 ++++
@ -23,5 +23,5 @@ index fbd49c1ee..a35da2040 100644
# Enable SSE2 on x86 mingw to avoid using 80-bit registers.
--
2.24.1
2.28.0.rc2

View File

@ -1,7 +1,7 @@
From 39df379f1aa139a073d7b436bb9bd33ef2f70caf Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 26 Apr 2019 16:16:29 +0100
Subject: [PATCH 3/7] configure: Remove incorrect assumption about
Subject: [PATCH 3/8] configure: Remove incorrect assumption about
cross-compiling.
See https://github.com/ocaml/ocaml/issues/8647#issuecomment-487094390
@ -39,5 +39,5 @@ index a35da2040..4c9358897 100644
# We first compute default values for as and aspp
# If values have been given by the user then they take precedence over
--
2.24.1
2.28.0.rc2

View File

@ -1,7 +1,7 @@
From e829051c3b35920db3c5e0dd913026f556448675 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 18 Jan 2020 11:31:27 +0000
Subject: [PATCH 4/7] Remove configure from .gitattributes.
Subject: [PATCH 4/8] Remove configure from .gitattributes.
It's not a binary file.
---
@ -24,5 +24,5 @@ index 200eb49c6..d871764de 100644
# http://krlmlr.github.io/using-gitattributes-to-avoid-merge-conflicts/
/.mailmap merge=union
--
2.24.1
2.28.0.rc2

View File

@ -1,7 +1,7 @@
From 1a0ca036e40cbd701cbe3f0e5cf5e2a6b6d4c804 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20Ojeda=20B=C3=A4r?= <n.oje.bar@gmail.com>
Date: Fri, 24 Apr 2020 16:04:50 +0200
Subject: [PATCH 5/7] Add RISC-V native-code backend (#9441)
Subject: [PATCH 5/8] Add RISC-V native-code backend (#9441)
This is a port of ocamlopt for the RISC-V processor in 64-bit mode.
@ -2008,5 +2008,5 @@ index 000000000..efb30a80f
+caml_c_call:
+ jr t2
--
2.24.1
2.28.0.rc2

View File

@ -1,7 +1,7 @@
From d26a313ae92bb515b04865b6a71a63701dd1fe41 Mon Sep 17 00:00:00 2001
From: Xavier Leroy <xavier.leroy@college-de-france.fr>
Date: Thu, 30 Apr 2020 16:18:06 +0200
Subject: [PATCH 6/7] Support FP reg -> int reg moves
Subject: [PATCH 6/8] Support FP reg -> int reg moves
Using instruction fmv.x.d.
@ -30,5 +30,5 @@ index dc652de42..dbfdc2d40 100644
let ofs = slot_offset s (register_class dst) in
emit_store src ofs
--
2.24.1
2.28.0.rc2

View File

@ -1,7 +1,7 @@
From 5bc92d0cdb5cb26b8d8d517f30914c2b18e85f2b Mon Sep 17 00:00:00 2001
From: Xavier Leroy <xavier.leroy@college-de-france.fr>
Date: Thu, 30 Apr 2020 16:19:16 +0200
Subject: [PATCH 7/7] Update C calling conventions to the RISC-V ELF psABI
Subject: [PATCH 7/8] Update C calling conventions to the RISC-V ELF psABI
The original implementation of loc_external_arguments and
loc_external_results was following an older ABI,
@ -55,5 +55,5 @@ index 70909cd83..4c7b58612 100644
loc.(i) <- [| stack_slot (make_stack !ofs) Float |];
ofs := !ofs + size_float
--
2.24.1
2.28.0.rc2

View File

@ -0,0 +1,49 @@
From 7364f5081851fe306802883d9a8069da559d4973 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 4 Aug 2020 12:26:12 +0100
Subject: [PATCH 8/8] runtime/major_gc.c: Declare caml_fl_merge with proper
type.
When compiling OCaml with LTO enabled (as is now done routinely in
Fedora and OpenSUSE) we got a failure because the caml_fl_merge symbol
is not declared identically across compilation units. The simple fix
is to make sure the declarations are identical, although probably
moving the definition to a common header file would be a better
long-term fix.
major_gc.c:66:14: warning: type of 'caml_fl_merge' does not match original declaration [-Wlto-type-mismatch]
66 | extern char *caml_fl_merge; /* Defined in freelist.c. */
| ^
freelist.c:47:7: note: 'caml_fl_merge' was previously declared here
47 | value caml_fl_merge = Val_NULL; /* Current insertion pointer. Managed
| ^
freelist.c:47:7: note: code may be misoptimized unless '-fno-strict-aliasing' is used
---
runtime/major_gc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtime/major_gc.c b/runtime/major_gc.c
index 5e4f06bce..c8f5a3281 100644
--- a/runtime/major_gc.c
+++ b/runtime/major_gc.c
@@ -63,7 +63,7 @@ uintnat caml_dependent_size, caml_dependent_allocated;
double caml_extra_heap_resources;
uintnat caml_fl_wsz_at_phase_change = 0;
-extern char *caml_fl_merge; /* Defined in freelist.c. */
+extern value caml_fl_merge; /* Defined in freelist.c. */
static char *markhp, *chunk, *limit;
static double p_backlog = 0.0; /* backlog for the gc speedup parameter */
@@ -570,7 +570,7 @@ static void sweep_slice (intnat work)
break;
case Caml_blue:
/* Only the blocks of the free-list are blue. See [freelist.c]. */
- caml_fl_merge = Bp_hp (hp);
+ caml_fl_merge = (value) Bp_hp (hp);
break;
default: /* gray or black */
CAMLassert (Color_hd (hd) == Caml_black);
--
2.28.0.rc2

View File

@ -31,7 +31,7 @@
Name: ocaml
Version: 4.11.0
Release: 0.8.dev2%{?dist}
Release: 0.9.dev2%{?dist}
Summary: OCaml compiler and programming environment
@ -69,6 +69,9 @@ Patch0005: 0005-Add-RISC-V-native-code-backend-9441.patch
Patch0006: 0006-Support-FP-reg-int-reg-moves.patch
Patch0007: 0007-Update-C-calling-conventions-to-the-RISC-V-ELF-psABI.patch
# Fix compilation with LTO (sent upstream 2020-08-04).
Patch0008: 0008-runtime-major_gc.c-Declare-caml_fl_merge-with-proper.patch
BuildRequires: git
BuildRequires: gcc
BuildRequires: autoconf
@ -174,12 +177,6 @@ autoconf --force
%build
# This package fails to build with LTO due to undefined symbols. LTO
# was disabled in OpenSuSE as well, but with no real explanation why
# beyond the undefined symbols. It really shold be investigated further.
# Disable LTO
%define _lto_cflags %{nil}
%ifnarch %{no_parallel_build_arches}
make="%make_build"
%else
@ -381,8 +378,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/ocaml/eventlog_metadata
%changelog
* Tue Aug 04 2020 Richard W.M. Jones <rjones@redhat.com> - 4.11.0-0.8.dev2
* Tue Aug 04 2020 Richard W.M. Jones <rjones@redhat.com> - 4.11.0-0.9.dev2
- Bump and rebuild to fix DWARF versioning issues.
- Enable LTO again.
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.11.0-0.7.dev2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild