[Pkg-ocaml-maint-commits] [ocaml] 01/02: Mark certain symbols as .hidden in arm64 codegen, fixing FTBFS with binutils 2.29

Ximin Luo infinity0 at debian.org
Sat Jul 29 09:08:38 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian/experimental
in repository ocaml.

commit e83a0d9e5232b1429eb2be79e16c11ee9b1a152e
Author: Ximin Luo <infinity0 at debian.org>
Date:   Sat Jul 29 11:00:28 2017 +0200

    Mark certain symbols as .hidden in arm64 codegen, fixing FTBFS with binutils 2.29
---
 debian/changelog                                   |  7 +++
 ...-arm64-hide-symbols-for-stricter-binutils.patch | 52 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 60 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 4437c7f..2d88ebb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ocaml (4.05.0-6) UNRELEASED; urgency=medium
+
+  * Mark certain symbols as .hidden in arm64 codegen, fixing FTBFS with
+    binutils 2.29. (Closes: #868860)
+
+ -- Ximin Luo <infinity0 at debian.org>  Sat, 29 Jul 2017 00:47:57 +0200
+
 ocaml (4.05.0-5) experimental; urgency=medium
 
   * Proper fix for kfreebsd-* not having dup3/pipe2.
diff --git a/debian/patches/0011-arm64-hide-symbols-for-stricter-binutils.patch b/debian/patches/0011-arm64-hide-symbols-for-stricter-binutils.patch
new file mode 100644
index 0000000..2042700
--- /dev/null
+++ b/debian/patches/0011-arm64-hide-symbols-for-stricter-binutils.patch
@@ -0,0 +1,52 @@
+Description: Mark certain symbols as .hidden in arm64 codegen
+ binutils 2.29 arm64 linker is more strict about when to perform pc-relative
+ relocations for global symbols. Specifically, they must be marked as .hidden.
+ ocaml arm64 codegen does not do this, so tests/lib-dynlink-native/ fails as
+ some symbols were not relocated. This patch fixes that by marking (hopefully)
+ the appropriate symbols as .hidden.
+Author: Jiong Wang <jiong.wang at foss.arm.com>
+Bug: https://caml.inria.fr/mantis/view.php?id=7585
+--- a/asmcomp/arm64/emit.mlp
++++ b/asmcomp/arm64/emit.mlp
+@@ -324,6 +324,7 @@
+ 
+ let emit_load_symbol_addr dst s =
+   if (not !Clflags.dlcode) || Compilenv.symbol_in_current_unit s then begin
++    `	.hidden	{emit_symbol s}\n`;
+     `	adrp	{emit_reg dst}, {emit_symbol s}\n`;
+     `	add	{emit_reg dst}, {emit_reg dst}, #:lo12:{emit_symbol s}\n`
+   end else begin
+@@ -575,6 +576,7 @@
+           `	fmov	{emit_reg i.res.(0)}, #{emit_printf "0x%Lx" f}\n`
+         else begin
+           let lbl = float_literal f in
++          `	.hidden	{emit_label lbl}\n`;
+           `	adrp	{emit_reg reg_tmp1}, {emit_label lbl}\n`;
+           `	ldr	{emit_reg i.res.(0)}, [{emit_reg reg_tmp1}, #:lo12:{emit_label lbl}]\n`
+         end
+@@ -609,6 +611,7 @@
+           match addr with
+           | Iindexed _ -> i.arg.(0)
+           | Ibased(s, ofs) ->
++              `	.hidden	{emit_symbol s}\n`;
+               `	adrp	{emit_reg reg_tmp1}, {emit_symbol_offset s ofs}\n`;
+               reg_tmp1 in
+         begin match size with
+@@ -636,6 +639,7 @@
+           match addr with
+           | Iindexed _ -> i.arg.(1)
+           | Ibased(s, ofs) ->
++              `	.hidden	{emit_symbol s}\n`;
+               `	adrp	{emit_reg reg_tmp1}, {emit_symbol_offset s ofs}\n`;
+               reg_tmp1 in
+         begin match size with
+--- a/asmcomp/compilenv.ml
++++ b/asmcomp/compilenv.ml
+@@ -161,7 +161,6 @@
+ 
+ let symbol_in_current_unit name =
+   let prefix = "caml" ^ current_unit.ui_symbol in
+-  name = prefix ||
+   (let lp = String.length prefix in
+    String.length name >= 2 + lp
+    && String.sub name 0 lp = prefix
diff --git a/debian/patches/series b/debian/patches/series
index e7e7926..7f29c03 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@
 0006-Embed-bytecode-in-C-object-when-using-custom.patch
 0008-Native-backtraces-don-t-work-on-powerpc-and-sparc.patch
 0010-arm-default-PIC.patch
+0011-arm64-hide-symbols-for-stricter-binutils.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/ocaml.git



More information about the Pkg-ocaml-maint-commits mailing list