diff options
author | Xerxes Rånby <xerxes@zafena.se> | 2010-07-14 18:42:45 +0200 |
---|---|---|
committer | Xerxes Rånby <xerxes@zafena.se> | 2010-07-14 18:47:39 +0200 |
commit | 1ea15a2cd73178c3fbab36b544a6601b1d1c32bf (patch) | |
tree | f500aff72b96ffae434a8f05fa04a420e91e358d /recipes/openjdk | |
parent | be6ff5541d09fb0c938d12fad2ceee07680a36fc (diff) | |
download | openembedded-1ea15a2cd73178c3fbab36b544a6601b1d1c32bf.tar.gz |
openjdk-6-6b18: Add ARM Linux Shark CPU features detection code.
Diffstat (limited to 'recipes/openjdk')
-rw-r--r-- | recipes/openjdk/openjdk-6-6b18-1.8/shark-arm-linux-cpu-detection.patch | 113 | ||||
-rw-r--r-- | recipes/openjdk/openjdk-6-common.inc | 2 | ||||
-rw-r--r-- | recipes/openjdk/openjdk-6-release-6b18.inc | 1 |
3 files changed, 115 insertions, 1 deletions
diff --git a/recipes/openjdk/openjdk-6-6b18-1.8/shark-arm-linux-cpu-detection.patch b/recipes/openjdk/openjdk-6-6b18-1.8/shark-arm-linux-cpu-detection.patch new file mode 100644 index 0000000000..db5f30cf18 --- /dev/null +++ b/recipes/openjdk/openjdk-6-6b18-1.8/shark-arm-linux-cpu-detection.patch @@ -0,0 +1,113 @@ +Index: icedtea6-1.8/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp +=================================================================== +--- icedtea6-1.8.orig/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp 2010-07-14 16:42:48.412103129 +0200 ++++ icedtea6-1.8/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp 2010-07-14 16:50:51.680282178 +0200 +@@ -32,6 +32,96 @@ + + #if SHARK_LLVM_VERSION >= 27 + namespace { ++ ++#if defined(__arm__) && defined(__linux__) ++#include <fcntl.h> ++#include <linux/auxvec.h> ++#include <asm/hwcap.h> ++#define VECBUFF_SIZE 32 ++ ++bool TestARMLinuxHWCAP(int feature) { ++ int fd; ++ unsigned vecs[VECBUFF_SIZE]; ++ unsigned *p; ++ int i, n; ++ int rc; ++ ++ rc = 0; ++ fd = open("/proc/self/auxv", O_RDONLY); ++ if (fd < 0) return 0; ++ do { ++ n = read(fd, vecs, VECBUFF_SIZE * sizeof(unsigned)); ++ p = vecs; ++ i = n/8; ++ while (--i >=0) { ++ unsigned tag = *p++; ++ unsigned value = *p++; ++ if (tag == 0) goto fini; ++ if(tag == AT_HWCAP && (value & feature)) { ++ rc = 1; ++ goto fini; ++ } ++ } ++ } while (n == VECBUFF_SIZE * sizeof(unsigned)); ++fini: ++ close(fd); ++ return rc; ++} ++ ++char* TestARMLinuxAT(int auxvec) { ++ int fd; ++ unsigned vecs[VECBUFF_SIZE]; ++ unsigned *p; ++ int i, n; ++ char* rc; ++ ++ rc = 0; ++ fd = open("/proc/self/auxv", O_RDONLY); ++ if (fd < 0) return 0; ++ do { ++ n = read(fd, vecs, VECBUFF_SIZE * sizeof(unsigned)); ++ p = vecs; ++ i = n/8; ++ while (--i >=0) { ++ unsigned tag = *p++; ++ unsigned value = *p++; ++ if (tag == 0) goto fini; ++ if(tag == (unsigned) auxvec ) { ++ rc = (char*)value; ++ goto fini; ++ } ++ } ++ } while (n == VECBUFF_SIZE * sizeof(unsigned)); ++fini: ++ close(fd); ++ return rc; ++} ++ ++bool getARMHostCPUFeatures(StringMap<bool> &Features) { ++ Features["neon"]=TestARMLinuxHWCAP(HWCAP_NEON); ++ Features["thumb2"]=TestARMLinuxHWCAP(HWCAP_THUMBEE); ++ Features["vfp2"]=TestARMLinuxHWCAP(HWCAP_VFP); ++ ++ std::string testArchKey(TestARMLinuxAT(AT_PLATFORM)); ++ ++ StringMap<std::string> archLinuxToLLVMMap; ++ archLinuxToLLVMMap["v4l"]="v4t"; ++ archLinuxToLLVMMap["v5l"]="v5t"; ++ archLinuxToLLVMMap["v6l"]="v6"; ++ // FIXME change this from v6 to v7a when LLVM PR6265 have been fixed ++ archLinuxToLLVMMap["v7l"]="v6"; ++ ++ llvm::StringMapIterator<std::string> resultIterator(archLinuxToLLVMMap.find( ++ testArchKey)); ++ if(resultIterator->first()) { ++ std::string arch(resultIterator->second); ++ Features[arch]=true; ++ } ++ ++ return true; ++} ++#endif ++ + cl::opt<std::string> + MCPU("mcpu"); + +@@ -64,7 +154,11 @@ + #if SHARK_LLVM_VERSION >= 27 + // Finetune LLVM for the current host CPU. + StringMap<bool> Features; ++#if defined(__arm__) && defined(__linux__) ++ bool gotCpuFeatures = getARMHostCPUFeatures(Features); ++#else + bool gotCpuFeatures = llvm::sys::getHostCPUFeatures(Features); ++#endif + std::string cpu("-mcpu=" + llvm::sys::getHostCPUName()); + + std::vector<const char*> args; diff --git a/recipes/openjdk/openjdk-6-common.inc b/recipes/openjdk/openjdk-6-common.inc index 95703c6747..1f0440f79a 100644 --- a/recipes/openjdk/openjdk-6-common.inc +++ b/recipes/openjdk/openjdk-6-common.inc @@ -10,7 +10,7 @@ ICEDTEA = "NEEDS TO BE SET" S = "${WORKDIR}/${ICEDTEA}" B = "${S}/build" -INC_PR = "r4" +INC_PR = "r5" SRC_URI = "\ ${ICEDTEA_URI} \ diff --git a/recipes/openjdk/openjdk-6-release-6b18.inc b/recipes/openjdk/openjdk-6-release-6b18.inc index 3888d07118..a3a02b015b 100644 --- a/recipes/openjdk/openjdk-6-release-6b18.inc +++ b/recipes/openjdk/openjdk-6-release-6b18.inc @@ -43,6 +43,7 @@ OEPATCHES = "\ file://icedtea-fix-jar-command.patch \ file://fix-llvm-libs.patch \ file://shark-build-openjdkdir.patch \ + file://shark-arm-linux-cpu-detection.patch \ " # Allow overriding this separately |