aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ocaml-dtoa/bignum_align-noinline.patch
blob: 1968f253d7a51ae6a4bdd0088894d67aae321cca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From: Mike Sullivan <mksully22@gmail.com>
Date: Mon, 9 Jul 2018 16:17:10 +0000
Subject: [PATCH] Avoid flow link error on ppc64 by eliminating bignum_align inlining

The libtoa_stubs.a library created when building ocaml-dtoa on ppc64le
contains the bignum_align.part.4 section created by the compiler
optimizing the bignum_align(). This causes the linking against the
library on ppc64le to report errors like we see when building the
flow package. For example:

    /usr/lib/gcc/powerpc64le-alpine-linux-musl/6.4.0/../../../../powerpc64le-alpine-linux-musl/bin/ld: /usr/lib/ocaml/lwt/liblwt_unix_stubs.a(unix_lseek_job.o): In function `result_lseek':
        /home/buildozer/aports/testing/ocaml-lwt/src/lwt-3.2.1/_build/default/src/unix/unix_lseek_job.c:113:(.text+0xb8): call to `result_lseek.part.0' lacks nop, can't restore toc; (-mcmodel=small toc adjust stub)
        /usr/lib/gcc/powerpc64le-alpine-linux-musl/6.4.0/../../../../powerpc64le-alpine-linux-musl/bin/ld: /usr/lib/ocaml/lwt/liblwt_unix_stubs.a(unix_lseek_job.o): In function `result_lseek_64':
        /home/buildozer/aports/testing/ocaml-lwt/src/lwt-3.2.1/_build/default/src/unix/unix_lseek_job.c:134:(.text+0x134): call to `result_lseek_64.part.1' lacks nop, can't restore toc; (-mcmodel=small toc adjust stub)

--- a/src/bignum.c	2018-07-09 14:12:25.025413017 +0000
+++ b/src/bignum.c	2018-07-09 14:13:23.210604404 +0000
@@ -86,7 +86,7 @@
 }
 
 
-void bignum_align(bignum* num, bignum other) {
+__attribute__((noinline)) void bignum_align(bignum* num, bignum other) {
   if (num->exponent > other.exponent) {
     // If "X" represents a "hidden" digit (by the exponent) then we are in the
     // following case (a == this, b == other):