summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-core/llvm/llvm.inc83
-rw-r--r--meta-oe/recipes-core/llvm/llvm2.8/0019-issue6065.patch20
-rw-r--r--meta-oe/recipes-core/llvm/llvm2.8/30may-llvm2.8-pr399-ppc-arm.patch113
-rw-r--r--meta-oe/recipes-core/llvm/llvm2.8/add-unistd.patch12
-rw-r--r--meta-oe/recipes-core/llvm/llvm2.8/llvm-mc_disable.patch12
-rw-r--r--meta-oe/recipes-core/llvm/llvm2.8_2.8.bb16
-rw-r--r--meta-oe/recipes-core/llvm/llvm2.9/0019-issue6065.patch35
-rw-r--r--meta-oe/recipes-core/llvm/llvm2.9/0035-gcc-4.7.patch16
-rw-r--r--meta-oe/recipes-core/llvm/llvm2.9/arm_fenv_uclibc.patch14
-rw-r--r--meta-oe/recipes-core/llvm/llvm2.9_2.9.bb21
-rw-r--r--meta-oe/recipes-core/llvm/llvm2.inc170
-rw-r--r--meta-oe/recipes-core/llvm/llvm3.3_3.3.bb1
-rw-r--r--meta-oe/recipes-core/llvm/llvm3.inc80
13 files changed, 80 insertions, 513 deletions
diff --git a/meta-oe/recipes-core/llvm/llvm.inc b/meta-oe/recipes-core/llvm/llvm.inc
index acbf3c38a..26bac3310 100644
--- a/meta-oe/recipes-core/llvm/llvm.inc
+++ b/meta-oe/recipes-core/llvm/llvm.inc
@@ -25,13 +25,90 @@ HOMEPAGE = "http://llvm.org"
25LICENSE = "NCSA" 25LICENSE = "NCSA"
26LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=d0a3ef0d3e0e8f5cf59e5ffc273ab1f8" 26LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=d0a3ef0d3e0e8f5cf59e5ffc273ab1f8"
27 27
28# 2.* inherits also cmake 28DEPENDS = "libffi libxml2-native llvm-common"
29# 3.* inherits also automake 29
30inherit perlnative pythonnative 30inherit perlnative pythonnative autotools
31 31
32LLVM_RELEASE = "${PV}" 32LLVM_RELEASE = "${PV}"
33LLVM_DIR = "llvm${LLVM_RELEASE}" 33LLVM_DIR = "llvm${LLVM_RELEASE}"
34 34
35SRC_URI = "http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz"
36S = "${WORKDIR}/llvm-${PV}.src"
37
38LLVM_BUILD_DIR = "${WORKDIR}/llvm-${PV}.build"
39LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install"
40
41EXTRA_OECONF += "--disable-assertions \
42 --enable-debug-runtime \
43 --disable-expensive-checks \
44 --enable-bindings=none \
45 --enable-keep-symbols \
46 --enable-libffi \
47 --enable-optimized \
48 --enable-shared \
49 --enable-targets=host-only"
50EXTRA_OEMAKE += "REQUIRES_RTTI=1 VERBOSE=1"
51
52do_configure_prepend() {
53 # Remove RPATHs
54 sed -i 's:$(RPATH) -Wl,$(\(ToolDir\|LibDir\|ExmplDir\))::g' ${S}/Makefile.rules
55
56 # Drop "svn" suffix from version string
57 sed -i 's/${PV}svn/${PV}/g' ${S}/configure
58
59 # Fix paths in llvm-config
60 sed -i "s|sys::path::parent_path(CurrentPath))\.str()|sys::path::parent_path(sys::path::parent_path(CurrentPath))).str()|g" ${S}/tools/llvm-config/llvm-config.cpp
61 sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp
62
63 # Fails to build unless using separate directory from source
64 mkdir -p ${LLVM_BUILD_DIR}
65 cd ${LLVM_BUILD_DIR}
66}
67
68do_compile() {
69 cd ${LLVM_BUILD_DIR}
70 oe_runmake \
71 AR="${BUILD_AR}" \
72 CC="${BUILD_CC}" \
73 CFLAGS="${BUILD_CFLAGS}" \
74 CXX="${BUILD_CXX}" \
75 CXXFLAGS="${BUILD_CXXFLAGS}" \
76 CPP="${BUILD_CPP}" \
77 CPPFLAGS="${BUILD_CPPFLAGS}" \
78 NM="${BUILD_NM}" \
79 RANLIB="${BUILD_RANLIB}" \
80 PATH="${STAGING_BINDIR_NATIVE}:$PATH" \
81 cross-compile-build-tools
82 oe_runmake
83}
84
85do_install() {
86 cd ${LLVM_BUILD_DIR}
87 oe_runmake DESTDIR=${LLVM_INSTALL_DIR} install
88
89 mv ${LLVM_INSTALL_DIR}${bindir}/${HOST_SYS}-llvm-config-host ${LLVM_INSTALL_DIR}/llvm-config-host
90
91 install -d ${D}${bindir}/${LLVM_DIR}
92 mv ${LLVM_INSTALL_DIR}${bindir}/* ${D}${bindir}/${LLVM_DIR}/
93
94 install -d ${D}${includedir}/${LLVM_DIR}
95 mv ${LLVM_INSTALL_DIR}${includedir}/* ${D}${includedir}/${LLVM_DIR}/
96
97 install -d ${D}${libdir}/${LLVM_DIR}
98 mv ${LLVM_INSTALL_DIR}${libdir}/* ${D}${libdir}/${LLVM_DIR}/
99 ln -s ${LLVM_DIR}/libLLVM-${PV}.so ${D}${libdir}/libLLVM-${PV}.so
100
101 install -d ${D}${docdir}/${LLVM_DIR}
102 mv ${LLVM_INSTALL_DIR}${prefix}/docs/llvm/* ${D}${docdir}/${LLVM_DIR}
103}
104
105SYSROOT_PREPROCESS_FUNCS += "llvm_sysroot_preprocess"
106
107llvm_sysroot_preprocess() {
108 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
109 mv ${LLVM_INSTALL_DIR}/llvm-config-host ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV}
110}
111
35ALLOW_EMPTY_${PN} = "1" 112ALLOW_EMPTY_${PN} = "1"
36ALLOW_EMPTY_${PN}-staticdev = "1" 113ALLOW_EMPTY_${PN}-staticdev = "1"
37FILES_${PN} = "" 114FILES_${PN} = ""
diff --git a/meta-oe/recipes-core/llvm/llvm2.8/0019-issue6065.patch b/meta-oe/recipes-core/llvm/llvm2.8/0019-issue6065.patch
deleted file mode 100644
index a7f7bbe35..000000000
--- a/meta-oe/recipes-core/llvm/llvm2.8/0019-issue6065.patch
+++ /dev/null
@@ -1,20 +0,0 @@
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/meta-oe/recipes-core/llvm/llvm2.8/30may-llvm2.8-pr399-ppc-arm.patch b/meta-oe/recipes-core/llvm/llvm2.8/30may-llvm2.8-pr399-ppc-arm.patch
deleted file mode 100644
index ee5cbafd1..000000000
--- a/meta-oe/recipes-core/llvm/llvm2.8/30may-llvm2.8-pr399-ppc-arm.patch
+++ /dev/null
@@ -1,113 +0,0 @@
1Index: 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),
63Index: 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.
104Index: 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/meta-oe/recipes-core/llvm/llvm2.8/add-unistd.patch b/meta-oe/recipes-core/llvm/llvm2.8/add-unistd.patch
deleted file mode 100644
index 1c51b3063..000000000
--- a/meta-oe/recipes-core/llvm/llvm2.8/add-unistd.patch
+++ /dev/null
@@ -1,12 +0,0 @@
1Index: llvm-2.8/lib/ExecutionEngine/JIT/Intercept.cpp
2===================================================================
3--- llvm-2.8.orig/lib/ExecutionEngine/JIT/Intercept.cpp 2012-05-14 18:31:21.008318473 +0200
4+++ llvm-2.8/lib/ExecutionEngine/JIT/Intercept.cpp 2012-05-14 18:32:53.523734850 +0200
5@@ -19,6 +19,7 @@
6 #include "llvm/Support/ErrorHandling.h"
7 #include "llvm/System/DynamicLibrary.h"
8 #include "llvm/Config/config.h"
9+#include <unistd.h>
10 using namespace llvm;
11
12 // AtExitHandlers - List of functions to call when the program exits,
diff --git a/meta-oe/recipes-core/llvm/llvm2.8/llvm-mc_disable.patch b/meta-oe/recipes-core/llvm/llvm2.8/llvm-mc_disable.patch
deleted file mode 100644
index fddc6743e..000000000
--- a/meta-oe/recipes-core/llvm/llvm2.8/llvm-mc_disable.patch
+++ /dev/null
@@ -1,12 +0,0 @@
1Index: 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/meta-oe/recipes-core/llvm/llvm2.8_2.8.bb b/meta-oe/recipes-core/llvm/llvm2.8_2.8.bb
deleted file mode 100644
index 4d0b3c83c..000000000
--- a/meta-oe/recipes-core/llvm/llvm2.8_2.8.bb
+++ /dev/null
@@ -1,16 +0,0 @@
1require llvm.inc
2require llvm2.inc
3
4PR = "r3"
5
6SRC_URI += " \
7 file://30may-llvm2.8-pr399-ppc-arm.patch \
8 file://0019-issue6065.patch \
9 file://add-unistd.patch \
10 file://llvm-mc_disable.patch \
11"
12
13EXTRA_OECMAKE += " -DBUILD_SHARED_LIBS:BOOL=OFF "
14
15SRC_URI[md5sum] = "220d361b4d17051ff4bb21c64abe05ba"
16SRC_URI[sha256sum] = "25addb742f1c6cc12877ed0ee924dda962d848368ee095be8e48342ae613d43b"
diff --git a/meta-oe/recipes-core/llvm/llvm2.9/0019-issue6065.patch b/meta-oe/recipes-core/llvm/llvm2.9/0019-issue6065.patch
deleted file mode 100644
index aff3d1d06..000000000
--- a/meta-oe/recipes-core/llvm/llvm2.9/0019-issue6065.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1--- llvm-2.9.orig/lib/Target/ARM/ARMJITInfo.cpp 2013-04-19 14:49:28.063566919 +0200
2+++ llvm-2.9/lib/Target/ARM/ARMJITInfo.cpp 2013-04-19 15:24:31.065435029 +0200
3@@ -59,7 +59,17 @@
4 // for the real target function right now. We have to act as if this
5 // whole compilation callback doesn't exist as far as the caller is
6 // concerned, so we can't just preserve the callee saved regs.
7+ // stmdb introduced in http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp?diff_format=h&r1=57911&r2=57910&pathrev=57911
8+ // but fails on armv4t
9+ // | {standard input}: Assembler messages:
10+ // | {standard input}:22: Error: selected processor does not support Thumb mode `stmdb sp!,{r0,r1,r2,r3,lr}'
11+ // | {standard input}:31: Error: lo register required -- `ldmia sp!,{r0,r1,r2,r3,lr}'
12+ // | {standard input}:32: Error: lo register required -- `ldr pc,[sp],#4'
13+#ifndef __thumb__
14 "stmdb sp!, {r0, r1, r2, r3, lr}\n"
15+#else
16+ "push {r0, r1, r2, r3, lr}\n"
17+#endif
18 #if (defined(__VFP_FP__) && !defined(__SOFTFP__))
19 "fstmfdd sp!, {d0, d1, d2, d3, d4, d5, d6, d7}\n"
20 #endif
21@@ -99,8 +109,14 @@
22 // The above twiddling of the saved return addresses allows us to
23 // deallocate everything, including the LR the stub saved, with two
24 // updating load instructions.
25+#ifndef __thumb__
26 "ldmia sp!, {r0, r1, r2, r3, lr}\n"
27 "ldr pc, [sp], #4\n"
28+#else
29+ // thumb dont allow lr and pc to be poped in the same instruction.
30+ "pop {r0, r1, r2, r3, lr}\n"
31+ "pop {pc}\n"
32+#endif
33 );
34 #else // Not an ARM host
35 void ARMCompilationCallback() {
diff --git a/meta-oe/recipes-core/llvm/llvm2.9/0035-gcc-4.7.patch b/meta-oe/recipes-core/llvm/llvm2.9/0035-gcc-4.7.patch
deleted file mode 100644
index 4cf8d4464..000000000
--- a/meta-oe/recipes-core/llvm/llvm2.9/0035-gcc-4.7.patch
+++ /dev/null
@@ -1,16 +0,0 @@
1Upstream-Status: Pending
2
3Imported from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=673266
4
5Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
6
7--- a/lib/ExecutionEngine/JIT/Intercept.cpp 2012-05-17 16:11:46.956180361 +0200
8+++ b/lib/ExecutionEngine/JIT/Intercept.cpp 2012-05-17 16:14:35.256184996 +0200
9@@ -52,6 +52,7 @@
10 #include <sys/stat.h>
11 #endif
12 #include <fcntl.h>
13+#include <unistd.h>
14 /* stat functions are redirecting to __xstat with a version number. On x86-64
15 * linking with libc_nonshared.a and -Wl,--export-dynamic doesn't make 'stat'
16 * available as an exported symbol, so we have to add it explicitly.
diff --git a/meta-oe/recipes-core/llvm/llvm2.9/arm_fenv_uclibc.patch b/meta-oe/recipes-core/llvm/llvm2.9/arm_fenv_uclibc.patch
deleted file mode 100644
index c3ae49464..000000000
--- a/meta-oe/recipes-core/llvm/llvm2.9/arm_fenv_uclibc.patch
+++ /dev/null
@@ -1,14 +0,0 @@
1Index: llvm-2.9/include/llvm/Support/FEnv.h
2===================================================================
3--- llvm-2.9.orig/include/llvm/Support/FEnv.h 2010-11-29 20:44:50.000000000 +0100
4+++ llvm-2.9/include/llvm/Support/FEnv.h 2011-11-18 18:42:22.580161297 +0100
5@@ -17,6 +17,9 @@
6
7 #include "llvm/Config/config.h"
8 #include <cerrno>
9+
10+#undef HAVE_FENV_H
11+
12 #ifdef HAVE_FENV_H
13 #include <fenv.h>
14 #endif
diff --git a/meta-oe/recipes-core/llvm/llvm2.9_2.9.bb b/meta-oe/recipes-core/llvm/llvm2.9_2.9.bb
deleted file mode 100644
index 44504b8e1..000000000
--- a/meta-oe/recipes-core/llvm/llvm2.9_2.9.bb
+++ /dev/null
@@ -1,21 +0,0 @@
1require llvm.inc
2require llvm2.inc
3
4PR = "r3"
5
6SRC_URI += "file://0035-gcc-4.7.patch"
7
8ARM_INSTRUCTION_SET = "arm"
9
10# 0019-issue6065.patch is still needed but a bit modified, because it was resolved by
11# http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp?r1=120304&r2=124694&pathrev=124694
12# http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.cpp?diff_format=h&r1=57911&r2=57910&pathrev=57911
13# and still it fails with
14# {standard input}:31: Error: invalid register list to push/pop instruction -- `pop {r0,r1,r2,r3,lr}'
15# make[2]: *** [lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/ARMJITInfo.cpp.o] Error 1
16# SRC_URI += "file://0019-issue6065.patch"
17
18SRC_URI_append_libc-uclibc = " file://arm_fenv_uclibc.patch "
19
20SRC_URI[md5sum] = "793138412d2af2c7c7f54615f8943771"
21SRC_URI[sha256sum] = "661236cfa17428b48cfa9cbb9909f7569c64b8ecd219fd91dbc00e3b557b3779"
diff --git a/meta-oe/recipes-core/llvm/llvm2.inc b/meta-oe/recipes-core/llvm/llvm2.inc
deleted file mode 100644
index a1f6ce87d..000000000
--- a/meta-oe/recipes-core/llvm/llvm2.inc
+++ /dev/null
@@ -1,170 +0,0 @@
1DEPENDS = "llvm${LLVM_RELEASE}-native llvm-common perl-native"
2DEPENDS_class-native = "llvm-common-native cmake-native"
3
4SRC_URI = "http://llvm.org/releases/${PV}/llvm-${PV}.tgz"
5S = "${WORKDIR}/llvm-${PV}"
6
7LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=0ac5f799a2d89477c75b0a378b221855"
8
9inherit cmake
10
11# Defines the LLVM supported arches. By now we always build either for ${BUILD}
12# (native) or ${TARGET}. In the future it may make sense to enable all backends
13# for the non-native build. The decision which backends are used is made by
14# the 3rd party program or library that uses llvm anyway.
15LLVM_ARCH = "${@get_llvm_arch(d)}"
16
17# This is used for generating the install directory for the llvm libraries,
18# binaries and headers. It makes side by side installation of those possible.
19LLVM_RELEASE = "${PV}"
20
21BBCLASSEXTEND = "native"
22
23LLVM_INSTALL_DIR = "${B}/llvm-install"
24
25# other architectures require X86 available,
26LLVM_EXTRA_ARCH = "X86;"
27LLVM_EXTRA_ARCH_x86 = ""
28LLVM_EXTRA_ARCH_x86-64 = ""
29
30EXTRA_OECMAKE = "\
31 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/${LLVM_DIR}/tblgen \
32 -DLLVM_TARGETS_TO_BUILD="${LLVM_EXTRA_ARCH}${LLVM_ARCH}" \
33 -DCMAKE_LINKER:FILEPATH=${LD} \
34 -DCMAKE_AR:FILEPATH=${AR} \
35 -DCMAKE_OBJCOPY:FILEPATH=${OBJCOPY} \
36 -DCMAKE_OBJDUMP:FILEPATH=${OBJDUMP} \
37 -DCMAKE_RANLIB:FILEPATH=${RANLIB} \
38 -DCMAKE_STRIP:FILEPATH=${STRIP} \
39 -DNM_PATH:FILEPATH=${NM} \
40 -DLLVM_ENABLE_PIC:BOOL=ON \
41 -DLLVM_TARGET_ARCH:STRING=${LLVM_ARCH} \
42 -DLLVM_ENABLE_ASSERTIONS:BOOL=ON \
43 -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
44 -DBUILD_SHARED_LIBS:BOOL=ON \
45 -DCMAKE_SKIP_BUILD_RPATH:BOOL=ON \
46"
47
48# We need to reset this to avoid breakage as we build out of tree
49TOOLCHAIN_OPTIONS = ""
50
51# the difference to the non-native build is that we do not need
52# to declare the location of the tblgen executable.
53EXTRA_OECMAKE_class-native = "\
54 -DLLVM_TARGETS_TO_BUILD=${LLVM_ARCH} \
55 -DCMAKE_LINKER:FILEPATH=${LD} \
56 -DCMAKE_AR:FILEPATH=${AR} \
57 -DCMAKE_OBJCOPY:FILEPATH=${OBJCOPY} \
58 -DCMAKE_OBJDUMP:FILEPATH=${OBJDUMP} \
59 -DCMAKE_RANLIB:FILEPATH=${RANLIB} \
60 -DCMAKE_STRIP:FILEPATH=${STRIP} \
61 -DNM_PATH:FILEPATH=${NM} \
62"
63
64base_do_compile_prepend() {
65 # Avoid *** No rule to make target `native/bin/tblgen', needed by `include/llvm/Intrinsics.gen.tmp'
66 oe_runmake tblgen
67}
68
69do_install() {
70 # Install into a private directory to be able to reorganize the files.
71 cd ${B}
72 oe_runmake DESTDIR=${LLVM_INSTALL_DIR} install
73
74 # Create our custom target directories
75 install -d ${D}${bindir}/${LLVM_DIR}
76 install -d ${D}${includedir}/${LLVM_DIR}
77 install -d ${D}${libdir}/${LLVM_DIR}
78
79 # Move headers into their own directory
80 cp -R ${LLVM_INSTALL_DIR}/${prefix}/include/llvm \
81 ${D}${includedir}/${LLVM_DIR}/
82 cp -R ${LLVM_INSTALL_DIR}/${prefix}/include/llvm-c \
83 ${D}${includedir}/${LLVM_DIR}/
84
85 find ${LLVM_INSTALL_DIR}/${prefix}/lib -name "*" -maxdepth 1 -exec \
86 install {} ${D}${libdir}/${LLVM_DIR} \;
87
88 # I dont know another way out. Binaries are installed into a special subdir
89 find ${LLVM_INSTALL_DIR}/${prefix}/bin -name "*" -maxdepth 1 -exec \
90 install {} ${D}${bindir}/${LLVM_DIR} \;
91
92 # LLVM does not install this by default.
93 install bin/tblgen ${D}${bindir}/${LLVM_DIR}
94}
95
96SYSROOT_PREPROCESS_FUNCS_append_class-target = " llvm_sysroot_preprocess"
97
98llvm_sysroot_preprocess() {
99 cd ${B}
100
101 # Fix the paths in the config script to make it find the binaries and
102 # library files. Doing so allows 3rd party configure scripts working
103 # unmodified.
104 sed -e's!my.*ABS_RUN_DIR =.*!my $ABS_RUN_DIR = "${STAGING_DIR_TARGET}";!' \
105 -e's!my.*INCLUDEDIR =.*!my $INCLUDEDIR = "${STAGING_INCDIR}/${LLVM_DIR}";!' \
106 -e's!my.*LIBDIR.*!my $LIBDIR = "${STAGING_LIBDIR}/${LLVM_DIR}";!' \
107 -e's!my.*BINDIR.*!my $BINDIR = "${STAGING_BINDIR}/${LLVM_DIR}";!' \
108 bin/llvm-config > bin/llvm-config${LLVM_RELEASE}
109
110 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
111 install -m 0755 bin/llvm-config${LLVM_RELEASE} ${SYSROOT_DESTDIR}${bindir_crossscripts}
112}
113
114do_install_class-native() {
115 # Install into a private directory to be able to reorganize the files.
116 cd ${B}
117 oe_runmake DESTDIR=${LLVM_INSTALL_DIR} install
118
119 # Create our custom target directories
120 install -d ${D}${bindir}/${LLVM_DIR}
121 install -d ${D}${includedir}/${LLVM_DIR}
122 install -d ${D}${libdir}/${LLVM_DIR}
123
124 # Move headers into their own directory
125 cp -R ${LLVM_INSTALL_DIR}/${prefix}/include/llvm \
126 ${D}${includedir}/${LLVM_DIR}/
127 cp -R ${LLVM_INSTALL_DIR}/${prefix}/include/llvm-c \
128 ${D}${includedir}/${LLVM_DIR}/
129
130 find ${LLVM_INSTALL_DIR}/${prefix}/lib -name "*" -maxdepth 1 -exec \
131 install {} ${D}${libdir}/${LLVM_DIR} \;
132
133 # I dont know another way out. Binaries are installed into a special subdir
134 find ${LLVM_INSTALL_DIR}/${prefix}/bin -name "*" -maxdepth 1 -exec \
135 install {} ${D}${bindir}/${LLVM_DIR} \;
136
137 # LLVM does not install this by default.
138 install bin/tblgen ${D}${bindir}/${LLVM_DIR}
139
140 # Fix the paths in the config script to make it find the binaries and
141 # library files. Doing so allows 3rd party configure scripts working
142 # unmodified.
143 sed -e's!my.*ABS_RUN_DIR =.*!my $ABS_RUN_DIR = "${STAGING_DIR_TARGET}";!' \
144 -e's!my.*INCLUDEDIR =.*!my $INCLUDEDIR = "${STAGING_INCDIR}/${LLVM_DIR}";!' \
145 -e's!my.*LIBDIR.*!my $LIBDIR = "${STAGING_LIBDIR}/${LLVM_DIR}";!' \
146 -e's!my.*BINDIR.*!my $BINDIR = "${STAGING_BINDIR}/${LLVM_DIR}";!' \
147 bin/llvm-config > bin/llvm-config${LLVM_RELEASE}
148
149 install -d ${D}${bindir}
150 install -m 0755 bin/llvm-config${LLVM_RELEASE} ${D}${bindir}
151}
152
153# Retrieve the target in a way that is compatible to the arch
154# value in llvm (>= 2.5)
155def get_llvm_arch(d):
156 import bb;
157
158 arch = bb.data.getVar('TARGET_ARCH', d, 1)
159 if arch == "x86_64" or arch == "i486" or arch == "i586" or arch == "i686":
160 arch = "X86"
161 elif arch == "arm":
162 arch = "ARM"
163 elif arch == "mipsel" or arch == "mips":
164 arch = "mips"
165 elif arch == "powerpc" or arch == "powerpc64":
166 arch = "PowerPC"
167 else:
168 bb.warn("%s does not support %s yet" % (bb.data.getVar('PN', d, 1), arch) );
169
170 return arch
diff --git a/meta-oe/recipes-core/llvm/llvm3.3_3.3.bb b/meta-oe/recipes-core/llvm/llvm3.3_3.3.bb
index 65db1a894..4617efa8b 100644
--- a/meta-oe/recipes-core/llvm/llvm3.3_3.3.bb
+++ b/meta-oe/recipes-core/llvm/llvm3.3_3.3.bb
@@ -1,5 +1,4 @@
1require llvm.inc 1require llvm.inc
2require llvm3.inc
3 2
4DEPENDS += "zlib" 3DEPENDS += "zlib"
5EXTRA_OECONF += "--enable-zlib" 4EXTRA_OECONF += "--enable-zlib"
diff --git a/meta-oe/recipes-core/llvm/llvm3.inc b/meta-oe/recipes-core/llvm/llvm3.inc
deleted file mode 100644
index a5bd896c6..000000000
--- a/meta-oe/recipes-core/llvm/llvm3.inc
+++ /dev/null
@@ -1,80 +0,0 @@
1DEPENDS = "libffi libxml2-native llvm-common"
2
3SRC_URI = "http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz"
4S = "${WORKDIR}/llvm-${PV}.src"
5
6inherit autotools
7
8LLVM_BUILD_DIR = "${WORKDIR}/llvm-${PV}.build"
9LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install"
10
11EXTRA_OECONF += "--disable-assertions \
12 --enable-debug-runtime \
13 --disable-expensive-checks \
14 --enable-bindings=none \
15 --enable-keep-symbols \
16 --enable-libffi \
17 --enable-optimized \
18 --enable-shared \
19 --enable-targets=host-only"
20EXTRA_OEMAKE += "REQUIRES_RTTI=1 VERBOSE=1"
21
22do_configure_prepend() {
23 # Remove RPATHs
24 sed -i 's:$(RPATH) -Wl,$(\(ToolDir\|LibDir\|ExmplDir\))::g' ${S}/Makefile.rules
25
26 # Drop "svn" suffix from version string
27 sed -i 's/${PV}svn/${PV}/g' ${S}/configure
28
29 # Fix paths in llvm-config
30 sed -i "s|sys::path::parent_path(CurrentPath))\.str()|sys::path::parent_path(sys::path::parent_path(CurrentPath))).str()|g" ${S}/tools/llvm-config/llvm-config.cpp
31 sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp
32
33 # Fails to build unless using separate directory from source
34 mkdir -p ${LLVM_BUILD_DIR}
35 cd ${LLVM_BUILD_DIR}
36}
37
38do_compile() {
39 cd ${LLVM_BUILD_DIR}
40 oe_runmake \
41 AR="${BUILD_AR}" \
42 CC="${BUILD_CC}" \
43 CFLAGS="${BUILD_CFLAGS}" \
44 CXX="${BUILD_CXX}" \
45 CXXFLAGS="${BUILD_CXXFLAGS}" \
46 CPP="${BUILD_CPP}" \
47 CPPFLAGS="${BUILD_CPPFLAGS}" \
48 NM="${BUILD_NM}" \
49 RANLIB="${BUILD_RANLIB}" \
50 PATH="${STAGING_BINDIR_NATIVE}:$PATH" \
51 cross-compile-build-tools
52 oe_runmake
53}
54
55do_install() {
56 cd ${LLVM_BUILD_DIR}
57 oe_runmake DESTDIR=${LLVM_INSTALL_DIR} install
58
59 mv ${LLVM_INSTALL_DIR}${bindir}/${HOST_SYS}-llvm-config-host ${LLVM_INSTALL_DIR}/llvm-config-host
60
61 install -d ${D}${bindir}/${LLVM_DIR}
62 mv ${LLVM_INSTALL_DIR}${bindir}/* ${D}${bindir}/${LLVM_DIR}/
63
64 install -d ${D}${includedir}/${LLVM_DIR}
65 mv ${LLVM_INSTALL_DIR}${includedir}/* ${D}${includedir}/${LLVM_DIR}/
66
67 install -d ${D}${libdir}/${LLVM_DIR}
68 mv ${LLVM_INSTALL_DIR}${libdir}/* ${D}${libdir}/${LLVM_DIR}/
69 ln -s ${LLVM_DIR}/libLLVM-${PV}.so ${D}${libdir}/libLLVM-${PV}.so
70
71 install -d ${D}${docdir}/${LLVM_DIR}
72 mv ${LLVM_INSTALL_DIR}${prefix}/docs/llvm/* ${D}${docdir}/${LLVM_DIR}
73}
74
75SYSROOT_PREPROCESS_FUNCS += "llvm_sysroot_preprocess"
76
77llvm_sysroot_preprocess() {
78 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
79 mv ${LLVM_INSTALL_DIR}/llvm-config-host ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV}
80}