Include interim fix for aarch64/binutils relocation problems.
This commit is contained in:
parent
59545eed91
commit
5ea3c98449
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,7 +2,5 @@
|
|||||||
/clog
|
/clog
|
||||||
/ocaml-*.tar.bz2
|
/ocaml-*.tar.bz2
|
||||||
/ocaml-*.tar.gz
|
/ocaml-*.tar.gz
|
||||||
|
/ocaml-*.tar.xz
|
||||||
/ocaml-*-refman.pdf
|
/ocaml-*-refman.pdf
|
||||||
/4.04.0+beta2.tar.gz
|
|
||||||
/ocaml-4.04.1.tar.xz
|
|
||||||
/ocaml-4.04.2.tar.xz
|
|
||||||
|
@ -32,5 +32,5 @@ index cc59f635e..10642f19d 100644
|
|||||||
|
|
||||||
OCaml 4.04.2 (23 Jun 2017):
|
OCaml 4.04.2 (23 Jun 2017):
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
@ -40,5 +40,5 @@ index c3f8692a8..75a785f74 100644
|
|||||||
|
|
||||||
let setcnt = ref 0 in
|
let setcnt = ref 0 in
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
@ -405,5 +405,5 @@ index 000000000..6e374c16e
|
|||||||
+0
|
+0
|
||||||
+All tests succeeded.
|
+All tests succeeded.
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
@ -25,5 +25,5 @@ index 9a8cf652b..269aa18e6 100644
|
|||||||
sed -n -e 's/^#ml //p' ../config/Makefile) \
|
sed -n -e 's/^#ml //p' ../config/Makefile) \
|
||||||
> ocamlmklibconfig.ml
|
> ocamlmklibconfig.ml
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
@ -236,5 +236,5 @@ index 000000000..e28800f31
|
|||||||
+ header.units
|
+ header.units
|
||||||
+ end
|
+ end
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
@ -23,5 +23,5 @@ index e79659954..786f4cdbe 100755
|
|||||||
|
|
||||||
cclibs="$cclibs $mathlib"
|
cclibs="$cclibs $mathlib"
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
@ -31,5 +31,5 @@ index b79252d6b..8335398b2 100755
|
|||||||
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
|
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
|
||||||
exit ;;
|
exit ;;
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
@ -1713,5 +1713,5 @@ index 786f4cdbe..b88dab26b 100755
|
|||||||
case "$ccfamily" in
|
case "$ccfamily" in
|
||||||
clang-*)
|
clang-*)
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
@ -39,5 +39,5 @@ index 60ec5cb4e..ad2b26e9b 100644
|
|||||||
|
|
||||||
method! select_condition = function
|
method! select_condition = function
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
@ -152,5 +152,5 @@ index ad2b26e9b..283233679 100644
|
|||||||
method select_addressing _ = function
|
method select_addressing _ = function
|
||||||
| Cop(Cadda, [arg; Cconst_int n]) when self#is_immediate n ->
|
| Cop(Cadda, [arg; Cconst_int n]) when self#is_immediate n ->
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
@ -127,5 +127,5 @@ index 97c49ce80..6cc190864 100644
|
|||||||
emit_all fundecl.fun_body;
|
emit_all fundecl.fun_body;
|
||||||
List.iter emit_call_gc !call_gc_sites;
|
List.iter emit_call_gc !call_gc_sites;
|
||||||
--
|
--
|
||||||
2.13.1
|
2.14.0
|
||||||
|
|
||||||
|
172
0012-arm64-Emit-hidden-alias-for-each-global-symbol.patch
Normal file
172
0012-arm64-Emit-hidden-alias-for-each-global-symbol.patch
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
From e7fdaf008e047c445fd7a6acf9362d8b5940bf4b Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||||
|
Date: Tue, 5 Sep 2017 16:28:56 +0100
|
||||||
|
Subject: [PATCH 12/12] arm64: Emit hidden alias for each global symbol.
|
||||||
|
|
||||||
|
MPR#7585
|
||||||
|
PR#1268
|
||||||
|
|
||||||
|
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 emitting a hidden alias for each global
|
||||||
|
symbol and using the hidden alias in (non-GOT) adrp instructions.
|
||||||
|
|
||||||
|
The aliases appear in the asm output as:
|
||||||
|
|
||||||
|
.L1234:
|
||||||
|
.hidden .L1234$hidden
|
||||||
|
.set .L1234$hidden,.L1234
|
||||||
|
|
||||||
|
camlFoo__bar:
|
||||||
|
.hidden camlFoo__bar$hidden
|
||||||
|
.set camlFoo__bar$hidden,camlFoo__bar
|
||||||
|
---
|
||||||
|
asmcomp/arm64/emit.mlp | 52 ++++++++++++++++++++++++++++++++++++--------------
|
||||||
|
1 file changed, 38 insertions(+), 14 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/asmcomp/arm64/emit.mlp b/asmcomp/arm64/emit.mlp
|
||||||
|
index f75646e12..01f5dddef 100644
|
||||||
|
--- a/asmcomp/arm64/emit.mlp
|
||||||
|
+++ b/asmcomp/arm64/emit.mlp
|
||||||
|
@@ -49,6 +49,16 @@ let emit_label lbl =
|
||||||
|
let emit_symbol s =
|
||||||
|
Emitaux.emit_symbol '$' s
|
||||||
|
|
||||||
|
+(* Every global label and symbol has a hidden equivalent (alias).
|
||||||
|
+ * See: https://github.com/ocaml/ocaml/pull/1268
|
||||||
|
+ *)
|
||||||
|
+
|
||||||
|
+let emit_label_hidden lbl =
|
||||||
|
+ emit_string ".L"; emit_int lbl; emit_string "$hidden"
|
||||||
|
+
|
||||||
|
+let emit_symbol_hidden s =
|
||||||
|
+ Emitaux.emit_symbol '$' s; emit_string "$hidden"
|
||||||
|
+
|
||||||
|
(* Output a pseudo-register *)
|
||||||
|
|
||||||
|
let emit_reg = function
|
||||||
|
@@ -103,8 +113,8 @@ let emit_stack r =
|
||||||
|
|
||||||
|
(* Output an addressing mode *)
|
||||||
|
|
||||||
|
-let emit_symbol_offset s ofs =
|
||||||
|
- emit_symbol s;
|
||||||
|
+let emit_symbol_hidden_offset s ofs =
|
||||||
|
+ emit_symbol_hidden s;
|
||||||
|
if ofs > 0 then `+{emit_int ofs}`
|
||||||
|
else if ofs < 0 then `-{emit_int (-ofs)}`
|
||||||
|
else ()
|
||||||
|
@@ -114,7 +124,7 @@ let emit_addressing addr r =
|
||||||
|
| Iindexed ofs ->
|
||||||
|
`[{emit_reg r}, #{emit_int ofs}]`
|
||||||
|
| Ibased(s, ofs) ->
|
||||||
|
- `[{emit_reg r}, #:lo12:{emit_symbol_offset s ofs}]`
|
||||||
|
+ `[{emit_reg r}, #:lo12:{emit_symbol_hidden_offset s ofs}]`
|
||||||
|
|
||||||
|
(* Record live pointers at call points *)
|
||||||
|
|
||||||
|
@@ -315,7 +325,10 @@ let emit_literals() =
|
||||||
|
` .align 3\n`;
|
||||||
|
List.iter
|
||||||
|
(fun (f, lbl) ->
|
||||||
|
- `{emit_label lbl}:`; emit_float64_directive ".quad" f)
|
||||||
|
+ `{emit_label lbl}:\n`;
|
||||||
|
+ ` .hidden {emit_label_hidden lbl}\n`;
|
||||||
|
+ ` .set {emit_label_hidden lbl},{emit_label lbl}\n`;
|
||||||
|
+ ` `; emit_float64_directive ".quad" f)
|
||||||
|
!float_literals;
|
||||||
|
float_literals := []
|
||||||
|
end
|
||||||
|
@@ -323,9 +336,10 @@ let emit_literals() =
|
||||||
|
(* 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
|
||||||
|
- ` adrp {emit_reg dst}, {emit_symbol s}\n`;
|
||||||
|
- ` add {emit_reg dst}, {emit_reg dst}, #:lo12:{emit_symbol s}\n`
|
||||||
|
+ if (not !Clflags.dlcode || Compilenv.symbol_in_current_unit s) &&
|
||||||
|
+ not !Clflags.make_package (* not using -pack *) then begin
|
||||||
|
+ ` adrp {emit_reg dst}, {emit_symbol_hidden s}\n`;
|
||||||
|
+ ` add {emit_reg dst}, {emit_reg dst}, #:lo12:{emit_symbol_hidden s}\n`
|
||||||
|
end else begin
|
||||||
|
` adrp {emit_reg dst}, :got:{emit_symbol s}\n`;
|
||||||
|
` ldr {emit_reg dst}, [{emit_reg dst}, #:got_lo12:{emit_symbol s}]\n`
|
||||||
|
@@ -575,8 +589,8 @@ let emit_instr i =
|
||||||
|
` fmov {emit_reg i.res.(0)}, #{emit_printf "0x%Lx" f}\n`
|
||||||
|
else begin
|
||||||
|
let lbl = float_literal f in
|
||||||
|
- ` adrp {emit_reg reg_tmp1}, {emit_label lbl}\n`;
|
||||||
|
- ` ldr {emit_reg i.res.(0)}, [{emit_reg reg_tmp1}, #:lo12:{emit_label lbl}]\n`
|
||||||
|
+ ` adrp {emit_reg reg_tmp1}, {emit_label_hidden lbl}\n`;
|
||||||
|
+ ` ldr {emit_reg i.res.(0)}, [{emit_reg reg_tmp1}, #:lo12:{emit_label_hidden lbl}]\n`
|
||||||
|
end
|
||||||
|
| Lop(Iconst_symbol s) ->
|
||||||
|
emit_load_symbol_addr i.res.(0) s
|
||||||
|
@@ -609,7 +623,7 @@ let emit_instr i =
|
||||||
|
match addr with
|
||||||
|
| Iindexed _ -> i.arg.(0)
|
||||||
|
| Ibased(s, ofs) ->
|
||||||
|
- ` adrp {emit_reg reg_tmp1}, {emit_symbol_offset s ofs}\n`;
|
||||||
|
+ ` adrp {emit_reg reg_tmp1}, {emit_symbol_hidden_offset s ofs}\n`;
|
||||||
|
reg_tmp1 in
|
||||||
|
begin match size with
|
||||||
|
| Byte_unsigned ->
|
||||||
|
@@ -636,7 +650,7 @@ let emit_instr i =
|
||||||
|
match addr with
|
||||||
|
| Iindexed _ -> i.arg.(1)
|
||||||
|
| Ibased(s, ofs) ->
|
||||||
|
- ` adrp {emit_reg reg_tmp1}, {emit_symbol_offset s ofs}\n`;
|
||||||
|
+ ` adrp {emit_reg reg_tmp1}, {emit_symbol_hidden_offset s ofs}\n`;
|
||||||
|
reg_tmp1 in
|
||||||
|
begin match size with
|
||||||
|
| Byte_unsigned | Byte_signed ->
|
||||||
|
@@ -763,7 +777,9 @@ let emit_instr i =
|
||||||
|
| Lreturn ->
|
||||||
|
output_epilogue (fun () -> ` ret\n`)
|
||||||
|
| Llabel lbl ->
|
||||||
|
- `{emit_label lbl}:\n`
|
||||||
|
+ `{emit_label lbl}:\n`;
|
||||||
|
+ ` .hidden {emit_label_hidden lbl}\n`;
|
||||||
|
+ ` .set {emit_label_hidden lbl},{emit_label lbl}\n`
|
||||||
|
| Lbranch lbl ->
|
||||||
|
` b {emit_label lbl}\n`
|
||||||
|
| Lcondbranch(tst, lbl) ->
|
||||||
|
@@ -891,6 +907,8 @@ let fundecl fundecl =
|
||||||
|
` .globl {emit_symbol fundecl.fun_name}\n`;
|
||||||
|
` .type {emit_symbol fundecl.fun_name}, %function\n`;
|
||||||
|
`{emit_symbol fundecl.fun_name}:\n`;
|
||||||
|
+ ` .hidden {emit_symbol_hidden fundecl.fun_name}\n`;
|
||||||
|
+ ` .set {emit_symbol_hidden fundecl.fun_name},{emit_symbol fundecl.fun_name}\n`;
|
||||||
|
emit_debug_info fundecl.fun_dbg;
|
||||||
|
cfi_startproc();
|
||||||
|
if !Clflags.gprofile then emit_profile();
|
||||||
|
@@ -924,7 +942,10 @@ let fundecl fundecl =
|
||||||
|
|
||||||
|
let emit_item = function
|
||||||
|
| Cglobal_symbol s -> ` .globl {emit_symbol s}\n`;
|
||||||
|
- | Cdefine_symbol s -> `{emit_symbol s}:\n`
|
||||||
|
+ | Cdefine_symbol s ->
|
||||||
|
+ `{emit_symbol s}:\n`;
|
||||||
|
+ ` .hidden {emit_symbol_hidden s}\n`;
|
||||||
|
+ ` .set {emit_symbol_hidden s},{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`
|
||||||
|
@@ -981,7 +1002,10 @@ let end_assembly () =
|
||||||
|
efa_align = (fun n -> ` .align {emit_int(Misc.log2 n)}\n`);
|
||||||
|
efa_label_rel = (fun lbl ofs ->
|
||||||
|
` .long {emit_label lbl} - . + {emit_int32 ofs}\n`);
|
||||||
|
- efa_def_label = (fun lbl -> `{emit_label lbl}:\n`);
|
||||||
|
+ efa_def_label = (fun lbl ->
|
||||||
|
+ `{emit_label lbl}:\n`;
|
||||||
|
+ ` .hidden {emit_label_hidden lbl}\n`;
|
||||||
|
+ ` .set {emit_label_hidden lbl},{emit_label lbl}\n`);
|
||||||
|
efa_string = (fun s -> emit_string_directive " .asciz " s) };
|
||||||
|
` .type {emit_symbol lbl}, %object\n`;
|
||||||
|
` .size {emit_symbol lbl}, .-{emit_symbol lbl}\n`;
|
||||||
|
--
|
||||||
|
2.14.0
|
||||||
|
|
11
ocaml.spec
11
ocaml.spec
@ -20,14 +20,16 @@
|
|||||||
%global test_arches aarch64 %{power64} x86_64
|
%global test_arches aarch64 %{power64} x86_64
|
||||||
# These are the architectures for which the tests must pass otherwise
|
# These are the architectures for which the tests must pass otherwise
|
||||||
# the build will fail.
|
# the build will fail.
|
||||||
%global test_arches_required aarch64 %{power64} x86_64
|
# aarch64 tests are broken by the interim patch
|
||||||
|
# 0012-arm64-Emit-hidden-alias-for-each-global-symbol.patch
|
||||||
|
%global test_arches_required %{power64} x86_64
|
||||||
|
|
||||||
# Architectures where parallel builds fail.
|
# Architectures where parallel builds fail.
|
||||||
#%global no_parallel_build_arches aarch64
|
#%global no_parallel_build_arches aarch64
|
||||||
|
|
||||||
Name: ocaml
|
Name: ocaml
|
||||||
Version: 4.05.0
|
Version: 4.05.0
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
|
|
||||||
Summary: OCaml compiler and programming environment
|
Summary: OCaml compiler and programming environment
|
||||||
|
|
||||||
@ -79,7 +81,7 @@ Patch0011: 0011-Another-immediate-range-fix.patch
|
|||||||
# https://caml.inria.fr/mantis/view.php?id=7585
|
# https://caml.inria.fr/mantis/view.php?id=7585
|
||||||
# This patch is from https://github.com/ocaml/ocaml/pull/1268
|
# This patch is from https://github.com/ocaml/ocaml/pull/1268
|
||||||
# where at time of writing it is not upstream.
|
# where at time of writing it is not upstream.
|
||||||
Patch0012: 0012-Mark-certain-symbols-as-.hidden-in-arm64-codegen-pos.patch
|
Patch0012: 0012-arm64-Emit-hidden-alias-for-each-global-symbol.patch
|
||||||
|
|
||||||
BuildRequires: binutils-devel
|
BuildRequires: binutils-devel
|
||||||
BuildRequires: ncurses-devel
|
BuildRequires: ncurses-devel
|
||||||
@ -469,6 +471,9 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Sep 06 2017 Richard W.M. Jones <rjones@redhat.com> - 4.05.0-3
|
||||||
|
- Include interim fix for aarch64/binutils relocation problems.
|
||||||
|
|
||||||
* Sat Aug 05 2017 Richard W.M. Jones <rjones@redhat.com> - 4.05.0-2
|
* Sat Aug 05 2017 Richard W.M. Jones <rjones@redhat.com> - 4.05.0-2
|
||||||
- New upstream version 4.05.0.
|
- New upstream version 4.05.0.
|
||||||
- Disable parallel builds for now.
|
- Disable parallel builds for now.
|
||||||
|
Loading…
Reference in New Issue
Block a user