From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SaqSx-0003Xo-MH for garchives@archives.gentoo.org; Sat, 02 Jun 2012 15:42:12 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 29E59E059B; Sat, 2 Jun 2012 15:42:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B9A44E059B for ; Sat, 2 Jun 2012 15:42:03 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C8DBE1B4011 for ; Sat, 2 Jun 2012 15:42:02 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id C761EE5430 for ; Sat, 2 Jun 2012 15:42:00 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1338655314.42104d4521488464d34875597f39e6cda3f1d074.mgorny@gentoo> Subject: [gentoo-commits] proj/x11:opencl commit in: sys-devel/clang/, sys-devel/clang/files/cl-patches/, sys-devel/clang/files/ X-VCS-Repository: proj/x11 X-VCS-Files: sys-devel/clang/clang-3.1-r2.ebuild sys-devel/clang/files/cl-patches/0001-Add-r600-TargetInfo.patch sys-devel/clang/files/cl-patches/0002-r600-Add-some-target-builtins.patch sys-devel/clang/files/cl-patches/0003-r600-Add-read_global_size-and-read_local_size-builti.patch sys-devel/clang/files/clang-2.7-fixdoc.patch sys-devel/clang/files/clang-3.1-fix_cxx_include_root.patch sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths.patch sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-lib-path.patch sys-devel/clang/files/clang-3.1-gentoo-linux-fix-cxx-include.patch sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection.patch sys-devel/clang/files/clang-3.1-increase-parser-recursion-limit.patch sys-devel/clang/metadata.xml X-VCS-Directories: sys-devel/clang/ sys-devel/clang/files/cl-patches/ sys-devel/clang/files/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 42104d4521488464d34875597f39e6cda3f1d074 X-VCS-Branch: opencl Date: Sat, 2 Jun 2012 15:42:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 49dce895-645a-4fb6-b028-2dc261948d05 X-Archives-Hash: 81c8502253c46623ef3c98f0a312805f commit: 42104d4521488464d34875597f39e6cda3f1d074 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Sat Jun 2 16:41:54 2012 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Sat Jun 2 16:41:54 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/x11.git;a=3Dc= ommit;h=3D42104d45 sys-devel/clang: Add a patched version of clang-3.1 for r600 OpenCL. (Portage version: 2.2.0_alpha108_p12/git/Linux x86_64, unsigned Manifest = commit) --- sys-devel/clang/clang-3.1-r2.ebuild | 204 ++++++++++++++= ++++++ .../cl-patches/0001-Add-r600-TargetInfo.patch | 100 ++++++++++ .../0002-r600-Add-some-target-builtins.patch | 111 +++++++++++ ...ad_global_size-and-read_local_size-builti.patch | 31 +++ sys-devel/clang/files/clang-2.7-fixdoc.patch | 53 +++++ .../files/clang-3.1-fix_cxx_include_root.patch | 21 ++ .../clang-3.1-gentoo-freebsd-fix-cxx-paths.patch | 187 ++++++++++++++= ++++ .../clang-3.1-gentoo-freebsd-fix-lib-path.patch | 12 ++ .../clang-3.1-gentoo-linux-fix-cxx-include.patch | 13 ++ .../clang-3.1-gentoo-runtime-gcc-detection.patch | 26 +++ ...clang-3.1-increase-parser-recursion-limit.patch | 15 ++ sys-devel/clang/metadata.xml | 39 ++++ 12 files changed, 812 insertions(+), 0 deletions(-) diff --git a/sys-devel/clang/clang-3.1-r2.ebuild b/sys-devel/clang/clang-= 3.1-r2.ebuild new file mode 100644 index 0000000..673aec7 --- /dev/null +++ b/sys-devel/clang/clang-3.1-r2.ebuild @@ -0,0 +1,204 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-3.1-r2.ebuild,v= 1.3 2012/05/26 17:44:24 aballier Exp $ + +EAPI=3D4 + +RESTRICT_PYTHON_ABIS=3D"3.*" +SUPPORT_PYTHON_ABIS=3D"1" + +inherit eutils multilib python + +DESCRIPTION=3D"C language family frontend for LLVM" +HOMEPAGE=3D"http://clang.llvm.org/" +# Fetching LLVM as well: see http://llvm.org/bugs/show_bug.cgi?id=3D4840 +SRC_URI=3D"http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.gz + http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.gz + http://llvm.org/releases/${PV}/${P}.src.tar.gz" + +LICENSE=3D"UoI-NCSA" +SLOT=3D"0" +KEYWORDS=3D"~amd64 ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos" +IUSE=3D"debug kernel_FreeBSD multitarget +static-analyzer test" + +DEPEND=3D"static-analyzer? ( dev-lang/perl )" +RDEPEND=3D"~sys-devel/llvm-${PV}[multitarget=3D]" + +S=3D${WORKDIR}/llvm-${PV}.src + +src_prepare() { + mv "${WORKDIR}"/clang-${PV}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + + # Same as llvm doc patches + epatch "${FILESDIR}"/${PN}-2.7-fixdoc.patch + + # multilib-strict + sed -e "/PROJ_headers/s#lib/clang#$(get_libdir)/clang#" \ + -i tools/clang/lib/Headers/Makefile \ + || die "clang Makefile failed" + sed -e "/PROJ_resources/s#lib/clang#$(get_libdir)/clang#" \ + -i tools/clang/runtime/compiler-rt/Makefile \ + || die "compiler-rt Makefile failed" + # fix the static analyzer for in-tree install + sed -e 's/import ScanView/from clang \0/' \ + -i tools/clang/tools/scan-view/scan-view \ + || die "scan-view sed failed" + sed -e "/scanview.css\|sorttable.js/s#\$RealBin#${EPREFIX}/usr/share/${= PN}#" \ + -i tools/clang/tools/scan-build/scan-build \ + || die "scan-build sed failed" + # Set correct path for gold plugin + sed -e "/LLVMgold.so/s#lib/#$(get_libdir)/llvm/#" \ + -i tools/clang/lib/Driver/Tools.cpp \ + || die "gold plugin path sed failed" + # Specify python version + python_convert_shebangs 2 tools/clang/tools/scan-view/scan-view + python_convert_shebangs -r 2 test/Scripts + python_convert_shebangs 2 projects/compiler-rt/lib/asan/scripts/asan_sy= mbolize.py + + # From llvm src_prepare + einfo "Fixing install dirs" + sed -e 's,^PROJ_docsdir.*,PROJ_docsdir :=3D $(PROJ_prefix)/share/doc/'$= {PF}, \ + -e 's,^PROJ_etcdir.*,PROJ_etcdir :=3D '"${EPREFIX}"'/etc/llvm,' \ + -e 's,^PROJ_libdir.*,PROJ_libdir :=3D $(PROJ_prefix)/'$(get_libdir)/ll= vm, \ + -i Makefile.config.in || die "Makefile.config sed failed" + + einfo "Fixing rpath and CFLAGS" + sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPRE= FIX}"/usr/$(get_libdir)/llvm, \ + -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ + -i Makefile.rules || die "rpath sed failed" + + # Use system llc (from llvm ebuild) for tests + sed -e "/^llc_props =3D/s/os.path.join(llvm_tools_dir, 'llc')/'llc'/" \ + -i tools/clang/test/lit.cfg || die "test path sed failed" + + # Automatically select active system GCC's libraries, bug #406163 + epatch "${FILESDIR}"/${P}-gentoo-runtime-gcc-detection.patch + + # Fix search paths on FreeBSD, bug #409269 + epatch "${FILESDIR}"/${P}-gentoo-freebsd-fix-lib-path.patch + + # Fix regression caused by removal of USE=3Dsystem-cxx-headers, bug #41= 7541 + epatch "${FILESDIR}"/${P}-gentoo-freebsd-fix-cxx-paths.patch + + # Fix regression that prevents Clang from building itself on Linux, bug= #417537 + epatch "${FILESDIR}"/${P}-gentoo-linux-fix-cxx-include.patch + + # Increase recursion limit, bug #417545, upstream r155737 + epatch "${FILESDIR}"/${P}-increase-parser-recursion-limit.patch + + # Apply r600 OpenCL-related patches + pushd tools/clang &>/dev/null || die + epatch "${FILESDIR}"/cl-patches/*.patch + popd &>/dev/null || die + + # User patches + epatch_user +} + +src_configure() { + local CONF_FLAGS=3D"--enable-shared + --with-optimize-option=3D + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks)" + + # Setup the search path to include the Prefix includes + if use prefix ; then + CONF_FLAGS=3D"${CONF_FLAGS} \ + --with-c-include-dirs=3D${EPREFIX}/usr/include:/usr/include" + fi + + if use multitarget; then + CONF_FLAGS=3D"${CONF_FLAGS} --enable-targets=3Dall" + else + CONF_FLAGS=3D"${CONF_FLAGS} --enable-targets=3Dhost-only" + fi + + if use amd64; then + CONF_FLAGS=3D"${CONF_FLAGS} --enable-pic" + fi + + econf ${CONF_FLAGS} +} + +src_compile() { + emake VERBOSE=3D1 KEEP_SYMBOLS=3D1 REQUIRES_RTTI=3D1 clang-only +} + +src_test() { + cd "${S}"/test || die "cd failed" + emake site.exp + + cd "${S}"/tools/clang || die "cd clang failed" + + echo ">>> Test phase [test]: ${CATEGORY}/${PF}" + + testing() { + if ! emake -j1 VERBOSE=3D1 test; then + has test $FEATURES && die "Make test failed. See above for details." + has test $FEATURES || eerror "Make test failed. See above for details= ." + fi + } + python_execute_function testing +} + +src_install() { + cd "${S}"/tools/clang || die "cd clang failed" + emake KEEP_SYMBOLS=3D1 DESTDIR=3D"${D}" install + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + + cd tools/scan-view || die "cd scan-view failed" + dobin scan-view + install-scan-view() { + insinto "$(python_get_sitedir)"/clang + doins Reporter.py Resources ScanView.py startfile.py + touch "${ED}"/"$(python_get_sitedir)"/clang/__init__.py + } + python_execute_function install-scan-view + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + if [[ ${CHOST} =3D=3D *-darwin* ]] ; then + for lib in libclang.dylib ; do + ebegin "fixing install_name of $lib" + install_name_tool -id "${EPREFIX}"/usr/lib/llvm/${lib} \ + "${ED}"/usr/lib/llvm/${lib} + eend $? + done + for f in usr/bin/{c-index-test,clang} usr/lib/llvm/libclang.dylib ; do + ebegin "fixing references in ${f##*/}" + install_name_tool \ + -change "@rpath/libclang.dylib" \ + "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + -change "@executable_path/../lib/libLLVM-${PV}.dylib" \ + "${EPREFIX}"/usr/lib/llvm/libLLVM-${PV}.dylib \ + -change "${S}"/Release/lib/libclang.dylib \ + "${EPREFIX}"/usr/lib/llvm/libclang.dylib \ + "${ED}"/$f + eend $? + done + fi + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && rm "${ED}"usr/$(get_libdir)/clang/${PV}/include/{= arm_neon,std,float,iso,limits,tgmath,varargs}*.h +} + +pkg_postinst() { + python_mod_optimize clang +} + +pkg_postrm() { + python_mod_cleanup clang +} diff --git a/sys-devel/clang/files/cl-patches/0001-Add-r600-TargetInfo.pa= tch b/sys-devel/clang/files/cl-patches/0001-Add-r600-TargetInfo.patch new file mode 100644 index 0000000..929b5d3 --- /dev/null +++ b/sys-devel/clang/files/cl-patches/0001-Add-r600-TargetInfo.patch @@ -0,0 +1,100 @@ +From 70cae83ffd093f183dec07c464db3c0bb6b92c10 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Fri, 2 Mar 2012 10:54:52 -0500 +Subject: [PATCH 1/3] Add r600 TargetInfo + +--- + lib/Basic/Targets.cpp | 70 ++++++++++++++++++++++++++++++++++++++++++= +++++++ + 1 files changed, 70 insertions(+), 0 deletions(-) + +diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp +index 85dfd78..64dc01c 100644 +--- a/lib/Basic/Targets.cpp ++++ b/lib/Basic/Targets.cpp +@@ -1068,6 +1068,73 @@ namespace { + } +=20 + namespace { ++ ++class AMDGPUTargetInfo : public TargetInfo { ++public: ++ ++ AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { } ++ ++ virtual const char * getClobbers() const { ++ return ""; ++ } ++ ++ virtual void getGCCRegNames(const char * const *&Names, ++ unsigned &numNames) const { ++ Names =3D NULL; ++ numNames =3D 0; ++ } ++ ++ virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, ++ unsigned &NumAliases) const { ++ Aliases =3D NULL; ++ NumAliases =3D 0; ++ } ++ ++ virtual bool validateAsmConstraint(const char *&Name, ++ TargetInfo::ConstraintInfo &info) = const { ++ return true; ++ } ++ ++ virtual void getTargetBuiltins(const Builtin::Info *&Records, ++ unsigned &NumRecords) const { ++ Records =3D NULL; ++ NumRecords =3D 0; ++ } ++}; ++ ++ ++static const unsigned R600AddrSpaceMap[] =3D { ++ 1, // opencl_global ++ 3, // opencl_local ++ 2 // opencl_constant ++}; ++ ++class R600TargetInfo : public AMDGPUTargetInfo { ++public: ++ R600TargetInfo(const std::string& triple) : AMDGPUTargetInfo(triple) = { ++ DescriptionString =3D=20 ++ "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" ++ "-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:32:32" ++ "-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64" ++ "-v96:128:128-v128:128:128-v192:256:256-v256:256:256" ++ "-v512:512:512-v1024:1024:1024-v2048:2048:2048" ++ "-n8:16:32:64"; ++ AddrSpaceMap =3D &R600AddrSpaceMap; ++ } ++ ++ virtual void getTargetDefines(const LangOptions &Opts, ++ MacroBuilder &Builder) const { ++ Builder.defineMacro("__R600__"); ++ } ++ ++ virtual const char * getVAListDeclaration() const { ++ return ""; ++ } ++}; ++ ++} // end anonymous namespace ++ ++namespace { + // MBlaze abstract base class + class MBlazeTargetInfo : public TargetInfo { + static const char * const GCCRegNames[]; +@@ -3963,6 +4030,9 @@ static TargetInfo *AllocateTarget(const std::strin= g &T) { + case llvm::Triple::mblaze: + return new MBlazeTargetInfo(T); +=20 ++ case llvm::Triple::r600: ++ return new R600TargetInfo(T); ++ + case llvm::Triple::sparc: + switch (os) { + case llvm::Triple::Linux: +--=20 +1.7.7.6 + diff --git a/sys-devel/clang/files/cl-patches/0002-r600-Add-some-target-b= uiltins.patch b/sys-devel/clang/files/cl-patches/0002-r600-Add-some-targe= t-builtins.patch new file mode 100644 index 0000000..0003a8d --- /dev/null +++ b/sys-devel/clang/files/cl-patches/0002-r600-Add-some-target-builtins= .patch @@ -0,0 +1,111 @@ +From a014573ad193775b2301e39275a1ca0ac3bb5847 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Tue, 13 Mar 2012 13:54:51 -0400 +Subject: [PATCH 2/3] r600: Add some target builtins + +--- + include/clang/Basic/BuiltinsR600.def | 32 +++++++++++++++++++++++++++= +++++ + include/clang/Basic/TargetBuiltins.h | 10 ++++++++++ + lib/Basic/Targets.cpp | 12 ++++++++++-- + 3 files changed, 52 insertions(+), 2 deletions(-) + create mode 100644 include/clang/Basic/BuiltinsR600.def + +diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/= BuiltinsR600.def +new file mode 100644 +index 0000000..ce1f30e +--- /dev/null ++++ b/include/clang/Basic/BuiltinsR600.def +@@ -0,0 +1,32 @@ ++//=3D=3D=3D--- BuiltinsR600.def - R600 Builtin function database -- --= *- C++ -*-=3D=3D=3D// ++// ++// The LLVM Compiler Infrastructure ++// ++// This file is distributed under the University of Illinois Open Sourc= e ++// License. See LICENSE.TXT for details. ++// ++//=3D=3D=3D------------------------------------------------------------= ----------=3D=3D=3D// ++// ++// This file defines the R600-specific builtin function database. User= s of ++// this file must define the BUILTIN macro to make use of this informat= ion. ++// ++//=3D=3D=3D------------------------------------------------------------= ----------=3D=3D=3D// ++// ++// Authors: Tom Stellard ++// ++ ++// The format of this database matches clang/Basic/Builtins.def. ++ ++BUILTIN(__builtin_r600_read_ngroups_x, "z", "nc") ++BUILTIN(__builtin_r600_read_ngroups_y, "z", "nc") ++BUILTIN(__builtin_r600_read_ngroups_z, "z", "nc") ++ ++BUILTIN(__builtin_r600_read_tidig_x, "z", "nc") ++BUILTIN(__builtin_r600_read_tidig_y, "z", "nc") ++BUILTIN(__builtin_r600_read_tidig_z, "z", "nc") ++ ++BUILTIN(__builtin_r600_read_tgid_x, "z", "nc") ++BUILTIN(__builtin_r600_read_tgid_y, "z", "nc") ++BUILTIN(__builtin_r600_read_tgid_z, "z", "nc") ++ ++#undef BUILTIN +diff --git a/include/clang/Basic/TargetBuiltins.h b/include/clang/Basic/= TargetBuiltins.h +index 7c04bf7..3460cd5 100644 +--- a/include/clang/Basic/TargetBuiltins.h ++++ b/include/clang/Basic/TargetBuiltins.h +@@ -45,6 +45,16 @@ namespace clang { + }; + } +=20 ++ /// R600 builtins ++ namespace R600 { ++ enum { ++ LastTIBuiltin =3D clang::Builtin::FirstTSBuiltin-1, ++#define BUILTIN(ID, TYPE, ATTRS) BI##ID, ++#include "clang/Basic/BuiltinsR600.def" ++ LastTSBuiltin ++ }; ++ } ++ +=20 + /// X86 builtins + namespace X86 { +diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp +index 64dc01c..03f1a18 100644 +--- a/lib/Basic/Targets.cpp ++++ b/lib/Basic/Targets.cpp +@@ -1070,6 +1070,7 @@ namespace { + namespace { +=20 + class AMDGPUTargetInfo : public TargetInfo { ++ static const Builtin::Info BuiltinInfo[]; + public: +=20 + AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { } +@@ -1097,8 +1098,8 @@ public: +=20 + virtual void getTargetBuiltins(const Builtin::Info *&Records, + unsigned &NumRecords) const { +- Records =3D NULL; +- NumRecords =3D 0; ++ Records =3D BuiltinInfo; ++ NumRecords =3D clang::R600::LastTSBuiltin-Builtin::FirstTSBuiltin; + } + }; +=20 +@@ -1132,6 +1133,13 @@ public: + } + }; +=20 ++const Builtin::Info AMDGPUTargetInfo::BuiltinInfo[] =3D { ++#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES }= , ++#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,= \ ++ ALL_LANGUAGES }, ++#include "clang/Basic/BuiltinsR600.def" ++}; ++ + } // end anonymous namespace +=20 + namespace { +--=20 +1.7.7.6 + diff --git a/sys-devel/clang/files/cl-patches/0003-r600-Add-read_global_s= ize-and-read_local_size-builti.patch b/sys-devel/clang/files/cl-patches/0= 003-r600-Add-read_global_size-and-read_local_size-builti.patch new file mode 100644 index 0000000..e0c2d3b --- /dev/null +++ b/sys-devel/clang/files/cl-patches/0003-r600-Add-read_global_size-and= -read_local_size-builti.patch @@ -0,0 +1,31 @@ +From 2881b8189dcacc8ab6a336f0e107d72752c8c47e Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Wed, 14 Mar 2012 11:20:08 -0400 +Subject: [PATCH 3/3] r600: Add read_global_size and read_local_size buil= tins + +--- + include/clang/Basic/BuiltinsR600.def | 8 ++++++++ + 1 files changed, 8 insertions(+), 0 deletions(-) + +diff --git a/include/clang/Basic/BuiltinsR600.def b/include/clang/Basic/= BuiltinsR600.def +index ce1f30e..c81758e 100644 +--- a/include/clang/Basic/BuiltinsR600.def ++++ b/include/clang/Basic/BuiltinsR600.def +@@ -17,6 +17,14 @@ +=20 + // The format of this database matches clang/Basic/Builtins.def. +=20 ++BUILTIN(__builtin_r600_read_global_size_x, "z", "nc") ++BUILTIN(__builtin_r600_read_global_size_y, "z", "nc") ++BUILTIN(__builtin_r600_read_global_size_z, "z", "nc") ++ ++BUILTIN(__builtin_r600_read_local_size_x, "z", "nc") ++BUILTIN(__builtin_r600_read_local_size_y, "z", "nc") ++BUILTIN(__builtin_r600_read_local_size_z, "z", "nc") ++ + BUILTIN(__builtin_r600_read_ngroups_x, "z", "nc") + BUILTIN(__builtin_r600_read_ngroups_y, "z", "nc") + BUILTIN(__builtin_r600_read_ngroups_z, "z", "nc") +--=20 +1.7.7.6 + diff --git a/sys-devel/clang/files/clang-2.7-fixdoc.patch b/sys-devel/cla= ng/files/clang-2.7-fixdoc.patch new file mode 100644 index 0000000..8058ec4 --- /dev/null +++ b/sys-devel/clang/files/clang-2.7-fixdoc.patch @@ -0,0 +1,53 @@ +diff -Naur llvm-2.7.orig//tools/clang/docs/Makefile llvm-2.7/tools/clang= /docs/Makefile +--- llvm-2.7.orig//tools/clang/docs/Makefile 2010-04-26 18:38:45.0000000= 00 +0200 ++++ llvm-2.7/tools/clang/docs/Makefile 2010-04-26 18:41:08.000000000 +02= 00 +@@ -46,13 +46,12 @@ + # 'make generated BUILD_FOR_WEBSITE=3D1' + generated:: doxygen +=20 +-install-html: $(PROJ_OBJ_DIR)/html.tar.gz ++install-html: + $(Echo) Installing HTML documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img + $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html + # $(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_do= csdir) +=20 + $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML) + $(Echo) Packaging HTML documentation +@@ -64,12 +63,11 @@ + install-doxygen: doxygen + $(Echo) Installing doxygen documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ= _docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \ + $(FIND) . -type f -exec \ + $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \; +=20 +-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz ++doxygen: regendoc +=20 + regendoc: + $(Echo) Building doxygen documentation +diff -Naur llvm-2.7.orig//tools/clang/docs/tools/Makefile llvm-2.7/tools= /clang/docs/tools/Makefile +--- llvm-2.7.orig//tools/clang/docs/tools/Makefile 2010-04-26 18:38:45.0= 00000000 +0200 ++++ llvm-2.7/tools/clang/docs/tools/Makefile 2010-04-26 18:41:29.0000000= 00 +0200 +@@ -24,7 +24,7 @@ + CLANG_VERSION :=3D trunk +=20 + # If we are in BUILD_FOR_WEBSITE mode, default to the all target. +-all:: html man ps ++all:: html man +=20 + clean: + rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS) +@@ -58,7 +58,7 @@ + ifdef ONLY_MAN_DOCS + INSTALL_TARGETS :=3D install-man + else +-INSTALL_TARGETS :=3D install-html install-man install-ps ++INSTALL_TARGETS :=3D install-html install-man + endif +=20 + .SUFFIXES: 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 new file mode 100644 index 0000000..e7c5251 --- /dev/null +++ b/sys-devel/clang/files/clang-3.1-fix_cxx_include_root.patch @@ -0,0 +1,21 @@ +Bug #387309 + +--- llvm/tools/clang/lib/Driver/ToolChains.cpp.orig 2011-11-09 23:10:04.= 000000000 +0100 ++++ llvm/tools/clang/lib/Driver/ToolChains.cpp 2011-11-09 23:11:04.00000= 0000 +0100 +@@ -1586,12 +1586,13 @@ + // This is of the form /foo/bar/include/c++/4.5.2/ + if (CxxIncludeRoot.back() =3D=3D '/') + llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the / ++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the g++= -v4 ++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the inc= lude + StringRef Version =3D llvm::sys::path::filename(CxxIncludeRoot); + llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the ver= sion +- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the c++ +- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the inc= lude ++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the ARC= H + GCCInstallPath =3D CxxIncludeRoot.str(); +- GCCInstallPath.append("/lib/gcc/"); ++ GCCInstallPath.append("/"); + GCCInstallPath.append(CXX_INCLUDE_ARCH); + GCCInstallPath.append("/"); + GCCInstallPath.append(Version); 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.pat= ch new file mode 100644 index 0000000..987aa22 --- /dev/null +++ b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths.patch @@ -0,0 +1,187 @@ +diff --git a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/b/ll= vm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp +index 1e282f2..1d6835b 100644 +--- a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp ++++ b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp +@@ -2305,6 +2305,161 @@ void Linux::AddClangCXXStdlibIncludeArgs(const A= rgList &DriverArgs, + } + } +=20 ++void FreeBSD::AddClangSystemIncludeArgs(const ArgList &DriverArgs, ++ ArgStringList &CC1Args) const { ++ const Driver &D =3D getDriver(); ++ ++ if (DriverArgs.hasArg(options::OPT_nostdinc)) ++ return; ++ ++ if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) ++ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/local/inclu= de"); ++ ++ if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { ++ llvm::sys::Path P(D.ResourceDir); ++ P.appendComponent("include"); ++ addSystemInclude(DriverArgs, CC1Args, P.str()); ++ } ++ ++ if (DriverArgs.hasArg(options::OPT_nostdlibinc)) ++ return; ++ ++ // Check for configure-time C include directories. ++ StringRef CIncludeDirs(C_INCLUDE_DIRS); ++ if (CIncludeDirs !=3D "") { ++ SmallVector dirs; ++ CIncludeDirs.split(dirs, ":"); ++ for (SmallVectorImpl::iterator I =3D dirs.begin(), E =3D= dirs.end(); ++ I !=3D E; ++I) { ++ StringRef Prefix =3D llvm::sys::path::is_absolute(*I) ? D.SysRoot= : ""; ++ addExternCSystemInclude(DriverArgs, CC1Args, Prefix + *I); ++ } ++ return; ++ } ++ ++ // Lacking those, try to detect the correct set of system includes fo= r the ++ // target triple. ++ ++ // Implement generic Debian multiarch support. ++ const StringRef X86_64MultiarchIncludeDirs[] =3D { ++ "/usr/include/x86_64-linux-gnu", ++ ++ // FIXME: These are older forms of multiarch. It's not clear that t= hey're ++ // in use in any released version of Debian, so we should consider ++ // removing them. ++ "/usr/include/i686-linux-gnu/64", ++ "/usr/include/i486-linux-gnu/64" ++ }; ++ const StringRef X86MultiarchIncludeDirs[] =3D { ++ "/usr/include/i386-linux-gnu", ++ ++ // FIXME: These are older forms of multiarch. It's not clear that t= hey're ++ // in use in any released version of Debian, so we should consider ++ // removing them. ++ "/usr/include/x86_64-linux-gnu/32", ++ "/usr/include/i686-linux-gnu", ++ "/usr/include/i486-linux-gnu" ++ }; ++ const StringRef ARMMultiarchIncludeDirs[] =3D { ++ "/usr/include/arm-linux-gnueabi" ++ }; ++ const StringRef MIPSMultiarchIncludeDirs[] =3D { ++ "/usr/include/mips-linux-gnu" ++ }; ++ const StringRef MIPSELMultiarchIncludeDirs[] =3D { ++ "/usr/include/mipsel-linux-gnu" ++ }; ++ const StringRef PPCMultiarchIncludeDirs[] =3D { ++ "/usr/include/powerpc-linux-gnu" ++ }; ++ const StringRef PPC64MultiarchIncludeDirs[] =3D { ++ "/usr/include/powerpc64-linux-gnu" ++ }; ++ ArrayRef MultiarchIncludeDirs; ++ if (getTriple().getArch() =3D=3D llvm::Triple::x86_64) { ++ MultiarchIncludeDirs =3D X86_64MultiarchIncludeDirs; ++ } else if (getTriple().getArch() =3D=3D llvm::Triple::x86) { ++ MultiarchIncludeDirs =3D X86MultiarchIncludeDirs; ++ } else if (getTriple().getArch() =3D=3D llvm::Triple::arm) { ++ MultiarchIncludeDirs =3D ARMMultiarchIncludeDirs; ++ } else if (getTriple().getArch() =3D=3D llvm::Triple::mips) { ++ MultiarchIncludeDirs =3D MIPSMultiarchIncludeDirs; ++ } else if (getTriple().getArch() =3D=3D llvm::Triple::mipsel) { ++ MultiarchIncludeDirs =3D MIPSELMultiarchIncludeDirs; ++ } else if (getTriple().getArch() =3D=3D llvm::Triple::ppc) { ++ MultiarchIncludeDirs =3D PPCMultiarchIncludeDirs; ++ } else if (getTriple().getArch() =3D=3D llvm::Triple::ppc64) { ++ MultiarchIncludeDirs =3D PPC64MultiarchIncludeDirs; ++ } ++ for (ArrayRef::iterator I =3D MultiarchIncludeDirs.begin()= , ++ E =3D MultiarchIncludeDirs.end(); ++ I !=3D E; ++I) { ++ if (llvm::sys::fs::exists(D.SysRoot + *I)) { ++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + *I); ++ break; ++ } ++ } ++ ++ if (getTriple().getOS() =3D=3D llvm::Triple::RTEMS) ++ return; ++ ++ // Add an include of '/include' directly. This isn't provided by defa= ult by ++ // system GCCs, but is often used with cross-compiling GCCs, and harm= less to ++ // add even when Clang is acting as-if it were a system compiler. ++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include"); ++ ++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/includ= e"); ++} ++ ++/// \brief Helper to add the thre variant paths for a libstdc++ install= ation. ++/*static*/ bool FreeBSD::addLibStdCXXIncludePaths(Twine Base, Twine Tar= getArchDir, ++ const ArgList &DriverAr= gs, ++ ArgStringList &CC1Args)= { ++ if (!llvm::sys::fs::exists(Base)) ++ return false; ++ addSystemInclude(DriverArgs, CC1Args, Base); ++ addSystemInclude(DriverArgs, CC1Args, Base + "/" + TargetArchDir); ++ addSystemInclude(DriverArgs, CC1Args, Base + "/backward"); ++ return true; ++} ++ ++void FreeBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, ++ ArgStringList &CC1Args) const = { ++ if (DriverArgs.hasArg(options::OPT_nostdlibinc) || ++ DriverArgs.hasArg(options::OPT_nostdincxx)) ++ return; ++ ++ // Check if libc++ has been enabled and provide its include paths if = so. ++ if (GetCXXStdlibType(DriverArgs) =3D=3D ToolChain::CST_Libcxx) { ++ // libc++ is always installed at a fixed path on Linux currently. ++ addSystemInclude(DriverArgs, CC1Args, ++ getDriver().SysRoot + "/usr/include/c++/v1"); ++ return; ++ } ++ ++ // We need a detected GCC installation on Linux to provide libstdc++'= s ++ // headers. We handled the libc++ case above. ++ if (!GCCInstallation.isValid()) ++ return; ++ ++ // By default, look for the C++ headers in an include directory adjac= ent to ++ // the lib directory of the GCC installation. Note that this is expec= t to be ++ // equivalent to '/usr/include/c++/X.Y' in almost all cases. ++ StringRef LibDir =3D GCCInstallation.getParentLibPath(); ++ StringRef InstallDir =3D GCCInstallation.getInstallPath(); ++ StringRef Version =3D GCCInstallation.getVersion(); ++ if (!addLibStdCXXIncludePaths(LibDir + "/../include/c++/" + Version, ++ (GCCInstallation.getTriple().str() + ++ GCCInstallation.getMultiarchSuffix()), ++ DriverArgs, CC1Args)) { ++ // Gentoo is weird and places its headers inside the GCC install, s= o if the ++ // first attempt to find the headers fails, try this pattern. ++ addLibStdCXXIncludePaths(InstallDir + "/include/g++-v4", ++ getDriver().DefaultTargetTriple, ++ DriverArgs, CC1Args); ++ } ++} ++ + /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) dir= ectly. +=20 + DragonFly::DragonFly(const Driver &D, const llvm::Triple& Triple, const= ArgList &Args) +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 +index eaa6be1..bba891e 100644 +--- a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h ++++ b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h +@@ -489,6 +489,16 @@ public: +=20 + virtual Tool &SelectTool(const Compilation &C, const JobAction &JA, + const ActionList &Inputs) const; ++ ++ virtual void AddClangSystemIncludeArgs(const ArgList &DriverArgs, ++ ArgStringList &CC1Args) const; ++ virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, ++ ArgStringList &CC1Args) con= st; ++ ++private: ++ static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir, ++ const ArgList &DriverArgs, ++ ArgStringList &CC1Args); + }; +=20 + class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF { 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 new file mode 100644 index 0000000..69ce782 --- /dev/null +++ b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-lib-path.patch @@ -0,0 +1,12 @@ +diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3= .1.src/tools/clang/lib/Driver/ToolChains.cpp +--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 04:0= 8:48.393073000 -0400 ++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 04:1= 1:38.113153421 -0400 +@@ -1635,6 +1635,8 @@ FreeBSD::FreeBSD(const Driver &D, const + getFilePaths().push_back(getDriver().SysRoot + "/usr/lib32"); + else + getFilePaths().push_back(getDriver().SysRoot + "/usr/lib"); ++ ++ getFilePaths().push_back(GCCInstallation.getInstallPath()); + } +=20 + Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA, 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.pat= ch new file mode 100644 index 0000000..0a8beef --- /dev/null +++ b/sys-devel/clang/files/clang-3.1-gentoo-linux-fix-cxx-include.patch @@ -0,0 +1,13 @@ +diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3= .1.src/tools/clang/lib/Driver/ToolChains.cpp +--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-25 20:3= 2:28.859469000 -0400 ++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-25 20:3= 3:15.988680000 -0400 +@@ -2305,8 +2305,7 @@ void Linux::AddClangCXXStdlibIncludeArgs + // Gentoo is weird and places its headers inside the GCC install, s= o if the + // first attempt to find the headers fails, try this pattern. + addLibStdCXXIncludePaths(InstallDir + "/include/g++-v4", +- (GCCInstallation.getTriple().str() + +- GCCInstallation.getMultiarchSuffix()), ++ getDriver().DefaultTargetTriple, + DriverArgs, CC1Args); + } + } 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.pat= ch new file mode 100644 index 0000000..6f0fca0 --- /dev/null +++ b/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection.patch @@ -0,0 +1,26 @@ +diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3= .1.src/tools/clang/lib/Driver/ToolChains.cpp +--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:3= 2:31.593191000 -0400 ++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:3= 8:31.733163513 -0400 +@@ -1145,6 +1145,22 @@ Generic_GCC::GCCInstallationDetector::GC + Prefixes.push_back(D.InstalledDir + "/.."); + } +=20 ++ llvm::OwningPtr File; ++ if (!llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-"= + D.DefaultTargetTriple, File)) ++ { ++ bool Exists; ++ const std::string VersionText =3D File.get()->getBuffer().rsplit('-= ').second.substr(0,5).str(); ++ const std::string GentooPath =3D D.SysRoot + "/usr/lib/gcc/" + D.De= faultTargetTriple + "/" + VersionText; ++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && E= xists) ++ { ++ Version =3D GCCVersion::Parse(VersionText); ++ GCCInstallPath =3D GentooPath; ++ GCCParentLibPath =3D GCCInstallPath + "/../../.."; ++ IsValid =3D true; ++ return; ++ } ++ } ++ + // Loop over the various components which exist and select the best G= CC + // installation available. GCC installs are ranked by version number. + Version =3D GCCVersion::Parse("0.0.0"); diff --git a/sys-devel/clang/files/clang-3.1-increase-parser-recursion-li= mit.patch b/sys-devel/clang/files/clang-3.1-increase-parser-recursion-lim= it.patch new file mode 100644 index 0000000..91606d1 --- /dev/null +++ b/sys-devel/clang/files/clang-3.1-increase-parser-recursion-limit.pat= ch @@ -0,0 +1,15 @@ +Backported from r155737. + +diff --git a/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h b/llv= m-3.1.src/tools/clang/include/clang/Parse/Parser.h +index 0ae5dc8..2a7464f 100644 +--- a/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h ++++ b/llvm-3.1.src/tools/clang/include/clang/Parse/Parser.h +@@ -451,7 +451,7 @@ private: + } + } + =20 +- enum { MaxDepth =3D 256 }; ++ enum { MaxDepth =3D 512 }; + =20 + bool diagnoseOverflow(); + bool diagnoseMissingClose(); diff --git a/sys-devel/clang/metadata.xml b/sys-devel/clang/metadata.xml new file mode 100644 index 0000000..8357105 --- /dev/null +++ b/sys-devel/clang/metadata.xml @@ -0,0 +1,39 @@ + + + + + voyageur@gentoo.org + Bernard Cafarelli + + + mgorny@gentoo.org + Micha=C5=82 G=C3=B3rny + + The goal of the Clang project is to create a new C, C+= +, Objective C and Objective C++ front-end for the LLVM compiler. + +Features and Goals + +Some of the goals for the project include the following: + +End-User Features: +Fast compiles and low memory use +Expressive diagnostics +GCC compatibility +Utility and Applications: + +Modular library based architecture +Support diverse clients (refactoring, static analysis, code generation, = etc) +Allow tight integration with IDEs +Use the LLVM BSD License +Internal Design and Implementation: + +A real-world, production quality compiler +A simple and hackable code base +A single unified parser for C, Objective C, C++, and Objective C++ +Conformance with C/C++/ObjC and their variants + + Build all host targets (default: host only)= + Install the Clang static analyzer + 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 + +