[Pkg-ocaml-maint-commits] [ocaml] 01/02: Replace arm64 patch with one applied upstream
Ximin Luo
infinity0 at debian.org
Thu Sep 14 10:03:37 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 bf0cf3c0a1cd82c20be77d3724b7f0dc50950ef7
Author: Ximin Luo <infinity0 at debian.org>
Date: Thu Sep 14 12:01:59 2017 +0200
Replace arm64 patch with one applied upstream
---
...-arm64-hide-symbols-for-stricter-binutils.patch | 98 ++++++++++++++--------
1 file changed, 65 insertions(+), 33 deletions(-)
diff --git a/debian/patches/0011-arm64-hide-symbols-for-stricter-binutils.patch b/debian/patches/0011-arm64-hide-symbols-for-stricter-binutils.patch
index 2042700..ca703a2 100644
--- a/debian/patches/0011-arm64-hide-symbols-for-stricter-binutils.patch
+++ b/debian/patches/0011-arm64-hide-symbols-for-stricter-binutils.patch
@@ -1,52 +1,84 @@
-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
+commit 4274dfe22ae37c4c5589a6fe7fe9d53d62013df5
+Author: Mark Shinwell <mshinwell at gmail.com>
+Date: Wed Sep 13 10:23:16 2017 +0100
+
+ AArch64 GOT fixed
+
+--- a/Changes
++++ b/Changes
+@@ -135,6 +135,10 @@
+ (Hannes Mehnert, Guillaume Bury,
+ review by Daniel Bünzli, Gabriel Scherer, Damien Doligez)
+
++- GPR#1330: when generating dynamically-linkable code on AArch64, always
++ reference symbols (even locally-defined ones) through the GOT.
++ (Mark Shinwell, review by Xavier Leroy)
++
+ ### Standard library:
+
+ - MPR#6975, GPR#902: Truncate function added to stdlib Buffer module
--- a/asmcomp/arm64/emit.mlp
+++ b/asmcomp/arm64/emit.mlp
-@@ -324,6 +324,7 @@
+@@ -114,6 +114,7 @@
+ | Iindexed ofs ->
+ `[{emit_reg r}, #{emit_int ofs}]`
+ | Ibased(s, ofs) ->
++ assert (not !Clflags.dlcode); (* see selection.ml *)
+ `[{emit_reg r}, #:lo12:{emit_symbol_offset s ofs}]`
+
+ (* Record live pointers at call points *)
+@@ -323,7 +324,7 @@
+ (* Emit code to load the address of a symbol *)
let emit_load_symbol_addr dst s =
- if (not !Clflags.dlcode) || Compilenv.symbol_in_current_unit s then begin
-+ ` .hidden {emit_symbol s}\n`;
+- if (not !Clflags.dlcode) || Compilenv.symbol_in_current_unit s then begin
++ if not !Clflags.dlcode then begin
` 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 @@
+@@ -609,6 +610,7 @@
match addr with
| Iindexed _ -> i.arg.(0)
| Ibased(s, ofs) ->
-+ ` .hidden {emit_symbol s}\n`;
++ assert (not !Clflags.dlcode); (* see selection.ml *)
` adrp {emit_reg reg_tmp1}, {emit_symbol_offset s ofs}\n`;
reg_tmp1 in
begin match size with
-@@ -636,6 +639,7 @@
+@@ -636,6 +638,7 @@
match addr with
| Iindexed _ -> i.arg.(1)
| Ibased(s, ofs) ->
-+ ` .hidden {emit_symbol s}\n`;
++ assert (not !Clflags.dlcode);
` 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
+@@ -924,7 +927,15 @@
+
+ let emit_item = function
+ | Cglobal_symbol s -> ` .globl {emit_symbol s}\n`;
+- | Cdefine_symbol s -> `{emit_symbol s}:\n`
++ | Cdefine_symbol s ->
++ if !Clflags.dlcode then begin
++ (* GOT relocations against non-global symbols don't seem to work
++ properly: GOT entries are not created for the symbols and the
++ relocations evaluate to random other GOT entries. For the moment
++ force all symbols to be global. *)
++ ` .globl {emit_symbol s}\n`;
++ end;
++ `{emit_symbol s}:\n`
+ | Cint8 n -> ` .byte {emit_int n}\n`
+ | Cint16 n -> ` .short {emit_int n}\n`
+ | Cint32 n -> ` .long {emit_nativeint n}\n`
+--- a/asmcomp/arm64/selection.ml
++++ b/asmcomp/arm64/selection.ml
+@@ -82,8 +82,8 @@
+ [ "sqrt"; "caml_bswap16_direct"; "caml_int32_direct_bswap";
+ "caml_int64_direct_bswap"; "caml_nativeint_direct_bswap" ]
+
+-let use_direct_addressing symb =
+- (not !Clflags.dlcode) || Compilenv.symbol_in_current_unit symb
++let use_direct_addressing _symb =
++ not !Clflags.dlcode
+
+ (* Instruction selection *)
+
--
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