diff options
| author | Henning Heinold <heinold@inf.fu-berlin.de> | 2011-12-21 16:54:41 +0100 |
|---|---|---|
| committer | Henning Heinold <heinold@inf.fu-berlin.de> | 2011-12-22 13:44:17 +0100 |
| commit | 85b69446da92ad119ced3353787fe57391006969 (patch) | |
| tree | 2826e3fbc9339948e445be1463471f39a0a22ea7 | |
| parent | 3dfe9775bf13ee02b9f20fe61e7fabef0268a0e2 (diff) | |
| download | meta-java-85b69446da92ad119ced3353787fe57391006969.tar.gz | |
llvm: add llvm 2.8, because it is the last know working version for arm
* we need static libs, because shared libs are not allowed with cmake
* disable llvm-mc because it is no buildable with static libs and cmake
Signed-off-by: Henning Heinold <heinold@inf.fu-berlin.de>
| -rw-r--r-- | recipes-core/llvm/llvm2.8/0019-issue6065.patch | 20 | ||||
| -rw-r--r-- | recipes-core/llvm/llvm2.8/30may-llvm2.8-pr399-ppc-arm.patch | 113 | ||||
| -rw-r--r-- | recipes-core/llvm/llvm2.8/llvm-mc_disable.patch | 12 | ||||
| -rw-r--r-- | recipes-core/llvm/llvm2.8_2.8.bb | 19 |
4 files changed, 164 insertions, 0 deletions
diff --git a/recipes-core/llvm/llvm2.8/0019-issue6065.patch b/recipes-core/llvm/llvm2.8/0019-issue6065.patch new file mode 100644 index 0000000..a7f7bbe --- /dev/null +++ b/recipes-core/llvm/llvm2.8/0019-issue6065.patch | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | --- | ||
| 2 | ARMJITInfo.cpp | 6 ++++++ | ||
| 3 | 1 file changed, 6 insertions(+) | ||
| 4 | |||
| 5 | --- a/lib/Target/ARM/ARMJITInfo.cpp | ||
| 6 | +++ b/lib/Target/ARM/ARMJITInfo.cpp | ||
| 7 | @@ -99,7 +99,13 @@ | ||
| 8 | // The above twiddling of the saved return addresses allows us to | ||
| 9 | // deallocate everything, including the LR the stub saved, all in one | ||
| 10 | // pop instruction. | ||
| 11 | +#ifndef __thumb__ | ||
| 12 | "ldmia sp!, {r0, r1, r2, r3, lr, pc}\n" | ||
| 13 | +#else | ||
| 14 | + // thumb dont allow lr and pc to be poped in the same instruction. | ||
| 15 | + "pop {r0, r1, r2, r3, lr}\n" | ||
| 16 | + "pop {pc}\n" | ||
| 17 | +#endif | ||
| 18 | ); | ||
| 19 | #else // Not an ARM host | ||
| 20 | void ARMCompilationCallback() { | ||
diff --git a/recipes-core/llvm/llvm2.8/30may-llvm2.8-pr399-ppc-arm.patch b/recipes-core/llvm/llvm2.8/30may-llvm2.8-pr399-ppc-arm.patch new file mode 100644 index 0000000..ee5cbaf --- /dev/null +++ b/recipes-core/llvm/llvm2.8/30may-llvm2.8-pr399-ppc-arm.patch | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | Index: llvm-2.8/lib/ExecutionEngine/JIT/JIT.cpp | ||
| 2 | =================================================================== | ||
| 3 | --- llvm-2.8.orig/lib/ExecutionEngine/JIT/JIT.cpp 2010-08-17 18:19:18.000000000 +0200 | ||
| 4 | +++ llvm-2.8/lib/ExecutionEngine/JIT/JIT.cpp 2011-12-19 21:16:21.884288536 +0100 | ||
| 5 | @@ -252,7 +252,12 @@ | ||
| 6 | MutexGuard guard(Lock); | ||
| 7 | JITs.erase(jit); | ||
| 8 | } | ||
| 9 | - void *getPointerToNamedFunction(const char *Name) const { | ||
| 10 | + bool empty() { | ||
| 11 | + MutexGuard guard(Lock); | ||
| 12 | + return JITs.empty(); | ||
| 13 | + } | ||
| 14 | + void *getPointerToNamedFunction(const char *Name, | ||
| 15 | + bool AbortOnFailure = true) const { | ||
| 16 | MutexGuard guard(Lock); | ||
| 17 | assert(JITs.size() != 0 && "No Jit registered"); | ||
| 18 | //search function in every instance of JIT | ||
| 19 | @@ -264,7 +269,19 @@ | ||
| 20 | } | ||
| 21 | // The function is not available : fallback on the first created (will | ||
| 22 | // search in symbol of the current program/library) | ||
| 23 | - return (*JITs.begin())->getPointerToNamedFunction(Name); | ||
| 24 | + return (*JITs.begin())->getPointerToNamedFunction(Name, AbortOnFailure); | ||
| 25 | + } | ||
| 26 | + void *getPointerToGlobalIfAvailable(GlobalValue *V) const { | ||
| 27 | + MutexGuard guard(Lock); | ||
| 28 | + assert(JITs.size() != 0 && "No Jit registered"); | ||
| 29 | + //search function in every instance of JIT | ||
| 30 | + for (SmallPtrSet<JIT*, 1>::const_iterator Jit = JITs.begin(), | ||
| 31 | + end = JITs.end(); | ||
| 32 | + Jit != end; ++Jit) { | ||
| 33 | + if (void *Ptr = (*Jit)->getPointerToGlobalIfAvailable(V)) | ||
| 34 | + return Ptr; | ||
| 35 | + } | ||
| 36 | + return 0; | ||
| 37 | } | ||
| 38 | }; | ||
| 39 | ManagedStatic<JitPool> AllJits; | ||
| 40 | @@ -280,6 +297,22 @@ | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | +extern "C" { | ||
| 45 | + // getPointerToNamedFunctionOrNull - same as the above, but returns | ||
| 46 | + // NULL instead of aborting if the function cannot be found. | ||
| 47 | + void *getPointerToNamedFunctionOrNull(const char *Name) { | ||
| 48 | + return !AllJits->empty() ? AllJits->getPointerToNamedFunction(Name, false) : 0; | ||
| 49 | + } | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +extern "C" { | ||
| 53 | + // getPointerToGlobalIfAvailable - same as the above, but for global | ||
| 54 | + // variables, and only for those that have been codegened already. | ||
| 55 | + void *getPointerToGlobalIfAvailable(GlobalValue *V) { | ||
| 56 | + return !AllJits->empty() ? AllJits->getPointerToGlobalIfAvailable(V) : 0; | ||
| 57 | + } | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | JIT::JIT(Module *M, TargetMachine &tm, TargetJITInfo &tji, | ||
| 61 | JITMemoryManager *JMM, CodeGenOpt::Level OptLevel, bool GVsWithCode) | ||
| 62 | : ExecutionEngine(M), TM(tm), TJI(tji), AllocateGVsWithCode(GVsWithCode), | ||
| 63 | Index: llvm-2.8/lib/Target/ARM/ARMISelLowering.cpp | ||
| 64 | =================================================================== | ||
| 65 | --- llvm-2.8.orig/lib/Target/ARM/ARMISelLowering.cpp 2010-09-03 03:35:08.000000000 +0200 | ||
| 66 | +++ llvm-2.8/lib/Target/ARM/ARMISelLowering.cpp 2011-12-19 21:16:21.884288536 +0100 | ||
| 67 | @@ -1119,6 +1119,9 @@ | ||
| 68 | } | ||
| 69 | } | ||
| 70 | |||
| 71 | +extern "C" void *getPointerToNamedFunctionOrNull(const char *Name); | ||
| 72 | +extern "C" void *getPointerToGlobalIfAvailable(GlobalValue *Value); | ||
| 73 | + | ||
| 74 | /// LowerCall - Lowering a call into a callseq_start <- | ||
| 75 | /// ARMISD:CALL <- callseq_end chain. Also add input and output parameter | ||
| 76 | /// nodes. | ||
| 77 | @@ -1272,6 +1275,26 @@ | ||
| 78 | InFlag =SDValue(); | ||
| 79 | } | ||
| 80 | |||
| 81 | + EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); | ||
| 82 | + | ||
| 83 | + // XXX Work around for http://llvm.org/bugs/show_bug.cgi?id=5201 | ||
| 84 | + // and http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=399 | ||
| 85 | + // for Shark. | ||
| 86 | + // | ||
| 87 | + // If the callee is an ExternalSymbol node, and the symbol can be | ||
| 88 | + // resolved to a function pointer, then insert that pointer as a | ||
| 89 | + // constant. This causes the next block of code to fall into the | ||
| 90 | + // block that emits an indirect call. This works around | ||
| 91 | + // | ||
| 92 | + // This works for Shark because the only kinds of call that Shark | ||
| 93 | + // makes that do not already fall into the indirect call block are | ||
| 94 | + // calls to pre-existing external functions. | ||
| 95 | + if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) { | ||
| 96 | + void *FuncPtr = getPointerToNamedFunctionOrNull(S->getSymbol()); | ||
| 97 | + if (FuncPtr) | ||
| 98 | + Callee = DAG.getConstant((uint64_t) FuncPtr, PtrVT); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every | ||
| 102 | // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol | ||
| 103 | // node so that legalize doesn't hack it. | ||
| 104 | Index: llvm-2.8/tools/llc/CMakeLists.txt | ||
| 105 | =================================================================== | ||
| 106 | --- llvm-2.8.orig/tools/llc/CMakeLists.txt 2009-09-03 00:45:31.000000000 +0200 | ||
| 107 | +++ llvm-2.8/tools/llc/CMakeLists.txt 2011-12-19 21:16:21.884288536 +0100 | ||
| 108 | @@ -1,4 +1,4 @@ | ||
| 109 | -set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} bitreader asmparser) | ||
| 110 | +set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} jit bitreader asmparser) | ||
| 111 | |||
| 112 | add_llvm_tool(llc | ||
| 113 | llc.cpp | ||
diff --git a/recipes-core/llvm/llvm2.8/llvm-mc_disable.patch b/recipes-core/llvm/llvm2.8/llvm-mc_disable.patch new file mode 100644 index 0000000..fddc674 --- /dev/null +++ b/recipes-core/llvm/llvm2.8/llvm-mc_disable.patch | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | Index: llvm-2.8/tools/CMakeLists.txt | ||
| 2 | =================================================================== | ||
| 3 | --- llvm-2.8.orig/tools/CMakeLists.txt 2010-08-24 11:16:51.000000000 +0200 | ||
| 4 | +++ llvm-2.8/tools/CMakeLists.txt 2011-12-21 16:47:47.718508763 +0100 | ||
| 5 | @@ -14,7 +14,6 @@ | ||
| 6 | add_subdirectory(opt) | ||
| 7 | add_subdirectory(llvm-as) | ||
| 8 | add_subdirectory(llvm-dis) | ||
| 9 | -add_subdirectory(llvm-mc) | ||
| 10 | |||
| 11 | add_subdirectory(llc) | ||
| 12 | add_subdirectory(llvm-ranlib) | ||
diff --git a/recipes-core/llvm/llvm2.8_2.8.bb b/recipes-core/llvm/llvm2.8_2.8.bb new file mode 100644 index 0000000..310e94e --- /dev/null +++ b/recipes-core/llvm/llvm2.8_2.8.bb | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | require llvm.inc | ||
| 2 | |||
| 3 | #LICENSE = "University of Illinois/NCSA Open Source License" | ||
| 4 | LICENSE = "NCSA" | ||
| 5 | LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=0ac5f799a2d89477c75b0a378b221855" | ||
| 6 | |||
| 7 | SRC_URI += " \ | ||
| 8 | file://30may-llvm2.8-pr399-ppc-arm.patch \ | ||
| 9 | file://0019-issue6065.patch \ | ||
| 10 | " | ||
| 11 | |||
| 12 | SRC_URI_append_arm = " file://llvm-mc_disable.patch " | ||
| 13 | |||
| 14 | LLVM_RELEASE = "2.8" | ||
| 15 | |||
| 16 | EXTRA_OECMAKE_append-arm = " -DBUILD_SHARED_LIBS:BOOL=OFF " | ||
| 17 | |||
| 18 | SRC_URI[md5sum] = "220d361b4d17051ff4bb21c64abe05ba" | ||
| 19 | SRC_URI[sha256sum] = "25addb742f1c6cc12877ed0ee924dda962d848368ee095be8e48342ae613d43b" | ||
