From: Ximin Luo Date: Sat, 29 Jul 2017 09:00:28 +0000 (+0200) Subject: Mark certain symbols as .hidden in arm64 codegen, fixing FTBFS with binutils 2.29 X-Git-Tag: archive/raspbian/4.08.1-4+rpi1~3^2~38 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e83a0d9e5232b1429eb2be79e16c11ee9b1a152e;p=ocaml.git Mark certain symbols as .hidden in arm64 codegen, fixing FTBFS with binutils 2.29 --- diff --git a/debian/changelog b/debian/changelog index 4437c7f9..2d88ebb6 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 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 00000000..20427000 --- /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 +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 e7e79267..7f29c033 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