diff options
| author | Henning Heinold <heinold@inf.fu-berlin.de> | 2011-11-12 20:58:34 +0100 |
|---|---|---|
| committer | Henning Heinold <heinold@inf.fu-berlin.de> | 2011-11-26 23:41:44 +0100 |
| commit | 57e069cde6617f00ca8834a82c6f360af43d5067 (patch) | |
| tree | 48cbe15e96d217c45acfa64b0c13aad8c6424980 /recipes-core/openjdk/openjdk-6/shark-arm-linux-cpu-detection.patch | |
| download | meta-java-57e069cde6617f00ca8834a82c6f360af43d5067.tar.gz | |
meta-java: initial commit
* taken over mostly stuff from oe classic
* cleaned up recipes
* added license checksums
* bump icedtea6-native to 1.8.11
* use jamvm from git as native
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.patch | 113 |
1 files changed, 113 insertions, 0 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 new file mode 100644 index 0000000..df9e147 --- /dev/null +++ b/recipes-core/openjdk/openjdk-6/shark-arm-linux-cpu-detection.patch | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | Index: 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; | ||
