diff options
author | Martin Jansa <Martin.Jansa@gmail.com> | 2013-04-13 17:16:29 +0200 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2013-04-19 02:45:27 +0200 |
commit | 334f77d5879babebabc07b5cf7ad99127a41880d (patch) | |
tree | 3ea81497ead7d876f607123f7f9064ee136e227d /meta-oe/recipes-core | |
parent | bea2397361da080df1256046b927b454e2e5fc9a (diff) | |
download | meta-openembedded-334f77d5879babebabc07b5cf7ad99127a41880d.tar.gz |
llvm2.8: Import from meta-java
* llvm is generic enough to be useful outside meta-java
e.g. we need it to enable llvmpipe galium driver in mesa
* imported without any modification (except indentation), all
credits go to Henning Heinold and Khem Raj for maintaining
it in meta-java
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-core')
-rw-r--r-- | meta-oe/recipes-core/llvm/llvm-common.bb | 19 | ||||
-rw-r--r-- | meta-oe/recipes-core/llvm/llvm-common/llvm-config | 10 | ||||
-rw-r--r-- | meta-oe/recipes-core/llvm/llvm.inc | 214 | ||||
-rw-r--r-- | meta-oe/recipes-core/llvm/llvm2.8/0019-issue6065.patch | 20 | ||||
-rw-r--r-- | meta-oe/recipes-core/llvm/llvm2.8/30may-llvm2.8-pr399-ppc-arm.patch | 113 | ||||
-rw-r--r-- | meta-oe/recipes-core/llvm/llvm2.8/add-unistd.patch | 12 | ||||
-rw-r--r-- | meta-oe/recipes-core/llvm/llvm2.8/llvm-mc_disable.patch | 12 | ||||
-rw-r--r-- | meta-oe/recipes-core/llvm/llvm2.8_2.8.bb | 21 |
8 files changed, 421 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/llvm/llvm-common.bb b/meta-oe/recipes-core/llvm/llvm-common.bb new file mode 100644 index 000000000..612fd34f7 --- /dev/null +++ b/meta-oe/recipes-core/llvm/llvm-common.bb | |||
@@ -0,0 +1,19 @@ | |||
1 | DESCRIPTION = "Helper script for OE's llvm support" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ | ||
4 | file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \ | ||
5 | " | ||
6 | |||
7 | SRC_URI = "file://llvm-config" | ||
8 | |||
9 | do_install() { | ||
10 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ | ||
11 | install -m 0755 ${WORKDIR}/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ | ||
12 | } | ||
13 | |||
14 | do_install_virtclass-native() { | ||
15 | install -d ${D}${bindir} | ||
16 | install -m 0755 ${WORKDIR}/llvm-config ${D}${bindir} | ||
17 | } | ||
18 | |||
19 | BBCLASSEXTEND = "native" | ||
diff --git a/meta-oe/recipes-core/llvm/llvm-common/llvm-config b/meta-oe/recipes-core/llvm/llvm-common/llvm-config new file mode 100644 index 000000000..a9a416d93 --- /dev/null +++ b/meta-oe/recipes-core/llvm/llvm-common/llvm-config | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/sh | ||
2 | # Wrapper script for real llvm-config. Simply calls | ||
3 | |||
4 | if [ $WANT_LLVM_RELEASE ]; then | ||
5 | exec `dirname $0`/${TARGET_PREFIX}llvm-config$WANT_LLVM_RELEASE ${@} | ||
6 | else | ||
7 | echo "The variable WANT_LLVM_RELEASE is not defined and exported" | ||
8 | echo "by your build recipe. Go figure." | ||
9 | exit 1 | ||
10 | fi | ||
diff --git a/meta-oe/recipes-core/llvm/llvm.inc b/meta-oe/recipes-core/llvm/llvm.inc new file mode 100644 index 000000000..62304959f --- /dev/null +++ b/meta-oe/recipes-core/llvm/llvm.inc | |||
@@ -0,0 +1,214 @@ | |||
1 | # LLVM does not provide ABI stability between different versions. For this | ||
2 | # reason OE makes it possible to build and install different llvm versions | ||
3 | # at the same time. | ||
4 | # | ||
5 | # This is true for the normal recipes as well as the native ones. | ||
6 | # | ||
7 | # All regular installation directories are prefixed with 'llvm${LLVM_RELEASE}' | ||
8 | # e.g. "${STAGING_BINDIR}/llvm2.5" or "${STAGING_INCDIR}/llvm2.5" | ||
9 | # | ||
10 | # For your program or library that makes use of llvm you do should not need to | ||
11 | # modify anything as long as it uses the results of various llvm-config | ||
12 | # invocations. If you need customizations something is wrong and it needs to be | ||
13 | # fixed (report bug). | ||
14 | # | ||
15 | # However the *recipe* for your program/library *must* declare | ||
16 | # export WANT_LLVM_RELEASE = "<valid version number>" | ||
17 | # The version number is picked up by a generic wrapper script which just calls | ||
18 | # the variant of the specified version. | ||
19 | |||
20 | DESCRIPTION = "The Low Level Virtual Machine" | ||
21 | HOMEPAGE = "http://llvm.org" | ||
22 | # 3-clause BSD-like | ||
23 | LICENSE = "NCSA" | ||
24 | LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=0ac5f799a2d89477c75b0a378b221855" | ||
25 | |||
26 | DEPENDS = "llvm${LLVM_RELEASE}-native llvm-common" | ||
27 | DEPENDS_virtclass-native = "llvm-common-native cmake-native" | ||
28 | |||
29 | INC_PR = "r2" | ||
30 | |||
31 | SRC_URI = "http://llvm.org/releases/${PV}/llvm-${PV}.tgz" | ||
32 | |||
33 | S = "${WORKDIR}/llvm-${PV}" | ||
34 | |||
35 | inherit cmake perlnative pythonnative | ||
36 | |||
37 | # Defines the LLVM supported arches. By now we always build either for ${BUILD} | ||
38 | # (native) or ${TARGET}. In the future it may make sense to enable all backends | ||
39 | # for the non-native build. The decision which backends are used is made by | ||
40 | # the 3rd party program or library that uses llvm anyway. | ||
41 | LLVM_ARCH = "${@get_llvm_arch(d)}" | ||
42 | |||
43 | # This is used for generating the install directory for the llvm libraries, | ||
44 | # binaries and headers. It makes side by side installation of those possible. | ||
45 | LLVM_RELEASE = "${PV}" | ||
46 | |||
47 | # llvm *must* be built out of tree | ||
48 | OECMAKE_SOURCEPATH = ".." | ||
49 | OECMAKE_BUILDPATH = "build" | ||
50 | EXTRA_OECMAKE = "\ | ||
51 | -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm${LLVM_RELEASE}/tblgen \ | ||
52 | -DLLVM_TARGETS_TO_BUILD=${LLVM_ARCH} \ | ||
53 | -DCMAKE_LINKER:FILEPATH=${LD} \ | ||
54 | -DCMAKE_AR:FILEPATH=${AR} \ | ||
55 | -DCMAKE_OBJCOPY:FILEPATH=${OBJCOPY} \ | ||
56 | -DCMAKE_OBJDUMP:FILEPATH=${OBJDUMP} \ | ||
57 | -DCMAKE_RANLIB:FILEPATH=${RANLIB} \ | ||
58 | -DCMAKE_STRIP:FILEPATH=${STRIP} \ | ||
59 | -DNM_PATH:FILEPATH=${NM} \ | ||
60 | -DLLVM_ENABLE_PIC:BOOL=ON \ | ||
61 | -DLLVM_TARGET_ARCH:STRING=${LLVM_ARCH} \ | ||
62 | -DLLVM_ENABLE_ASSERTIONS:BOOL=ON \ | ||
63 | -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \ | ||
64 | -DBUILD_SHARED_LIBS:BOOL=ON \ | ||
65 | " | ||
66 | # We need to reset this to avoid breakage as we build out of tree | ||
67 | TOOLCHAIN_OPTIONS = "" | ||
68 | |||
69 | PACKAGES_DYNAMIC = "llvm-*" | ||
70 | |||
71 | # the difference to the non-native build is that we do not need | ||
72 | # to declare the location of the tblgen executable. | ||
73 | EXTRA_OECMAKE_virtclass-native = "\ | ||
74 | -DLLVM_TARGETS_TO_BUILD=${LLVM_ARCH} \ | ||
75 | -DCMAKE_LINKER:FILEPATH=${LD} \ | ||
76 | -DCMAKE_AR:FILEPATH=${AR} \ | ||
77 | -DCMAKE_OBJCOPY:FILEPATH=${OBJCOPY} \ | ||
78 | -DCMAKE_OBJDUMP:FILEPATH=${OBJDUMP} \ | ||
79 | -DCMAKE_RANLIB:FILEPATH=${RANLIB} \ | ||
80 | -DCMAKE_STRIP:FILEPATH=${STRIP} \ | ||
81 | -DNM_PATH:FILEPATH=${NM} \ | ||
82 | " | ||
83 | |||
84 | PACKAGES_virtclass-native = "" | ||
85 | |||
86 | PACKAGES_DYNAMIC_virtclass-native = "" | ||
87 | |||
88 | python populate_packages_prepend () { | ||
89 | libllvm_libdir = bb.data.expand('${libdir}/llvm${LLVM_RELEASE}', d) | ||
90 | do_split_packages(d, libllvm_libdir, '^lib(.*)\.so$', 'libllvm-%s', 'Split package for %s', allow_dirs=True) | ||
91 | } | ||
92 | |||
93 | FILES_${PN} = "" | ||
94 | ALLOW_EMPTY_${PN} = "1" | ||
95 | |||
96 | FILES_${PN}-dbg += "${libdir}/llvm${LLVM_RELEASE}/.debug ${bindir}/llvm${LLVM_RELEASE}/.debug" | ||
97 | |||
98 | FILES_${PN}-dev = " \ | ||
99 | ${includedir} \ | ||
100 | ${bindir}/* \ | ||
101 | ${libdir}/llvm${LLVM_RELEASE}/LLVMHello.so \ | ||
102 | ${libdir}/llvm${LLVM_RELEASE}/BugpointPasses.so \ | ||
103 | ${libdir}/llvm${LLVM_RELEASE}/*.a \ | ||
104 | " | ||
105 | |||
106 | do_install() { | ||
107 | # Install into a private directory to be able to reorganize the files. | ||
108 | |||
109 | cd ${OECMAKE_BUILDPATH} | ||
110 | |||
111 | oe_runmake DESTDIR=${WORKDIR}/llvm-install install | ||
112 | |||
113 | # Create our custom target directories | ||
114 | install -d ${D}${bindir}/llvm${LLVM_RELEASE} | ||
115 | install -d ${D}${includedir}/llvm${LLVM_RELEASE} | ||
116 | install -d ${D}${libdir}/llvm${LLVM_RELEASE} | ||
117 | |||
118 | # Move headers into their own directory | ||
119 | cp -R ${WORKDIR}/llvm-install/${prefix}/include/llvm \ | ||
120 | ${D}${includedir}/llvm${LLVM_RELEASE}/ | ||
121 | cp -R ${WORKDIR}/llvm-install/${prefix}/include/llvm-c \ | ||
122 | ${D}${includedir}/llvm${LLVM_RELEASE}/ | ||
123 | |||
124 | find ${WORKDIR}/llvm-install/${prefix}/lib -name "*" -maxdepth 1 -exec \ | ||
125 | install {} ${D}${libdir}/llvm${LLVM_RELEASE} \; | ||
126 | |||
127 | # I dont know another way out. Binaries are installed into a special subdir | ||
128 | find ${WORKDIR}/llvm-install/${prefix}/bin -name "*" -maxdepth 1 -exec \ | ||
129 | install {} ${D}${bindir}/llvm${LLVM_RELEASE} \; | ||
130 | |||
131 | # LLVM does not install this by default. | ||
132 | install bin/tblgen ${D}${bindir}/llvm${LLVM_RELEASE} | ||
133 | |||
134 | # we install it here unmodified for native and none native and overwrite it | ||
135 | # later for native case | ||
136 | install -d ${D}${bindir} | ||
137 | install -m 0755 bin/llvm-config ${D}${bindir} | ||
138 | |||
139 | # Fix the paths in the config script to make it find the binaries and | ||
140 | # library files. Doing so allows 3rd party configure scripts working | ||
141 | # unmodified. | ||
142 | sed -e's!my.*ABS_RUN_DIR =.*!my $ABS_RUN_DIR = "${STAGING_DIR_TARGET}";!' \ | ||
143 | -e's!my.*INCLUDEDIR =.*!my $INCLUDEDIR = "${STAGING_INCDIR}/llvm${LLVM_RELEASE}";!' \ | ||
144 | -e's!my.*LIBDIR.*!my $LIBDIR = "${STAGING_LIBDIR}/llvm${LLVM_RELEASE}";!' \ | ||
145 | -e's!my.*BINDIR.*!my $BINDIR = "${STAGING_BINDIR}/llvm${LLVM_RELEASE}";!' \ | ||
146 | bin/llvm-config > bin/llvm-config${LLVM_RELEASE} | ||
147 | |||
148 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts} | ||
149 | install -m 0755 bin/llvm-config${LLVM_RELEASE} ${SYSROOT_DESTDIR}${bindir_crossscripts} | ||
150 | } | ||
151 | |||
152 | do_install_virtclass-native() { | ||
153 | # Install into a private directory to be able to reorganize the files. | ||
154 | |||
155 | cd ${OECMAKE_BUILDPATH} | ||
156 | |||
157 | oe_runmake DESTDIR=${WORKDIR}/llvm-install install | ||
158 | |||
159 | # Create our custom target directories | ||
160 | install -d ${D}${bindir}/llvm${LLVM_RELEASE} | ||
161 | install -d ${D}${includedir}/llvm${LLVM_RELEASE} | ||
162 | install -d ${D}${libdir}/llvm${LLVM_RELEASE} | ||
163 | |||
164 | # Move headers into their own directory | ||
165 | cp -R ${WORKDIR}/llvm-install/${prefix}/include/llvm \ | ||
166 | ${D}${includedir}/llvm${LLVM_RELEASE}/ | ||
167 | cp -R ${WORKDIR}/llvm-install/${prefix}/include/llvm-c \ | ||
168 | ${D}${includedir}/llvm${LLVM_RELEASE}/ | ||
169 | |||
170 | find ${WORKDIR}/llvm-install/${prefix}/lib -name "*" -maxdepth 1 -exec \ | ||
171 | install {} ${D}${libdir}/llvm${LLVM_RELEASE} \; | ||
172 | |||
173 | # I dont know another way out. Binaries are installed into a special subdir | ||
174 | find ${WORKDIR}/llvm-install/${prefix}/bin -name "*" -maxdepth 1 -exec \ | ||
175 | install {} ${D}${bindir}/llvm${LLVM_RELEASE} \; | ||
176 | |||
177 | # LLVM does not install this by default. | ||
178 | install bin/tblgen ${D}${bindir}/llvm${LLVM_RELEASE} | ||
179 | |||
180 | # Fix the paths in the config script to make it find the binaries and | ||
181 | # library files. Doing so allows 3rd party configure scripts working | ||
182 | # unmodified. | ||
183 | sed -e's!my.*ABS_RUN_DIR =.*!my $ABS_RUN_DIR = "${STAGING_DIR_TARGET}";!' \ | ||
184 | -e's!my.*INCLUDEDIR =.*!my $INCLUDEDIR = "${STAGING_INCDIR}/llvm${LLVM_RELEASE}";!' \ | ||
185 | -e's!my.*LIBDIR.*!my $LIBDIR = "${STAGING_LIBDIR}/llvm${LLVM_RELEASE}";!' \ | ||
186 | -e's!my.*BINDIR.*!my $BINDIR = "${STAGING_BINDIR}/llvm${LLVM_RELEASE}";!' \ | ||
187 | bin/llvm-config > bin/llvm-config${LLVM_RELEASE} | ||
188 | |||
189 | install -d ${D}${bindir} | ||
190 | install -m 0755 bin/llvm-config${LLVM_RELEASE} ${D}${bindir} | ||
191 | } | ||
192 | |||
193 | |||
194 | # Retrieve the target in a way that is compatible to the arch | ||
195 | # value in llvm (>= 2.5) | ||
196 | def get_llvm_arch(d): | ||
197 | import bb; | ||
198 | |||
199 | arch = bb.data.getVar('TARGET_ARCH', d, 1) | ||
200 | if arch == "x86_64" or arch == "i486" or arch == "i586" or arch == "i686": | ||
201 | arch = "X86" | ||
202 | elif arch == "arm": | ||
203 | arch = "ARM" | ||
204 | elif arch == "mipsel" or arch == "mips": | ||
205 | arch = "mips" | ||
206 | elif arch == "powerpc" or arch == "powerpc64": | ||
207 | arch = "PowerPC" | ||
208 | else: | ||
209 | bb.warn("%s does not support %s yet" % (bb.data.getVar('PN', d, 1), arch) ); | ||
210 | |||
211 | return arch | ||
212 | |||
213 | BBCLASSEXTEND = "native" | ||
214 | |||
diff --git a/meta-oe/recipes-core/llvm/llvm2.8/0019-issue6065.patch b/meta-oe/recipes-core/llvm/llvm2.8/0019-issue6065.patch new file mode 100644 index 000000000..a7f7bbe35 --- /dev/null +++ b/meta-oe/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/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 new file mode 100644 index 000000000..ee5cbafd1 --- /dev/null +++ b/meta-oe/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/meta-oe/recipes-core/llvm/llvm2.8/add-unistd.patch b/meta-oe/recipes-core/llvm/llvm2.8/add-unistd.patch new file mode 100644 index 000000000..1c51b3063 --- /dev/null +++ b/meta-oe/recipes-core/llvm/llvm2.8/add-unistd.patch | |||
@@ -0,0 +1,12 @@ | |||
1 | Index: 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 new file mode 100644 index 000000000..fddc6743e --- /dev/null +++ b/meta-oe/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/meta-oe/recipes-core/llvm/llvm2.8_2.8.bb b/meta-oe/recipes-core/llvm/llvm2.8_2.8.bb new file mode 100644 index 000000000..8dc22e501 --- /dev/null +++ b/meta-oe/recipes-core/llvm/llvm2.8_2.8.bb | |||
@@ -0,0 +1,21 @@ | |||
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 | PR = "${INC_PR}.2" | ||
8 | |||
9 | SRC_URI += " \ | ||
10 | file://30may-llvm2.8-pr399-ppc-arm.patch \ | ||
11 | file://0019-issue6065.patch \ | ||
12 | file://add-unistd.patch \ | ||
13 | file://llvm-mc_disable.patch \ | ||
14 | " | ||
15 | |||
16 | LLVM_RELEASE = "2.8" | ||
17 | |||
18 | EXTRA_OECMAKE += " -DBUILD_SHARED_LIBS:BOOL=OFF " | ||
19 | |||
20 | SRC_URI[md5sum] = "220d361b4d17051ff4bb21c64abe05ba" | ||
21 | SRC_URI[sha256sum] = "25addb742f1c6cc12877ed0ee924dda962d848368ee095be8e48342ae613d43b" | ||