0001-Complete-support-for-MIPS-n32-ABI.patch
2.79 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
From 7f28cd1f88145a701e5dbbf50558bb65fce79f61 Mon Sep 17 00:00:00 2001
From: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Date: Thu, 14 Jul 2016 17:20:51 +0100
Subject: [PATCH] Complete support for MIPS n32 ABI
Pull request: https://github.com/xianyi/OpenBLAS/pull/926
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
Makefile.system | 27 +++++++++------------------
c_check | 9 +++++++--
f_check | 7 ++++++-
3 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/Makefile.system b/Makefile.system
index 24a7a64..bbcdb82 100644
--- a/Makefile.system
+++ b/Makefile.system
@@ -502,13 +502,16 @@ endif
ifdef NO_BINARY_MODE
-ifeq ($(ARCH), $(filter $(ARCH),mips64 mips))
+ifeq ($(ARCH), $(filter $(ARCH),mips64))
ifdef BINARY64
CCOMMON_OPT += -mabi=64
else
-CCOMMON_OPT += -mabi=32
+CCOMMON_OPT += -mabi=n32
endif
BINARY_DEFINED = 1
+else ifeq ($(ARCH), $(filter $(ARCH),mips))
+CCOMMON_OPT += -mabi=32
+BINARY_DEFINED = 1
endif
ifeq ($(CORE), LOONGSON3A)
@@ -599,12 +602,14 @@ ifneq ($(NO_LAPACK), 1)
EXTRALIB += -lgfortran
endif
ifdef NO_BINARY_MODE
-ifeq ($(ARCH), $(filter $(ARCH),mips64 mips))
+ifeq ($(ARCH), $(filter $(ARCH),mips64))
ifdef BINARY64
FCOMMON_OPT += -mabi=64
else
-FCOMMON_OPT += -mabi=32
+FCOMMON_OPT += -mabi=n32
endif
+else ifeq ($(ARCH), $(filter $(ARCH),mips))
+FCOMMON_OPT += -mabi=32
endif
else
ifdef BINARY64
@@ -688,20 +693,6 @@ endif
endif
endif
-ifeq ($(filter $(ARCH),mips64 mips))
-ifndef BINARY64
-FCOMMON_OPT += -m32
-else
-FCOMMON_OPT += -m64
-endif
-else
-ifdef BINARY64
-FCOMMON_OPT += -mabi=64
-else
-FCOMMON_OPT += -mabi=32
-endif
-endif
-
ifeq ($(USE_OPENMP), 1)
FCOMMON_OPT += -mp
endif
diff --git a/c_check b/c_check
index 50ff360..9f457df 100644
--- a/c_check
+++ b/c_check
@@ -79,8 +79,13 @@ if ($os eq "AIX") {
$defined = 1;
}
-if (($architecture eq "mips") || ($architecture eq "mips64")) {
- $compiler_name .= " -mabi=32" if ($binary eq "32");
+if ($architecture eq "mips") {
+ $compiler_name .= " -mabi=32";
+ $defined = 1;
+}
+
+if ($architecture eq "mips64") {
+ $compiler_name .= " -mabi=n32" if ($binary eq "32");
$compiler_name .= " -mabi=64" if ($binary eq "64");
$defined = 1;
}
diff --git a/f_check b/f_check
index 4c03ac7..3520e8b 100644
--- a/f_check
+++ b/f_check
@@ -223,7 +223,12 @@ if (!$?) {
}
#For gfortran MIPS
if ($?) {
- $link = `$compiler $openmp -mabi=32 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
+ $mips_data = `$compiler_bin -E -dM - < /dev/null`;
+ if ($mips_data =~ /_MIPS_ISA_MIPS64/) {
+ $link = `$compiler $openmp -mabi=n32 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
+ } else {
+ $link = `$compiler $openmp -mabi=32 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
+ }
}
$binary = "" if ($?);
}
--
2.7.3