summaryrefslogtreecommitdiffstats
path: root/recipes-core/openjdk/openjdk-6/shark-arm-linux-cpu-detection.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/openjdk/openjdk-6/shark-arm-linux-cpu-detection.patch')
-rw-r--r--recipes-core/openjdk/openjdk-6/shark-arm-linux-cpu-detection.patch113
1 files changed, 0 insertions, 113 deletions
diff --git a/recipes-core/openjdk/openjdk-6/shark-arm-linux-cpu-detection.patch b/recipes-core/openjdk/openjdk-6/shark-arm-linux-cpu-detection.patch
deleted file mode 100644
index df9e147..0000000
--- a/recipes-core/openjdk/openjdk-6/shark-arm-linux-cpu-detection.patch
+++ /dev/null
@@ -1,113 +0,0 @@
1Index: icedtea6-1.8/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp
2===================================================================
3--- icedtea6-1.8.orig/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp 2010-07-14 16:42:48.412103129 +0200
4+++ icedtea6-1.8/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp 2010-07-14 16:50:51.680282178 +0200
5@@ -32,6 +32,96 @@
6
7 #if SHARK_LLVM_VERSION >= 27
8 namespace {
9+
10+#if defined(__arm__) && defined(__linux__)
11+#include <fcntl.h>
12+#include <linux/auxvec.h>
13+#include <asm/hwcap.h>
14+#define VECBUFF_SIZE 32
15+
16+bool TestARMLinuxHWCAP(int feature) {
17+ int fd;
18+ unsigned vecs[VECBUFF_SIZE];
19+ unsigned *p;
20+ int i, n;
21+ int rc;
22+
23+ rc = 0;
24+ fd = open("/proc/self/auxv", O_RDONLY);
25+ if (fd < 0) return 0;
26+ do {
27+ n = read(fd, vecs, VECBUFF_SIZE * sizeof(unsigned));
28+ p = vecs;
29+ i = n/8;
30+ while (--i >=0) {
31+ unsigned tag = *p++;
32+ unsigned value = *p++;
33+ if (tag == 0) goto fini;
34+ if(tag == AT_HWCAP && (value & feature)) {
35+ rc = 1;
36+ goto fini;
37+ }
38+ }
39+ } while (n == VECBUFF_SIZE * sizeof(unsigned));
40+fini:
41+ close(fd);
42+ return rc;
43+}
44+
45+char* TestARMLinuxAT(int auxvec) {
46+ int fd;
47+ unsigned vecs[VECBUFF_SIZE];
48+ unsigned *p;
49+ int i, n;
50+ char* rc;
51+
52+ rc = 0;
53+ fd = open("/proc/self/auxv", O_RDONLY);
54+ if (fd < 0) return 0;
55+ do {
56+ n = read(fd, vecs, VECBUFF_SIZE * sizeof(unsigned));
57+ p = vecs;
58+ i = n/8;
59+ while (--i >=0) {
60+ unsigned tag = *p++;
61+ unsigned value = *p++;
62+ if (tag == 0) goto fini;
63+ if(tag == (unsigned) auxvec ) {
64+ rc = (char*)value;
65+ goto fini;
66+ }
67+ }
68+ } while (n == VECBUFF_SIZE * sizeof(unsigned));
69+fini:
70+ close(fd);
71+ return rc;
72+}
73+
74+bool getARMHostCPUFeatures(StringMap<bool> &Features) {
75+ // FIXME LLVM PR6561 // Features["neon"]=TestARMLinuxHWCAP(HWCAP_NEON);
76+ Features["thumb2"]=TestARMLinuxHWCAP(HWCAP_THUMBEE);
77+ Features["vfp2"]=TestARMLinuxHWCAP(HWCAP_VFP);
78+
79+ std::string testArchKey(TestARMLinuxAT(AT_PLATFORM));
80+
81+ StringMap<std::string> archLinuxToLLVMMap;
82+ archLinuxToLLVMMap["v4l"]="v4t";
83+ archLinuxToLLVMMap["v5l"]="v5t";
84+ archLinuxToLLVMMap["v6l"]="v6";
85+ // FIXME change this from v6 to v7a when LLVM PR7048 have been fixed
86+ archLinuxToLLVMMap["v7l"]="v6";
87+
88+ llvm::StringMapIterator<std::string> resultIterator(archLinuxToLLVMMap.find(
89+ testArchKey));
90+ if(resultIterator->first()) {
91+ std::string arch(resultIterator->second);
92+ Features[arch]=true;
93+ }
94+
95+ return true;
96+}
97+#endif
98+
99 cl::opt<std::string>
100 MCPU("mcpu");
101
102@@ -64,7 +154,11 @@
103 #if SHARK_LLVM_VERSION >= 27
104 // Finetune LLVM for the current host CPU.
105 StringMap<bool> Features;
106+#if defined(__arm__) && defined(__linux__)
107+ bool gotCpuFeatures = getARMHostCPUFeatures(Features);
108+#else
109 bool gotCpuFeatures = llvm::sys::getHostCPUFeatures(Features);
110+#endif
111 std::string cpu("-mcpu=" + llvm::sys::getHostCPUName());
112
113 std::vector<const char*> args;