summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre McCurdy <armccurdy@gmail.com>2017-08-25 17:50:16 -0700
committerRoss Burton <ross.burton@intel.com>2017-08-29 17:18:50 +0100
commitd8668018d5d795be2297f878fd871a27edf532bf (patch)
tree4159d618bb4414f4264d0b70b70a86e81bdd8149
parent4fb2d4122fb2b62b60095fe676ea47ce7536af9a (diff)
downloadmeta-gplv2-d8668018d5d795be2297f878fd871a27edf532bf.tar.gz
gmp_4.2.1: prevent calls to mpn_add_nc() if HAVE_NATIVE_mpn_sub_nc is false
When building for aarch64 (ie relying only on generic C code rather than asm) libgmp.so contains undefined references to __gmpn_add_nc and __gmpn_sub_nc which causes attempts to link with -lgmp to fail: | .../usr/lib/libgmp.so: undefined reference to `__gmpn_sub_nc' | .../usr/lib/libgmp.so: undefined reference to `__gmpn_add_nc' Solution based on a historical patch posted to the gmp mailing list: https://gmplib.org/list-archives/gmp-discuss/2006-May/002344.html Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--recipes-support/gmp/gmp-4.2.1/prevent-calls-to-mpn_add_nc-if-HAVE_NATIVE_mpn_sub_n.patch78
-rw-r--r--recipes-support/gmp/gmp_4.2.1.bb1
2 files changed, 79 insertions, 0 deletions
diff --git a/recipes-support/gmp/gmp-4.2.1/prevent-calls-to-mpn_add_nc-if-HAVE_NATIVE_mpn_sub_n.patch b/recipes-support/gmp/gmp-4.2.1/prevent-calls-to-mpn_add_nc-if-HAVE_NATIVE_mpn_sub_n.patch
new file mode 100644
index 0000000..7b879c3
--- /dev/null
+++ b/recipes-support/gmp/gmp-4.2.1/prevent-calls-to-mpn_add_nc-if-HAVE_NATIVE_mpn_sub_n.patch
@@ -0,0 +1,78 @@
1From d4f3542fabe0797cf2d60afd957585862bd9a29b Mon Sep 17 00:00:00 2001
2From: Andre McCurdy <armccurdy@gmail.com>
3Date: Fri, 25 Aug 2017 16:16:06 -0700
4Subject: [PATCH] prevent calls to mpn_add_nc() if HAVE_NATIVE_mpn_sub_nc is false
5
6When building for aarch64 (ie relying only on generic C code rather
7than asm) libgmp.so contains undefined references to __gmpn_add_nc
8and __gmpn_sub_nc which causes attempts to link with -lgmp to fail:
9
10 | .../usr/lib/libgmp.so: undefined reference to `__gmpn_sub_nc'
11 | .../usr/lib/libgmp.so: undefined reference to `__gmpn_add_nc'
12
13Solution based on a historical patch posted to the gmp mailing list:
14
15 https://gmplib.org/list-archives/gmp-discuss/2006-May/002344.html
16
17Upstream-Status: Inappropriate [Fixed in current versions]
18
19Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
20---
21 mpn/generic/addsub_n.c | 12 ++++++------
22 1 file changed, 6 insertions(+), 6 deletions(-)
23
24diff --git a/mpn/generic/addsub_n.c b/mpn/generic/addsub_n.c
25index 27b2c08..0ff7ca0 100644
26--- a/mpn/generic/addsub_n.c
27+++ b/mpn/generic/addsub_n.c
28@@ -58,13 +58,13 @@ mpn_addsub_n (mp_ptr r1p, mp_ptr r2p, mp_srcptr s1p, mp_srcptr s2p, mp_size_t n)
29 for (off = 0; off < n; off += PART_SIZE)
30 {
31 this_n = MIN (n - off, PART_SIZE);
32-#if HAVE_NATIVE_mpn_add_nc || !HAVE_NATIVE_mpn_add_n
33+#if HAVE_NATIVE_mpn_add_nc
34 acyo = mpn_add_nc (r1p + off, s1p + off, s2p + off, this_n, acyo);
35 #else
36 acyn = mpn_add_n (r1p + off, s1p + off, s2p + off, this_n);
37 acyo = acyn + mpn_add_1 (r1p + off, r1p + off, this_n, acyo);
38 #endif
39-#if HAVE_NATIVE_mpn_sub_nc || !HAVE_NATIVE_mpn_sub_n
40+#if HAVE_NATIVE_mpn_sub_nc
41 scyo = mpn_sub_nc (r2p + off, s1p + off, s2p + off, this_n, scyo);
42 #else
43 scyn = mpn_sub_n (r2p + off, s1p + off, s2p + off, this_n);
44@@ -81,13 +81,13 @@ mpn_addsub_n (mp_ptr r1p, mp_ptr r2p, mp_srcptr s1p, mp_srcptr s2p, mp_size_t n)
45 for (off = 0; off < n; off += PART_SIZE)
46 {
47 this_n = MIN (n - off, PART_SIZE);
48-#if HAVE_NATIVE_mpn_sub_nc || !HAVE_NATIVE_mpn_sub_n
49+#if HAVE_NATIVE_mpn_sub_nc
50 scyo = mpn_sub_nc (r2p + off, s1p + off, s2p + off, this_n, scyo);
51 #else
52 scyn = mpn_sub_n (r2p + off, s1p + off, s2p + off, this_n);
53 scyo = scyn + mpn_sub_1 (r2p + off, r2p + off, this_n, scyo);
54 #endif
55-#if HAVE_NATIVE_mpn_add_nc || !HAVE_NATIVE_mpn_add_n
56+#if HAVE_NATIVE_mpn_add_nc
57 acyo = mpn_add_nc (r1p + off, s1p + off, s2p + off, this_n, acyo);
58 #else
59 acyn = mpn_add_n (r1p + off, s1p + off, s2p + off, this_n);
60@@ -105,13 +105,13 @@ mpn_addsub_n (mp_ptr r1p, mp_ptr r2p, mp_srcptr s1p, mp_srcptr s2p, mp_size_t n)
61 for (off = 0; off < n; off += PART_SIZE)
62 {
63 this_n = MIN (n - off, PART_SIZE);
64-#if HAVE_NATIVE_mpn_add_nc || !HAVE_NATIVE_mpn_add_n
65+#if HAVE_NATIVE_mpn_add_nc
66 acyo = mpn_add_nc (tp, s1p + off, s2p + off, this_n, acyo);
67 #else
68 acyn = mpn_add_n (tp, s1p + off, s2p + off, this_n);
69 acyo = acyn + mpn_add_1 (tp, tp, this_n, acyo);
70 #endif
71-#if HAVE_NATIVE_mpn_sub_nc || !HAVE_NATIVE_mpn_sub_n
72+#if HAVE_NATIVE_mpn_sub_nc
73 scyo = mpn_sub_nc (r2p + off, s1p + off, s2p + off, this_n, scyo);
74 #else
75 scyn = mpn_sub_n (r2p + off, s1p + off, s2p + off, this_n);
76--
771.9.1
78
diff --git a/recipes-support/gmp/gmp_4.2.1.bb b/recipes-support/gmp/gmp_4.2.1.bb
index 5e8ee29..029e728 100644
--- a/recipes-support/gmp/gmp_4.2.1.bb
+++ b/recipes-support/gmp/gmp_4.2.1.bb
@@ -11,6 +11,7 @@ SRC_URI = "https://gmplib.org/download/${BPN}/archive/${BP}.tar.bz2 \
11 file://Use-__gnu_inline__-attribute.patch \ 11 file://Use-__gnu_inline__-attribute.patch \
12 file://gmp_fix_for_automake-1.12.patch \ 12 file://gmp_fix_for_automake-1.12.patch \
13 file://avoid-h-asm-constraint-for-MIPS.patch \ 13 file://avoid-h-asm-constraint-for-MIPS.patch \
14 file://prevent-calls-to-mpn_add_nc-if-HAVE_NATIVE_mpn_sub_n.patch \
14" 15"
15 16
16SRC_URI[md5sum] = "091c56e0e1cca6b09b17b69d47ef18e3" 17SRC_URI[md5sum] = "091c56e0e1cca6b09b17b69d47ef18e3"