summaryrefslogtreecommitdiffstats
path: root/recipes-qt/qt5/qt5-creator/0001-Fix-Allow-qt-creator-to-build-on-arm-aarch32-and-aar.patch
blob: 3ed8bc4587b000d4aa3a0f39d0728795cf20204b (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
From 748174788b318c6316e6d41ce323306120223e02 Mon Sep 17 00:00:00 2001
From: Greg Nietsky <gregory@distrotech.co.za>
Date: Tue, 4 Mar 2014 11:33:40 +0200
Subject: [PATCH 1/2] Fix: Allow qt-creator to build on arm aarch32 and aarch64

Botan is imported hardwired for x86 this small patch allows it
too operate on arm other platforms could be added.

Task-number: QTCREATORBUG-8107
Change-Id: Iddea28f21c9fa1afd2fdd5d16a44e6c96a516a7a
---
 src/libs/3rdparty/botan/botan.cpp | 16 +++++++++++++++-
 src/libs/3rdparty/botan/botan.h   |  2 ++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/libs/3rdparty/botan/botan.cpp b/src/libs/3rdparty/botan/botan.cpp
index b7a9ddf..c5b9826 100644
--- a/src/libs/3rdparty/botan/botan.cpp
+++ b/src/libs/3rdparty/botan/botan.cpp
@@ -1101,6 +1101,8 @@ class Montgomery_Exponentiator : public Modular_Exponentiator
 
 #if (BOTAN_MP_WORD_BITS != 32)
    #error The mp_x86_32 module requires that BOTAN_MP_WORD_BITS == 32
+#elif !defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
+typedef Botan::u64bit dword;
 #endif
 
 #ifdef Q_OS_UNIX
@@ -1118,6 +1120,7 @@ extern "C" {
 */
 inline word word_madd2(word a, word b, word* c)
    {
+#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
    asm(
       ASM("mull %[b]")
       ASM("addl %[c],%[a]")
@@ -1127,6 +1130,11 @@ inline word word_madd2(word a, word b, word* c)
       : "0"(a), "1"(b), [c]"g"(*c) : "cc");
 
    return a;
+#else
+   dword z = (dword)a * b + *c;
+   *c = (word)(z >> BOTAN_MP_WORD_BITS);
+   return (word)z;
+#endif
    }
 
 /*
@@ -1134,6 +1142,7 @@ inline word word_madd2(word a, word b, word* c)
 */
 inline word word_madd3(word a, word b, word c, word* d)
    {
+#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
    asm(
       ASM("mull %[b]")
 
@@ -1147,6 +1156,11 @@ inline word word_madd3(word a, word b, word c, word* d)
       : "0"(a), "1"(b), [c]"g"(c), [d]"g"(*d) : "cc");
 
    return a;
+#else
+   dword z = (dword)a * b + c + *d;
+   *d = (word)(z >> BOTAN_MP_WORD_BITS);
+   return (word)z;
+#endif
    }
 
 }
@@ -2315,7 +2329,7 @@ namespace Botan {
 
 extern "C" {
 
-#ifdef Q_OS_UNIX
+#if defined(Q_OS_UNIX) && defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
 /*
 * Helper Macros for x86 Assembly
 */
diff --git a/src/libs/3rdparty/botan/botan.h b/src/libs/3rdparty/botan/botan.h
index 2981d2c..1c8d828 100644
--- a/src/libs/3rdparty/botan/botan.h
+++ b/src/libs/3rdparty/botan/botan.h
@@ -82,7 +82,9 @@
 #endif
 
 #define BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN
+#if !defined(__arm__) && !defined(__aarch64__)
 #define BOTAN_TARGET_CPU_IS_X86_FAMILY
+#endif
 #define BOTAN_TARGET_UNALIGNED_MEMORY_ACCESS_OK 1
 
 #if defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN) || \
-- 
1.8.3.1