Gentoo Archives: gentoo-commits

From: Alfredo Tupone <tupone@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/ocaml/, dev-lang/ocaml/files/
Date: Fri, 25 Feb 2022 19:58:35
Message-Id: 1645819092.85fb0c39c57aae6d7795b6ee1259d53ecfebd882.tupone@gentoo
1 commit: 85fb0c39c57aae6d7795b6ee1259d53ecfebd882
2 Author: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 25 19:58:12 2022 +0000
4 Commit: Alfredo Tupone <tupone <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 25 19:58:12 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85fb0c39
7
8 dev-lang/ocaml: fix TEXTREL on 4.12.1
9
10 Closes: https://bugs.gentoo.org/825282
11 Package-Manager: Portage-3.0.30, Repoman-3.0.3
12 Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
13
14 .../files/ocaml-4.12.1-fix-textrel-riscv.patch | 46 ++++++++++++++++++++++
15 dev-lang/ocaml/ocaml-4.12.1.ebuild | 1 +
16 2 files changed, 47 insertions(+)
17
18 diff --git a/dev-lang/ocaml/files/ocaml-4.12.1-fix-textrel-riscv.patch b/dev-lang/ocaml/files/ocaml-4.12.1-fix-textrel-riscv.patch
19 new file mode 100644
20 index 000000000000..5ba8582d3a65
21 --- /dev/null
22 +++ b/dev-lang/ocaml/files/ocaml-4.12.1-fix-textrel-riscv.patch
23 @@ -0,0 +1,46 @@
24 +From ddf99786f8229c8282905af5c7c74360d4f2fbd0 Mon Sep 17 00:00:00 2001
25 +From: Alex Fan <alex.fan.q@×××××.com>
26 +Date: Tue, 22 Feb 2022 19:28:30 +1100
27 +Subject: [PATCH] riscv: Generate frametable in data section to improve code
28 + relocatability (#11042)
29 +
30 +Similar to what PowerPC and System-Z have done in commit 24980d3fd9848e281761ef2b8fe383e71261789b
31 +
32 +With this commit ocamlopt produces .so shared libraries and PIE relocatable
33 +executables that contain no relocations in the text segment.
34 +
35 +Upstream status: merged in 4.14 and 5.x
36 +---
37 + Changes | 5 +++++
38 + asmcomp/riscv/emit.mlp | 2 +-
39 + 2 files changed, 6 insertions(+), 1 deletion(-)
40 +
41 +diff --git a/Changes b/Changes
42 +index 4898e9d69fc..2bec76daac6 100644
43 +--- a/Changes
44 ++++ b/Changes
45 +@@ -477,6 +477,11 @@ OCaml 4.14.0
46 + - #10907, #10959: Wrong type inferred from existential types
47 + (Jacques Garrigue and Gabriel Scherer, report by @dyzsr, review by Leo White)
48 +
49 ++- #10688: Move frame descriptor table from `rodata` to `data` section on
50 ++ RISC-V. Improves support for building DLLs and PIEs. In particular, this
51 ++ applies to all binaries in distributions that build PIEs by default (eg
52 ++ Gentoo and Alpine).
53 ++ (Alex Fan, review by Gabriel Scherer)
54 +
55 + OCaml 4.13 maintenance branch
56 + -----------------------------
57 +diff --git a/asmcomp/riscv/emit.mlp b/asmcomp/riscv/emit.mlp
58 +index 474a3c6857a..b36aa0ea38c 100644
59 +--- a/asmcomp/riscv/emit.mlp
60 ++++ b/asmcomp/riscv/emit.mlp
61 +@@ -645,7 +645,7 @@ let end_assembly() =
62 + `{emit_symbol lbl_end}:\n`;
63 + ` .quad 0\n`;
64 + (* Emit the frame descriptors *)
65 +- ` {emit_string rodata_space}\n`;
66 ++ ` {emit_string data_space}\n`; (* not rodata because relocations inside *)
67 + let lbl = Compilenv.make_symbol (Some "frametable") in
68 + declare_global_data lbl;
69 + `{emit_symbol lbl}:\n`;
70
71 diff --git a/dev-lang/ocaml/ocaml-4.12.1.ebuild b/dev-lang/ocaml/ocaml-4.12.1.ebuild
72 index fd6cae2fff2c..70049fcc0ae4 100644
73 --- a/dev-lang/ocaml/ocaml-4.12.1.ebuild
74 +++ b/dev-lang/ocaml/ocaml-4.12.1.ebuild
75 @@ -24,6 +24,7 @@ QA_FLAGS_IGNORED='/usr/lib.*/ocaml/bigarray.cmxs'
76
77 PATCHES=(
78 "${FILESDIR}"/${PN}-4.12.0-glibc-2.34.patch
79 + "${FILESDIR}"/${P}-fix-textrel-riscv.patch
80 )
81
82 src_prepare() {