1 |
commit: 42104d4521488464d34875597f39e6cda3f1d074 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jun 2 16:41:54 2012 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jun 2 16:41:54 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/x11.git;a=commit;h=42104d45 |
7 |
|
8 |
sys-devel/clang: Add a patched version of clang-3.1 for r600 OpenCL. |
9 |
|
10 |
(Portage version: 2.2.0_alpha108_p12/git/Linux x86_64, unsigned Manifest commit) |
11 |
|
12 |
--- |
13 |
sys-devel/clang/clang-3.1-r2.ebuild | 204 ++++++++++++++++++++ |
14 |
.../cl-patches/0001-Add-r600-TargetInfo.patch | 100 ++++++++++ |
15 |
.../0002-r600-Add-some-target-builtins.patch | 111 +++++++++++ |
16 |
...ad_global_size-and-read_local_size-builti.patch | 31 +++ |
17 |
sys-devel/clang/files/clang-2.7-fixdoc.patch | 53 +++++ |
18 |
.../files/clang-3.1-fix_cxx_include_root.patch | 21 ++ |
19 |
.../clang-3.1-gentoo-freebsd-fix-cxx-paths.patch | 187 ++++++++++++++++++ |
20 |
.../clang-3.1-gentoo-freebsd-fix-lib-path.patch | 12 ++ |
21 |
.../clang-3.1-gentoo-linux-fix-cxx-include.patch | 13 ++ |
22 |
.../clang-3.1-gentoo-runtime-gcc-detection.patch | 26 +++ |
23 |
...clang-3.1-increase-parser-recursion-limit.patch | 15 ++ |
24 |
sys-devel/clang/metadata.xml | 39 ++++ |
25 |
12 files changed, 812 insertions(+), 0 deletions(-) |
26 |
|
27 |
diff --git a/sys-devel/clang/clang-3.1-r2.ebuild b/sys-devel/clang/clang-3.1-r2.ebuild |
28 |
new file mode 100644 |
29 |
index 0000000..673aec7 |
30 |
--- /dev/null |
31 |
+++ b/sys-devel/clang/clang-3.1-r2.ebuild |
32 |
@@ -0,0 +1,204 @@ |
33 |
+# Copyright 1999-2012 Gentoo Foundation |
34 |
+# Distributed under the terms of the GNU General Public License v2 |
35 |
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-3.1-r2.ebuild,v 1.3 2012/05/26 17:44:24 aballier Exp $ |
36 |
+ |
37 |
+EAPI=4 |
38 |
+ |
39 |
+RESTRICT_PYTHON_ABIS="3.*" |
40 |
+SUPPORT_PYTHON_ABIS="1" |
41 |
+ |
42 |
+inherit eutils multilib python |
43 |
+ |
44 |
+DESCRIPTION="C language family frontend for LLVM" |
45 |
+HOMEPAGE="http://clang.llvm.org/" |
46 |
+# Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=4840 |
47 |
+SRC_URI="http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz |
48 |
+ http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.gz |
49 |
+ http://llvm.org/releases/${PV}/${P}.src.tar.gz" |
50 |
+ |
51 |
+LICENSE="UoI-NCSA" |
52 |
+SLOT="0" |
53 |
+KEYWORDS="~amd64 ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos" |
54 |
+IUSE="debug kernel_FreeBSD multitarget +static-analyzer test" |
55 |
+ |
56 |
+DEPEND="static-analyzer? ( dev-lang/perl )" |
57 |
+RDEPEND="~sys-devel/llvm-${PV}[multitarget=]" |
58 |
+ |
59 |
+S=${WORKDIR}/llvm-${PV}.src |
60 |
+ |
61 |
+src_prepare() { |
62 |
+ mv "${WORKDIR}"/clang-${PV}.src "${S}"/tools/clang \ |
63 |
+ || die "clang source directory move failed" |
64 |
+ mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \ |
65 |
+ || die "compiler-rt source directory move failed" |
66 |
+ |
67 |
+ # Same as llvm doc patches |
68 |
+ epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch |
69 |
+ |
70 |
+ # multilib-strict |
71 |
+ sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \ |
72 |
+ -i tools/clang/lib/Headers/Makefile \ |
73 |
+ || die "clang Makefile failed" |
74 |
+ sed -e "/PROJ_resources/s#lib/clang#$(get_libdir)/clang#" \ |
75 |
+ -i tools/clang/runtime/compiler-rt/Makefile \ |
76 |
+ || die "compiler-rt Makefile failed" |
77 |
+ # fix the static analyzer for in-tree install |
78 |
+ sed -e 's/import ScanView/from clang \0/' \ |
79 |
+ -i tools/clang/tools/scan-view/scan-view \ |
80 |
+ || die "scan-view sed failed" |
81 |
+ sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${PN}#" \ |
82 |
+ -i tools/clang/tools/scan-build/scan-build \ |
83 |
+ || die "scan-build sed failed" |
84 |
+ # Set correct path for gold plugin |
85 |
+ sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \ |
86 |
+ -i tools/clang/lib/Driver/Tools.cpp \ |
87 |
+ || die "gold plugin path sed failed" |
88 |
+ # Specify python version |
89 |
+ python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view |
90 |
+ python_convert_shebangs -r 2 test/Scripts |
91 |
+ python_convert_shebangs 2 projects/compiler-rt/lib/asan/scripts/asan_symbolize.py |
92 |
+ |
93 |
+ # From llvm src_prepare |
94 |
+ einfo "Fixing install dirs" |
95 |
+ sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \ |
96 |
+ -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ |
97 |
+ -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/llvm, \ |
98 |
+ -i Makefile.config.in || die "Makefile.config sed failed" |
99 |
+ |
100 |
+ einfo "Fixing rpath and CFLAGS" |
101 |
+ sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/llvm, \ |
102 |
+ -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ |
103 |
+ -i Makefile.rules || die "rpath sed failed" |
104 |
+ |
105 |
+ # Use system llc (from llvm ebuild) for tests |
106 |
+ sed -e "/^llc_props =/s/os.path.join(llvm_tools_dir, 'llc')/'llc'/" \ |
107 |
+ -i tools/clang/test/lit.cfg || die "test path sed failed" |
108 |
+ |
109 |
+ # Automatically select active system GCC's libraries, bug #406163 |
110 |
+ epatch "${FILESDIR}"/${P}-gentoo-runtime-gcc-detection.patch |
111 |
+ |
112 |
+ # Fix search paths on FreeBSD, bug #409269 |
113 |
+ epatch "${FILESDIR}"/${P}-gentoo-freebsd-fix-lib-path.patch |
114 |
+ |
115 |
+ # Fix regression caused by removal of USE=system-cxx-headers, bug #417541 |
116 |
+ epatch "${FILESDIR}"/${P}-gentoo-freebsd-fix-cxx-paths.patch |
117 |
+ |
118 |
+ # Fix regression that prevents Clang from building itself on Linux, bug #417537 |
119 |
+ epatch "${FILESDIR}"/${P}-gentoo-linux-fix-cxx-include.patch |
120 |
+ |
121 |
+ # Increase recursion limit, bug #417545, upstream r155737 |
122 |
+ epatch "${FILESDIR}"/${P}-increase-parser-recursion-limit.patch |
123 |
+ |
124 |
+ # Apply r600 OpenCL-related patches |
125 |
+ pushd tools/clang &>/dev/null || die |
126 |
+ epatch "${FILESDIR}"/cl-patches/*.patch |
127 |
+ popd &>/dev/null || die |
128 |
+ |
129 |
+ # User patches |
130 |
+ epatch_user |
131 |
+} |
132 |
+ |
133 |
+src_configure() { |
134 |
+ local CONF_FLAGS="--enable-shared |
135 |
+ --with-optimize-option= |
136 |
+ $(use_enable !debug optimized) |
137 |
+ $(use_enable debug assertions) |
138 |
+ $(use_enable debug expensive-checks)" |
139 |
+ |
140 |
+ # Setup the search path to include the Prefix includes |
141 |
+ if use prefix ; then |
142 |
+ CONF_FLAGS="${CONF_FLAGS} \ |
143 |
+ --with-c-include-dirs=${EPREFIX}/usr/include:/usr/include" |
144 |
+ fi |
145 |
+ |
146 |
+ if use multitarget; then |
147 |
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" |
148 |
+ else |
149 |
+ CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only" |
150 |
+ fi |
151 |
+ |
152 |
+ if use amd64; then |
153 |
+ CONF_FLAGS="${CONF_FLAGS} --enable-pic" |
154 |
+ fi |
155 |
+ |
156 |
+ econf ${CONF_FLAGS} |
157 |
+} |
158 |
+ |
159 |
+src_compile() { |
160 |
+ emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 clang-only |
161 |
+} |
162 |
+ |
163 |
+src_test() { |
164 |
+ cd "${S}"/test || die "cd failed" |
165 |
+ emake site.exp |
166 |
+ |
167 |
+ cd "${S}"/tools/clang || die "cd clang failed" |
168 |
+ |
169 |
+ echo ">>> Test phase [test]: ${CATEGORY}/${PF}" |
170 |
+ |
171 |
+ testing() { |
172 |
+ if ! emake -j1 VERBOSE=1 test; then |
173 |
+ has test $FEATURES && die "Make test failed. See above for details." |
174 |
+ has test $FEATURES || eerror "Make test failed. See above for details." |
175 |
+ fi |
176 |
+ } |
177 |
+ python_execute_function testing |
178 |
+} |
179 |
+ |
180 |
+src_install() { |
181 |
+ cd "${S}"/tools/clang || die "cd clang failed" |
182 |
+ emake KEEP_SYMBOLS=1 DESTDIR="${D}" install |
183 |
+ |
184 |
+ if use static-analyzer ; then |
185 |
+ dobin tools/scan-build/ccc-analyzer |
186 |
+ dosym ccc-analyzer /usr/bin/c++-analyzer |
187 |
+ dobin tools/scan-build/scan-build |
188 |
+ |
189 |
+ insinto /usr/share/${PN} |
190 |
+ doins tools/scan-build/scanview.css |
191 |
+ doins tools/scan-build/sorttable.js |
192 |
+ |
193 |
+ cd tools/scan-view || die "cd scan-view failed" |
194 |
+ dobin scan-view |
195 |
+ install-scan-view() { |
196 |
+ insinto "$(python_get_sitedir)"/clang |
197 |
+ doins Reporter.py Resources ScanView.py startfile.py |
198 |
+ touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py |
199 |
+ } |
200 |
+ python_execute_function install-scan-view |
201 |
+ fi |
202 |
+ |
203 |
+ # Fix install_names on Darwin. The build system is too complicated |
204 |
+ # to just fix this, so we correct it post-install |
205 |
+ if [[ ${CHOST} == *-darwin* ]] ; then |
206 |
+ for lib in libclang.dylib ; do |
207 |
+ ebegin "fixing install_name of $lib" |
208 |
+ install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \ |
209 |
+ "${ED}"/usr/lib/llvm/${lib} |
210 |
+ eend $? |
211 |
+ done |
212 |
+ for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do |
213 |
+ ebegin "fixing references in ${f##*/}" |
214 |
+ install_name_tool \ |
215 |
+ -change "@rpath/libclang.dylib" \ |
216 |
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ |
217 |
+ -change "@executable_path/../lib/libLLVM-${PV}.dylib" \ |
218 |
+ "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \ |
219 |
+ -change "${S}"/Release/lib/libclang.dylib \ |
220 |
+ "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ |
221 |
+ "${ED}"/$f |
222 |
+ eend $? |
223 |
+ done |
224 |
+ fi |
225 |
+ |
226 |
+ # Remove unnecessary headers on FreeBSD, bug #417171 |
227 |
+ use kernel_FreeBSD && rm "${ED}"usr/$(get_libdir)/clang/${PV}/include/{arm_neon,std,float,iso,limits,tgmath,varargs}*.h |
228 |
+} |
229 |
+ |
230 |
+pkg_postinst() { |
231 |
+ python_mod_optimize clang |
232 |
+} |
233 |
+ |
234 |
+pkg_postrm() { |
235 |
+ python_mod_cleanup clang |
236 |
+} |
237 |
|
238 |
diff --git a/sys-devel/clang/files/cl-patches/0001-Add-r600-TargetInfo.patch b/sys-devel/clang/files/cl-patches/0001-Add-r600-TargetInfo.patch |
239 |
new file mode 100644 |
240 |
index 0000000..929b5d3 |
241 |
--- /dev/null |
242 |
+++ b/sys-devel/clang/files/cl-patches/0001-Add-r600-TargetInfo.patch |
243 |
@@ -0,0 +1,100 @@ |
244 |
+From 70cae83ffd093f183dec07c464db3c0bb6b92c10 Mon Sep 17 00:00:00 2001 |
245 |
+From: Tom Stellard <thomas.stellard@×××.com> |
246 |
+Date: Fri, 2 Mar 2012 10:54:52 -0500 |
247 |
+Subject: [PATCH 1/3] Add r600 TargetInfo |
248 |
+ |
249 |
+--- |
250 |
+ lib/Basic/Targets.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ |
251 |
+ 1 files changed, 70 insertions(+), 0 deletions(-) |
252 |
+ |
253 |
+diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp |
254 |
+index 85dfd78..64dc01c 100644 |
255 |
+--- a/lib/Basic/Targets.cpp |
256 |
++++ b/lib/Basic/Targets.cpp |
257 |
+@@ -1068,6 +1068,73 @@ namespace { |
258 |
+ } |
259 |
+ |
260 |
+ namespace { |
261 |
++ |
262 |
++class AMDGPUTargetInfo : public TargetInfo { |
263 |
++public: |
264 |
++ |
265 |
++ AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { } |
266 |
++ |
267 |
++ virtual const char * getClobbers() const { |
268 |
++ return ""; |
269 |
++ } |
270 |
++ |
271 |
++ virtual void getGCCRegNames(const char * const *&Names, |
272 |
++ unsigned &numNames) const { |
273 |
++ Names = NULL; |
274 |
++ numNames = 0; |
275 |
++ } |
276 |
++ |
277 |
++ virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, |
278 |
++ unsigned &NumAliases) const { |
279 |
++ Aliases = NULL; |
280 |
++ NumAliases = 0; |
281 |
++ } |
282 |
++ |
283 |
++ virtual bool validateAsmConstraint(const char *&Name, |
284 |
++ TargetInfo::ConstraintInfo &info) const { |
285 |
++ return true; |
286 |
++ } |
287 |
++ |
288 |
++ virtual void getTargetBuiltins(const Builtin::Info *&Records, |
289 |
++ unsigned &NumRecords) const { |
290 |
++ Records = NULL; |
291 |
++ NumRecords = 0; |
292 |
++ } |
293 |
++}; |
294 |
++ |
295 |
++ |
296 |
++static const unsigned R600AddrSpaceMap[] = { |
297 |
++ 1, // opencl_global |
298 |
++ 3, // opencl_local |
299 |
++ 2 // opencl_constant |
300 |
++}; |
301 |
++ |
302 |
++class R600TargetInfo : public AMDGPUTargetInfo { |
303 |
++public: |
304 |
++ R600TargetInfo(const std::string& triple) : AMDGPUTargetInfo(triple) { |
305 |
++ DescriptionString = |
306 |
++ "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" |
307 |
++ "-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:32:32" |
308 |
++ "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64" |
309 |
++ "-v96:128:128-v128:128:128-v192:256:256-v256:256:256" |
310 |
++ "-v512:512:512-v1024:1024:1024-v2048:2048:2048" |
311 |
++ "-n8:16:32:64"; |
312 |
++ AddrSpaceMap = &R600AddrSpaceMap; |
313 |
++ } |
314 |
++ |
315 |
++ virtual void getTargetDefines(const LangOptions &Opts, |
316 |
++ MacroBuilder &Builder) const { |
317 |
++ Builder.defineMacro("__R600__"); |
318 |
++ } |
319 |
++ |
320 |
++ virtual const char * getVAListDeclaration() const { |
321 |
++ return ""; |
322 |
++ } |
323 |
++}; |
324 |
++ |
325 |
++} // end anonymous namespace |
326 |
++ |
327 |
++namespace { |
328 |
+ // MBlaze abstract base class |
329 |
+ class MBlazeTargetInfo : public TargetInfo { |
330 |
+ static const char * const GCCRegNames[]; |
331 |
+@@ -3963,6 +4030,9 @@ static TargetInfo *AllocateTarget(const std::string &T) { |
332 |
+ case llvm::Triple::mblaze: |
333 |
+ return new MBlazeTargetInfo(T); |
334 |
+ |
335 |
++ case llvm::Triple::r600: |
336 |
++ return new R600TargetInfo(T); |
337 |
++ |
338 |
+ case llvm::Triple::sparc: |
339 |
+ switch (os) { |
340 |
+ case llvm::Triple::Linux: |
341 |
+-- |
342 |
+1.7.7.6 |
343 |
+ |
344 |
|
345 |
diff --git a/sys-devel/clang/files/cl-patches/0002-r600-Add-some-target-builtins.patch b/sys-devel/clang/files/cl-patches/0002-r600-Add-some-target-builtins.patch |
346 |
new file mode 100644 |
347 |
index 0000000..0003a8d |
348 |
--- /dev/null |
349 |
+++ b/sys-devel/clang/files/cl-patches/0002-r600-Add-some-target-builtins.patch |
350 |
@@ -0,0 +1,111 @@ |
351 |
+From a014573ad193775b2301e39275a1ca0ac3bb5847 Mon Sep 17 00:00:00 2001 |
352 |
+From: Tom Stellard <thomas.stellard@×××.com> |
353 |
+Date: Tue, 13 Mar 2012 13:54:51 -0400 |
354 |
+Subject: [PATCH 2/3] r600: Add some target builtins |
355 |
+ |
356 |
+--- |
357 |
+ include/clang/Basic/BuiltinsR600.def | 32 ++++++++++++++++++++++++++++++++ |
358 |
+ include/clang/Basic/TargetBuiltins.h | 10 ++++++++++ |
359 |
+ lib/Basic/Targets.cpp | 12 ++++++++++-- |
360 |
+ 3 files changed, 52 insertions(+), 2 deletions(-) |
361 |
+ create mode 100644 include/clang/Basic/BuiltinsR600.def |
362 |
+ |
363 |
+diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/BuiltinsR600.def |
364 |
+new file mode 100644 |
365 |
+index 0000000..ce1f30e |
366 |
+--- /dev/null |
367 |
++++ b/include/clang/Basic/BuiltinsR600.def |
368 |
+@@ -0,0 +1,32 @@ |
369 |
++//===--- BuiltinsR600.def - R600 Builtin function database -- --*- C++ -*-===// |
370 |
++// |
371 |
++// The LLVM Compiler Infrastructure |
372 |
++// |
373 |
++// This file is distributed under the University of Illinois Open Source |
374 |
++// License. See LICENSE.TXT for details. |
375 |
++// |
376 |
++//===----------------------------------------------------------------------===// |
377 |
++// |
378 |
++// This file defines the R600-specific builtin function database. Users of |
379 |
++// this file must define the BUILTIN macro to make use of this information. |
380 |
++// |
381 |
++//===----------------------------------------------------------------------===// |
382 |
++// |
383 |
++// Authors: Tom Stellard <thomas.stellard@×××.com> |
384 |
++// |
385 |
++ |
386 |
++// The format of this database matches clang/Basic/Builtins.def. |
387 |
++ |
388 |
++BUILTIN(__builtin_r600_read_ngroups_x, "z", "nc") |
389 |
++BUILTIN(__builtin_r600_read_ngroups_y, "z", "nc") |
390 |
++BUILTIN(__builtin_r600_read_ngroups_z, "z", "nc") |
391 |
++ |
392 |
++BUILTIN(__builtin_r600_read_tidig_x, "z", "nc") |
393 |
++BUILTIN(__builtin_r600_read_tidig_y, "z", "nc") |
394 |
++BUILTIN(__builtin_r600_read_tidig_z, "z", "nc") |
395 |
++ |
396 |
++BUILTIN(__builtin_r600_read_tgid_x, "z", "nc") |
397 |
++BUILTIN(__builtin_r600_read_tgid_y, "z", "nc") |
398 |
++BUILTIN(__builtin_r600_read_tgid_z, "z", "nc") |
399 |
++ |
400 |
++#undef BUILTIN |
401 |
+diff --git a/include/clang/Basic/TargetBuiltins.h b/include/clang/Basic/TargetBuiltins.h |
402 |
+index 7c04bf7..3460cd5 100644 |
403 |
+--- a/include/clang/Basic/TargetBuiltins.h |
404 |
++++ b/include/clang/Basic/TargetBuiltins.h |
405 |
+@@ -45,6 +45,16 @@ namespace clang { |
406 |
+ }; |
407 |
+ } |
408 |
+ |
409 |
++ /// R600 builtins |
410 |
++ namespace R600 { |
411 |
++ enum { |
412 |
++ LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, |
413 |
++#define BUILTIN(ID, TYPE, ATTRS) BI##ID, |
414 |
++#include "clang/Basic/BuiltinsR600.def" |
415 |
++ LastTSBuiltin |
416 |
++ }; |
417 |
++ } |
418 |
++ |
419 |
+ |
420 |
+ /// X86 builtins |
421 |
+ namespace X86 { |
422 |
+diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp |
423 |
+index 64dc01c..03f1a18 100644 |
424 |
+--- a/lib/Basic/Targets.cpp |
425 |
++++ b/lib/Basic/Targets.cpp |
426 |
+@@ -1070,6 +1070,7 @@ namespace { |
427 |
+ namespace { |
428 |
+ |
429 |
+ class AMDGPUTargetInfo : public TargetInfo { |
430 |
++ static const Builtin::Info BuiltinInfo[]; |
431 |
+ public: |
432 |
+ |
433 |
+ AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { } |
434 |
+@@ -1097,8 +1098,8 @@ public: |
435 |
+ |
436 |
+ virtual void getTargetBuiltins(const Builtin::Info *&Records, |
437 |
+ unsigned &NumRecords) const { |
438 |
+- Records = NULL; |
439 |
+- NumRecords = 0; |
440 |
++ Records = BuiltinInfo; |
441 |
++ NumRecords = clang::R600::LastTSBuiltin-Builtin::FirstTSBuiltin; |
442 |
+ } |
443 |
+ }; |
444 |
+ |
445 |
+@@ -1132,6 +1133,13 @@ public: |
446 |
+ } |
447 |
+ }; |
448 |
+ |
449 |
++const Builtin::Info AMDGPUTargetInfo::BuiltinInfo[] = { |
450 |
++#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES }, |
451 |
++#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,\ |
452 |
++ ALL_LANGUAGES }, |
453 |
++#include "clang/Basic/BuiltinsR600.def" |
454 |
++}; |
455 |
++ |
456 |
+ } // end anonymous namespace |
457 |
+ |
458 |
+ namespace { |
459 |
+-- |
460 |
+1.7.7.6 |
461 |
+ |
462 |
|
463 |
diff --git a/sys-devel/clang/files/cl-patches/0003-r600-Add-read_global_size-and-read_local_size-builti.patch b/sys-devel/clang/files/cl-patches/0003-r600-Add-read_global_size-and-read_local_size-builti.patch |
464 |
new file mode 100644 |
465 |
index 0000000..e0c2d3b |
466 |
--- /dev/null |
467 |
+++ b/sys-devel/clang/files/cl-patches/0003-r600-Add-read_global_size-and-read_local_size-builti.patch |
468 |
@@ -0,0 +1,31 @@ |
469 |
+From 2881b8189dcacc8ab6a336f0e107d72752c8c47e Mon Sep 17 00:00:00 2001 |
470 |
+From: Tom Stellard <thomas.stellard@×××.com> |
471 |
+Date: Wed, 14 Mar 2012 11:20:08 -0400 |
472 |
+Subject: [PATCH 3/3] r600: Add read_global_size and read_local_size builtins |
473 |
+ |
474 |
+--- |
475 |
+ include/clang/Basic/BuiltinsR600.def | 8 ++++++++ |
476 |
+ 1 files changed, 8 insertions(+), 0 deletions(-) |
477 |
+ |
478 |
+diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/BuiltinsR600.def |
479 |
+index ce1f30e..c81758e 100644 |
480 |
+--- a/include/clang/Basic/BuiltinsR600.def |
481 |
++++ b/include/clang/Basic/BuiltinsR600.def |
482 |
+@@ -17,6 +17,14 @@ |
483 |
+ |
484 |
+ // The format of this database matches clang/Basic/Builtins.def. |
485 |
+ |
486 |
++BUILTIN(__builtin_r600_read_global_size_x, "z", "nc") |
487 |
++BUILTIN(__builtin_r600_read_global_size_y, "z", "nc") |
488 |
++BUILTIN(__builtin_r600_read_global_size_z, "z", "nc") |
489 |
++ |
490 |
++BUILTIN(__builtin_r600_read_local_size_x, "z", "nc") |
491 |
++BUILTIN(__builtin_r600_read_local_size_y, "z", "nc") |
492 |
++BUILTIN(__builtin_r600_read_local_size_z, "z", "nc") |
493 |
++ |
494 |
+ BUILTIN(__builtin_r600_read_ngroups_x, "z", "nc") |
495 |
+ BUILTIN(__builtin_r600_read_ngroups_y, "z", "nc") |
496 |
+ BUILTIN(__builtin_r600_read_ngroups_z, "z", "nc") |
497 |
+-- |
498 |
+1.7.7.6 |
499 |
+ |
500 |
|
501 |
diff --git a/sys-devel/clang/files/clang-2.7-fixdoc.patch b/sys-devel/clang/files/clang-2.7-fixdoc.patch |
502 |
new file mode 100644 |
503 |
index 0000000..8058ec4 |
504 |
--- /dev/null |
505 |
+++ b/sys-devel/clang/files/clang-2.7-fixdoc.patch |
506 |
@@ -0,0 +1,53 @@ |
507 |
+diff -Naur llvm-2.7.orig//tools/clang/docs/Makefile llvm-2.7/tools/clang/docs/Makefile |
508 |
+--- llvm-2.7.orig//tools/clang/docs/Makefile 2010-04-26 18:38:45.000000000 +0200 |
509 |
++++ llvm-2.7/tools/clang/docs/Makefile 2010-04-26 18:41:08.000000000 +0200 |
510 |
+@@ -46,13 +46,12 @@ |
511 |
+ # 'make generated BUILD_FOR_WEBSITE=1' |
512 |
+ generated:: doxygen |
513 |
+ |
514 |
+-install-html: $(PROJ_OBJ_DIR)/html.tar.gz |
515 |
++install-html: |
516 |
+ $(Echo) Installing HTML documentation |
517 |
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html |
518 |
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img |
519 |
+ $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html |
520 |
+ # $(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img |
521 |
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir) |
522 |
+ |
523 |
+ $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML) |
524 |
+ $(Echo) Packaging HTML documentation |
525 |
+@@ -64,12 +63,11 @@ |
526 |
+ install-doxygen: doxygen |
527 |
+ $(Echo) Installing doxygen documentation |
528 |
+ $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen |
529 |
+- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir) |
530 |
+ $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \ |
531 |
+ $(FIND) . -type f -exec \ |
532 |
+ $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \; |
533 |
+ |
534 |
+-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz |
535 |
++doxygen: regendoc |
536 |
+ |
537 |
+ regendoc: |
538 |
+ $(Echo) Building doxygen documentation |
539 |
+diff -Naur llvm-2.7.orig//tools/clang/docs/tools/Makefile llvm-2.7/tools/clang/docs/tools/Makefile |
540 |
+--- llvm-2.7.orig//tools/clang/docs/tools/Makefile 2010-04-26 18:38:45.000000000 +0200 |
541 |
++++ llvm-2.7/tools/clang/docs/tools/Makefile 2010-04-26 18:41:29.000000000 +0200 |
542 |
+@@ -24,7 +24,7 @@ |
543 |
+ CLANG_VERSION := trunk |
544 |
+ |
545 |
+ # If we are in BUILD_FOR_WEBSITE mode, default to the all target. |
546 |
+-all:: html man ps |
547 |
++all:: html man |
548 |
+ |
549 |
+ clean: |
550 |
+ rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS) |
551 |
+@@ -58,7 +58,7 @@ |
552 |
+ ifdef ONLY_MAN_DOCS |
553 |
+ INSTALL_TARGETS := install-man |
554 |
+ else |
555 |
+-INSTALL_TARGETS := install-html install-man install-ps |
556 |
++INSTALL_TARGETS := install-html install-man |
557 |
+ endif |
558 |
+ |
559 |
+ .SUFFIXES: |
560 |
|
561 |
diff --git a/sys-devel/clang/files/clang-3.1-fix_cxx_include_root.patch b/sys-devel/clang/files/clang-3.1-fix_cxx_include_root.patch |
562 |
new file mode 100644 |
563 |
index 0000000..e7c5251 |
564 |
--- /dev/null |
565 |
+++ b/sys-devel/clang/files/clang-3.1-fix_cxx_include_root.patch |
566 |
@@ -0,0 +1,21 @@ |
567 |
+Bug #387309 |
568 |
+ |
569 |
+--- llvm/tools/clang/lib/Driver/ToolChains.cpp.orig 2011-11-09 23:10:04.000000000 +0100 |
570 |
++++ llvm/tools/clang/lib/Driver/ToolChains.cpp 2011-11-09 23:11:04.000000000 +0100 |
571 |
+@@ -1586,12 +1586,13 @@ |
572 |
+ // This is of the form /foo/bar/include/c++/4.5.2/ |
573 |
+ if (CxxIncludeRoot.back() == '/') |
574 |
+ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the / |
575 |
++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the g++-v4 |
576 |
++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the include |
577 |
+ StringRef Version = llvm::sys::path::filename(CxxIncludeRoot); |
578 |
+ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the version |
579 |
+- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the c++ |
580 |
+- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the include |
581 |
++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the ARCH |
582 |
+ GCCInstallPath = CxxIncludeRoot.str(); |
583 |
+- GCCInstallPath.append("/lib/gcc/"); |
584 |
++ GCCInstallPath.append("/"); |
585 |
+ GCCInstallPath.append(CXX_INCLUDE_ARCH); |
586 |
+ GCCInstallPath.append("/"); |
587 |
+ GCCInstallPath.append(Version); |
588 |
|
589 |
diff --git a/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths.patch b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths.patch |
590 |
new file mode 100644 |
591 |
index 0000000..987aa22 |
592 |
--- /dev/null |
593 |
+++ b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths.patch |
594 |
@@ -0,0 +1,187 @@ |
595 |
+diff --git a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp |
596 |
+index 1e282f2..1d6835b 100644 |
597 |
+--- a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp |
598 |
++++ b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp |
599 |
+@@ -2305,6 +2305,161 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, |
600 |
+ } |
601 |
+ } |
602 |
+ |
603 |
++void FreeBSD::AddClangSystemIncludeArgs(const ArgList &DriverArgs, |
604 |
++ ArgStringList &CC1Args) const { |
605 |
++ const Driver &D = getDriver(); |
606 |
++ |
607 |
++ if (DriverArgs.hasArg(options::OPT_nostdinc)) |
608 |
++ return; |
609 |
++ |
610 |
++ if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) |
611 |
++ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/local/include"); |
612 |
++ |
613 |
++ if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { |
614 |
++ llvm::sys::Path P(D.ResourceDir); |
615 |
++ P.appendComponent("include"); |
616 |
++ addSystemInclude(DriverArgs, CC1Args, P.str()); |
617 |
++ } |
618 |
++ |
619 |
++ if (DriverArgs.hasArg(options::OPT_nostdlibinc)) |
620 |
++ return; |
621 |
++ |
622 |
++ // Check for configure-time C include directories. |
623 |
++ StringRef CIncludeDirs(C_INCLUDE_DIRS); |
624 |
++ if (CIncludeDirs != "") { |
625 |
++ SmallVector<StringRef, 5> dirs; |
626 |
++ CIncludeDirs.split(dirs, ":"); |
627 |
++ for (SmallVectorImpl<StringRef>::iterator I = dirs.begin(), E = dirs.end(); |
628 |
++ I != E; ++I) { |
629 |
++ StringRef Prefix = llvm::sys::path::is_absolute(*I) ? D.SysRoot : ""; |
630 |
++ addExternCSystemInclude(DriverArgs, CC1Args, Prefix + *I); |
631 |
++ } |
632 |
++ return; |
633 |
++ } |
634 |
++ |
635 |
++ // Lacking those, try to detect the correct set of system includes for the |
636 |
++ // target triple. |
637 |
++ |
638 |
++ // Implement generic Debian multiarch support. |
639 |
++ const StringRef X86_64MultiarchIncludeDirs[] = { |
640 |
++ "/usr/include/x86_64-linux-gnu", |
641 |
++ |
642 |
++ // FIXME: These are older forms of multiarch. It's not clear that they're |
643 |
++ // in use in any released version of Debian, so we should consider |
644 |
++ // removing them. |
645 |
++ "/usr/include/i686-linux-gnu/64", |
646 |
++ "/usr/include/i486-linux-gnu/64" |
647 |
++ }; |
648 |
++ const StringRef X86MultiarchIncludeDirs[] = { |
649 |
++ "/usr/include/i386-linux-gnu", |
650 |
++ |
651 |
++ // FIXME: These are older forms of multiarch. It's not clear that they're |
652 |
++ // in use in any released version of Debian, so we should consider |
653 |
++ // removing them. |
654 |
++ "/usr/include/x86_64-linux-gnu/32", |
655 |
++ "/usr/include/i686-linux-gnu", |
656 |
++ "/usr/include/i486-linux-gnu" |
657 |
++ }; |
658 |
++ const StringRef ARMMultiarchIncludeDirs[] = { |
659 |
++ "/usr/include/arm-linux-gnueabi" |
660 |
++ }; |
661 |
++ const StringRef MIPSMultiarchIncludeDirs[] = { |
662 |
++ "/usr/include/mips-linux-gnu" |
663 |
++ }; |
664 |
++ const StringRef MIPSELMultiarchIncludeDirs[] = { |
665 |
++ "/usr/include/mipsel-linux-gnu" |
666 |
++ }; |
667 |
++ const StringRef PPCMultiarchIncludeDirs[] = { |
668 |
++ "/usr/include/powerpc-linux-gnu" |
669 |
++ }; |
670 |
++ const StringRef PPC64MultiarchIncludeDirs[] = { |
671 |
++ "/usr/include/powerpc64-linux-gnu" |
672 |
++ }; |
673 |
++ ArrayRef<StringRef> MultiarchIncludeDirs; |
674 |
++ if (getTriple().getArch() == llvm::Triple::x86_64) { |
675 |
++ MultiarchIncludeDirs = X86_64MultiarchIncludeDirs; |
676 |
++ } else if (getTriple().getArch() == llvm::Triple::x86) { |
677 |
++ MultiarchIncludeDirs = X86MultiarchIncludeDirs; |
678 |
++ } else if (getTriple().getArch() == llvm::Triple::arm) { |
679 |
++ MultiarchIncludeDirs = ARMMultiarchIncludeDirs; |
680 |
++ } else if (getTriple().getArch() == llvm::Triple::mips) { |
681 |
++ MultiarchIncludeDirs = MIPSMultiarchIncludeDirs; |
682 |
++ } else if (getTriple().getArch() == llvm::Triple::mipsel) { |
683 |
++ MultiarchIncludeDirs = MIPSELMultiarchIncludeDirs; |
684 |
++ } else if (getTriple().getArch() == llvm::Triple::ppc) { |
685 |
++ MultiarchIncludeDirs = PPCMultiarchIncludeDirs; |
686 |
++ } else if (getTriple().getArch() == llvm::Triple::ppc64) { |
687 |
++ MultiarchIncludeDirs = PPC64MultiarchIncludeDirs; |
688 |
++ } |
689 |
++ for (ArrayRef<StringRef>::iterator I = MultiarchIncludeDirs.begin(), |
690 |
++ E = MultiarchIncludeDirs.end(); |
691 |
++ I != E; ++I) { |
692 |
++ if (llvm::sys::fs::exists(D.SysRoot + *I)) { |
693 |
++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + *I); |
694 |
++ break; |
695 |
++ } |
696 |
++ } |
697 |
++ |
698 |
++ if (getTriple().getOS() == llvm::Triple::RTEMS) |
699 |
++ return; |
700 |
++ |
701 |
++ // Add an include of '/include' directly. This isn't provided by default by |
702 |
++ // system GCCs, but is often used with cross-compiling GCCs, and harmless to |
703 |
++ // add even when Clang is acting as-if it were a system compiler. |
704 |
++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include"); |
705 |
++ |
706 |
++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/include"); |
707 |
++} |
708 |
++ |
709 |
++/// \brief Helper to add the thre variant paths for a libstdc++ installation. |
710 |
++/*static*/ bool FreeBSD::addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir, |
711 |
++ const ArgList &DriverArgs, |
712 |
++ ArgStringList &CC1Args) { |
713 |
++ if (!llvm::sys::fs::exists(Base)) |
714 |
++ return false; |
715 |
++ addSystemInclude(DriverArgs, CC1Args, Base); |
716 |
++ addSystemInclude(DriverArgs, CC1Args, Base + "/" + TargetArchDir); |
717 |
++ addSystemInclude(DriverArgs, CC1Args, Base + "/backward"); |
718 |
++ return true; |
719 |
++} |
720 |
++ |
721 |
++void FreeBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, |
722 |
++ ArgStringList &CC1Args) const { |
723 |
++ if (DriverArgs.hasArg(options::OPT_nostdlibinc) || |
724 |
++ DriverArgs.hasArg(options::OPT_nostdincxx)) |
725 |
++ return; |
726 |
++ |
727 |
++ // Check if libc++ has been enabled and provide its include paths if so. |
728 |
++ if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) { |
729 |
++ // libc++ is always installed at a fixed path on Linux currently. |
730 |
++ addSystemInclude(DriverArgs, CC1Args, |
731 |
++ getDriver().SysRoot + "/usr/include/c++/v1"); |
732 |
++ return; |
733 |
++ } |
734 |
++ |
735 |
++ // We need a detected GCC installation on Linux to provide libstdc++'s |
736 |
++ // headers. We handled the libc++ case above. |
737 |
++ if (!GCCInstallation.isValid()) |
738 |
++ return; |
739 |
++ |
740 |
++ // By default, look for the C++ headers in an include directory adjacent to |
741 |
++ // the lib directory of the GCC installation. Note that this is expect to be |
742 |
++ // equivalent to '/usr/include/c++/X.Y' in almost all cases. |
743 |
++ StringRef LibDir = GCCInstallation.getParentLibPath(); |
744 |
++ StringRef InstallDir = GCCInstallation.getInstallPath(); |
745 |
++ StringRef Version = GCCInstallation.getVersion(); |
746 |
++ if (!addLibStdCXXIncludePaths(LibDir + "/../include/c++/" + Version, |
747 |
++ (GCCInstallation.getTriple().str() + |
748 |
++ GCCInstallation.getMultiarchSuffix()), |
749 |
++ DriverArgs, CC1Args)) { |
750 |
++ // Gentoo is weird and places its headers inside the GCC install, so if the |
751 |
++ // first attempt to find the headers fails, try this pattern. |
752 |
++ addLibStdCXXIncludePaths(InstallDir + "/include/g++-v4", |
753 |
++ getDriver().DefaultTargetTriple, |
754 |
++ DriverArgs, CC1Args); |
755 |
++ } |
756 |
++} |
757 |
++ |
758 |
+ /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly. |
759 |
+ |
760 |
+ DragonFly::DragonFly(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) |
761 |
+diff --git a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h |
762 |
+index eaa6be1..bba891e 100644 |
763 |
+--- a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h |
764 |
++++ b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h |
765 |
+@@ -489,6 +489,16 @@ public: |
766 |
+ |
767 |
+ virtual Tool &SelectTool(const Compilation &C, const JobAction &JA, |
768 |
+ const ActionList &Inputs) const; |
769 |
++ |
770 |
++ virtual void AddClangSystemIncludeArgs(const ArgList &DriverArgs, |
771 |
++ ArgStringList &CC1Args) const; |
772 |
++ virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, |
773 |
++ ArgStringList &CC1Args) const; |
774 |
++ |
775 |
++private: |
776 |
++ static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir, |
777 |
++ const ArgList &DriverArgs, |
778 |
++ ArgStringList &CC1Args); |
779 |
+ }; |
780 |
+ |
781 |
+ class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF { |
782 |
|
783 |
diff --git a/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-lib-path.patch b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-lib-path.patch |
784 |
new file mode 100644 |
785 |
index 0000000..69ce782 |
786 |
--- /dev/null |
787 |
+++ b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-lib-path.patch |
788 |
@@ -0,0 +1,12 @@ |
789 |
+diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp |
790 |
+--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 04:08:48.393073000 -0400 |
791 |
++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 04:11:38.113153421 -0400 |
792 |
+@@ -1635,6 +1635,8 @@ FreeBSD::FreeBSD(const Driver &D, const |
793 |
+ getFilePaths().push_back(getDriver().SysRoot + "/usr/lib32"); |
794 |
+ else |
795 |
+ getFilePaths().push_back(getDriver().SysRoot + "/usr/lib"); |
796 |
++ |
797 |
++ getFilePaths().push_back(GCCInstallation.getInstallPath()); |
798 |
+ } |
799 |
+ |
800 |
+ Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA, |
801 |
|
802 |
diff --git a/sys-devel/clang/files/clang-3.1-gentoo-linux-fix-cxx-include.patch b/sys-devel/clang/files/clang-3.1-gentoo-linux-fix-cxx-include.patch |
803 |
new file mode 100644 |
804 |
index 0000000..0a8beef |
805 |
--- /dev/null |
806 |
+++ b/sys-devel/clang/files/clang-3.1-gentoo-linux-fix-cxx-include.patch |
807 |
@@ -0,0 +1,13 @@ |
808 |
+diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp |
809 |
+--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-25 20:32:28.859469000 -0400 |
810 |
++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-25 20:33:15.988680000 -0400 |
811 |
+@@ -2305,8 +2305,7 @@ void Linux::AddClangCXXStdlibIncludeArgs |
812 |
+ // Gentoo is weird and places its headers inside the GCC install, so if the |
813 |
+ // first attempt to find the headers fails, try this pattern. |
814 |
+ addLibStdCXXIncludePaths(InstallDir + "/include/g++-v4", |
815 |
+- (GCCInstallation.getTriple().str() + |
816 |
+- GCCInstallation.getMultiarchSuffix()), |
817 |
++ getDriver().DefaultTargetTriple, |
818 |
+ DriverArgs, CC1Args); |
819 |
+ } |
820 |
+ } |
821 |
|
822 |
diff --git a/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection.patch b/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection.patch |
823 |
new file mode 100644 |
824 |
index 0000000..6f0fca0 |
825 |
--- /dev/null |
826 |
+++ b/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection.patch |
827 |
@@ -0,0 +1,26 @@ |
828 |
+diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp |
829 |
+--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:32:31.593191000 -0400 |
830 |
++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:38:31.733163513 -0400 |
831 |
+@@ -1145,6 +1145,22 @@ Generic_GCC::GCCInstallationDetector::GC |
832 |
+ Prefixes.push_back(D.InstalledDir + "/.."); |
833 |
+ } |
834 |
+ |
835 |
++ llvm::OwningPtr<llvm::MemoryBuffer> File; |
836 |
++ if (!llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + D.DefaultTargetTriple, File)) |
837 |
++ { |
838 |
++ bool Exists; |
839 |
++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str(); |
840 |
++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + D.DefaultTargetTriple + "/" + VersionText; |
841 |
++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists) |
842 |
++ { |
843 |
++ Version = GCCVersion::Parse(VersionText); |
844 |
++ GCCInstallPath = GentooPath; |
845 |
++ GCCParentLibPath = GCCInstallPath + "/../../.."; |
846 |
++ IsValid = true; |
847 |
++ return; |
848 |
++ } |
849 |
++ } |
850 |
++ |
851 |
+ // Loop over the various components which exist and select the best GCC |
852 |
+ // installation available. GCC installs are ranked by version number. |
853 |
+ Version = GCCVersion::Parse("0.0.0"); |
854 |
|
855 |
diff --git a/sys-devel/clang/files/clang-3.1-increase-parser-recursion-limit.patch b/sys-devel/clang/files/clang-3.1-increase-parser-recursion-limit.patch |
856 |
new file mode 100644 |
857 |
index 0000000..91606d1 |
858 |
--- /dev/null |
859 |
+++ b/sys-devel/clang/files/clang-3.1-increase-parser-recursion-limit.patch |
860 |
@@ -0,0 +1,15 @@ |
861 |
+Backported from r155737. |
862 |
+ |
863 |
+diff --git a/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h b/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h |
864 |
+index 0ae5dc8..2a7464f 100644 |
865 |
+--- a/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h |
866 |
++++ b/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h |
867 |
+@@ -451,7 +451,7 @@ private: |
868 |
+ } |
869 |
+ } |
870 |
+ |
871 |
+- enum { MaxDepth = 256 }; |
872 |
++ enum { MaxDepth = 512 }; |
873 |
+ |
874 |
+ bool diagnoseOverflow(); |
875 |
+ bool diagnoseMissingClose(); |
876 |
|
877 |
diff --git a/sys-devel/clang/metadata.xml b/sys-devel/clang/metadata.xml |
878 |
new file mode 100644 |
879 |
index 0000000..8357105 |
880 |
--- /dev/null |
881 |
+++ b/sys-devel/clang/metadata.xml |
882 |
@@ -0,0 +1,39 @@ |
883 |
+<?xml version="1.0" encoding="UTF-8"?> |
884 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
885 |
+<pkgmetadata> |
886 |
+ <maintainer> |
887 |
+ <email>voyageur@g.o</email> |
888 |
+ <name>Bernard Cafarelli</name> |
889 |
+ </maintainer> |
890 |
+ <maintainer> |
891 |
+ <email>mgorny@g.o</email> |
892 |
+ <name>Michał Górny</name> |
893 |
+ </maintainer> |
894 |
+ <longdescription>The goal of the Clang project is to create a new C, C++, Objective C and Objective C++ front-end for the LLVM compiler. |
895 |
+ |
896 |
+Features and Goals |
897 |
+ |
898 |
+Some of the goals for the project include the following: |
899 |
+ |
900 |
+End-User Features: |
901 |
+Fast compiles and low memory use |
902 |
+Expressive diagnostics |
903 |
+GCC compatibility |
904 |
+Utility and Applications: |
905 |
+ |
906 |
+Modular library based architecture |
907 |
+Support diverse clients (refactoring, static analysis, code generation, etc) |
908 |
+Allow tight integration with IDEs |
909 |
+Use the LLVM BSD License |
910 |
+Internal Design and Implementation: |
911 |
+ |
912 |
+A real-world, production quality compiler |
913 |
+A simple and hackable code base |
914 |
+A single unified parser for C, Objective C, C++, and Objective C++ |
915 |
+Conformance with C/C++/ObjC and their variants</longdescription> |
916 |
+ <use> |
917 |
+ <flag name='multitarget'>Build all host targets (default: host only)</flag> |
918 |
+ <flag name='static-analyzer'>Install the Clang static analyzer</flag> |
919 |
+ <flag name='system-cxx-headers'>By default, clang++ searchs for C++ headers in a series of hardcoded paths. Enabling this flag will force it to use the active gcc profile ones</flag> |
920 |
+ </use> |
921 |
+</pkgmetadata> |