diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2015-05-22 13:34:27 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2015-05-22 13:34:27 +0300 |
commit | 607c21be93ef467d9f88a831a84b829c99e6ee1a (patch) | |
tree | 3f112917536d7a9d0600afd4210c7722a13973c7 | |
parent | 11c9581a4a381cf91d76eb918e5c8520dc5e7258 (diff) |
clang from gentoo repo
22 files changed, 1442 insertions, 0 deletions
diff --git a/sys-devel/clang/clang-scm.ebuild b/sys-devel/clang/clang-scm.ebuild new file mode 100644 index 0000000..256d6c6 --- /dev/null +++ b/sys-devel/clang/clang-scm.ebuild @@ -0,0 +1,36 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/clang/clang-9999-r100.ebuild,v 1.5 2013/10/28 00:25:12 ottxor Exp $ + +EAPI=5 + +inherit multilib-build + +DESCRIPTION="C language family frontend for LLVM (meta-ebuild)" +HOMEPAGE="http://clang.llvm.org/" +SRC_URI="" + +LICENSE="UoI-NCSA" +SLOT="0/${PV}" +KEYWORDS="" +IUSE="debug multitarget python +static-analyzer" + +RDEPEND="~sys-devel/llvm-${PV}[clang(-),debug=,multitarget?,python?,static-analyzer,${MULTILIB_USEDEP}]" + +# Please keep this package around since it's quite likely that we'll +# return to separate LLVM & clang ebuilds when the cmake build system +# is complete. + +pkg_postinst() { + if has_version ">=dev-util/ccache-3.1.9-r2" ; then + #add ccache links as clang might get installed after ccache + "${EROOT}"/usr/bin/ccache-config --install-links + fi +} + +pkg_postrm() { + if has_version ">=dev-util/ccache-3.1.9-r2" && [[ -z ${REPLACED_BY_VERSION} ]]; then + # --remove-links would remove all links, --install-links updates them + "${EROOT}"/usr/bin/ccache-config --install-links + fi +} diff --git a/sys-devel/clang/files/cl-patches/clang-0001-Add-r600-TargetInfo.patch b/sys-devel/clang/files/cl-patches/clang-0001-Add-r600-TargetInfo.patch new file mode 100644 index 0000000..929b5d3 --- /dev/null +++ b/sys-devel/clang/files/cl-patches/clang-0001-Add-r600-TargetInfo.patch @@ -0,0 +1,100 @@ +From 70cae83ffd093f183dec07c464db3c0bb6b92c10 Mon Sep 17 00:00:00 2001 +From: Tom Stellard <thomas.stellard@amd.com> +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 { + } + + 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 = NULL; ++ numNames = 0; ++ } ++ ++ virtual void getGCCRegAliases(const GCCRegAlias *&Aliases, ++ unsigned &NumAliases) const { ++ Aliases = NULL; ++ NumAliases = 0; ++ } ++ ++ virtual bool validateAsmConstraint(const char *&Name, ++ TargetInfo::ConstraintInfo &info) const { ++ return true; ++ } ++ ++ virtual void getTargetBuiltins(const Builtin::Info *&Records, ++ unsigned &NumRecords) const { ++ Records = NULL; ++ NumRecords = 0; ++ } ++}; ++ ++ ++static const unsigned R600AddrSpaceMap[] = { ++ 1, // opencl_global ++ 3, // opencl_local ++ 2 // opencl_constant ++}; ++ ++class R600TargetInfo : public AMDGPUTargetInfo { ++public: ++ R600TargetInfo(const std::string& triple) : AMDGPUTargetInfo(triple) { ++ DescriptionString = ++ "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 = &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::string &T) { + case llvm::Triple::mblaze: + return new MBlazeTargetInfo(T); + ++ case llvm::Triple::r600: ++ return new R600TargetInfo(T); ++ + case llvm::Triple::sparc: + switch (os) { + case llvm::Triple::Linux: +-- +1.7.7.6 + diff --git a/sys-devel/clang/files/cl-patches/clang-0002-r600-Add-some-target-builtins.patch b/sys-devel/clang/files/cl-patches/clang-0002-r600-Add-some-target-builtins.patch new file mode 100644 index 0000000..0003a8d --- /dev/null +++ b/sys-devel/clang/files/cl-patches/clang-0002-r600-Add-some-target-builtins.patch @@ -0,0 +1,111 @@ +From a014573ad193775b2301e39275a1ca0ac3bb5847 Mon Sep 17 00:00:00 2001 +From: Tom Stellard <thomas.stellard@amd.com> +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 @@ ++//===--- BuiltinsR600.def - R600 Builtin function database -- --*- C++ -*-===// ++// ++// The LLVM Compiler Infrastructure ++// ++// This file is distributed under the University of Illinois Open Source ++// License. See LICENSE.TXT for details. ++// ++//===----------------------------------------------------------------------===// ++// ++// This file defines the R600-specific builtin function database. Users of ++// this file must define the BUILTIN macro to make use of this information. ++// ++//===----------------------------------------------------------------------===// ++// ++// Authors: Tom Stellard <thomas.stellard@amd.com> ++// ++ ++// 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 { + }; + } + ++ /// R600 builtins ++ namespace R600 { ++ enum { ++ LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1, ++#define BUILTIN(ID, TYPE, ATTRS) BI##ID, ++#include "clang/Basic/BuiltinsR600.def" ++ LastTSBuiltin ++ }; ++ } ++ + + /// 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 { + + class AMDGPUTargetInfo : public TargetInfo { ++ static const Builtin::Info BuiltinInfo[]; + public: + + AMDGPUTargetInfo(const std::string& triple) : TargetInfo(triple) { } +@@ -1097,8 +1098,8 @@ public: + + virtual void getTargetBuiltins(const Builtin::Info *&Records, + unsigned &NumRecords) const { +- Records = NULL; +- NumRecords = 0; ++ Records = BuiltinInfo; ++ NumRecords = clang::R600::LastTSBuiltin-Builtin::FirstTSBuiltin; + } + }; + +@@ -1132,6 +1133,13 @@ public: + } + }; + ++const Builtin::Info AMDGPUTargetInfo::BuiltinInfo[] = { ++#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 + + namespace { +-- +1.7.7.6 + diff --git a/sys-devel/clang/files/cl-patches/clang-0003-r600-Add-read_global_size-and-read_local_size-builti.patch b/sys-devel/clang/files/cl-patches/clang-0003-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/clang-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 <thomas.stellard@amd.com> +Date: Wed, 14 Mar 2012 11:20:08 -0400 +Subject: [PATCH 3/3] r600: Add read_global_size and read_local_size builtins + +--- + 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 @@ + + // The format of this database matches clang/Basic/Builtins.def. + ++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") +-- +1.7.7.6 + diff --git a/sys-devel/clang/files/cl-patches/llvm-0001-r600-Add-some-intrinsic-definitions.patch b/sys-devel/clang/files/cl-patches/llvm-0001-r600-Add-some-intrinsic-definitions.patch new file mode 100644 index 0000000..9d99c9c --- /dev/null +++ b/sys-devel/clang/files/cl-patches/llvm-0001-r600-Add-some-intrinsic-definitions.patch @@ -0,0 +1,64 @@ +From e25389b66b5ced3a2b5461077dcc9a505d334e3d Mon Sep 17 00:00:00 2001 +From: Tom Stellard <thomas.stellard@amd.com> +Date: Tue, 13 Mar 2012 14:12:21 -0400 +Subject: [PATCH 1/2] r600: Add some intrinsic definitions + +--- + include/llvm/Intrinsics.td | 1 + + include/llvm/IntrinsicsR600.td | 35 +++++++++++++++++++++++++++++++++++ + 2 files changed, 36 insertions(+), 0 deletions(-) + create mode 100644 include/llvm/IntrinsicsR600.td + +diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td +index 069f907..e90dd85 100644 +--- a/include/llvm/Intrinsics.td ++++ b/include/llvm/Intrinsics.td +@@ -441,3 +441,4 @@ include "llvm/IntrinsicsCellSPU.td" + include "llvm/IntrinsicsXCore.td" + include "llvm/IntrinsicsPTX.td" + include "llvm/IntrinsicsHexagon.td" ++include "llvm/IntrinsicsR600.td" +diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td +new file mode 100644 +index 0000000..789fecb +--- /dev/null ++++ b/include/llvm/IntrinsicsR600.td +@@ -0,0 +1,35 @@ ++//===- IntrinsicsR600.td - Defines R600 intrinsics ---------*- tablegen -*-===// ++// ++// The LLVM Compiler Infrastructure ++// ++// This file is distributed under the University of Illinois Open Source ++// License. See LICENSE.TXT for details. ++// ++//===----------------------------------------------------------------------===// ++// ++// This file defines all of the R600-specific intrinsics. ++// ++//===----------------------------------------------------------------------===// ++// ++// Authors: Tom Stellard <thomas.stellard@amd.com> ++// ++ ++let TargetPrefix = "r600" in { ++ ++class R600ReadPreloadRegisterIntrinsic<string name> ++ : Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>, ++ GCCBuiltin<name>; ++ ++multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> { ++ def _x : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_x")>; ++ def _y : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_y")>; ++ def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>; ++} ++ ++defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz < ++ "__builtin_r600_read_ngroups">; ++defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz < ++ "__builtin_r600_read_tgid">; ++defm int_r600_read_tidig : R600ReadPreloadRegisterIntrinsic_xyz < ++ "__builtin_r600_read_tidig">; ++} // End TargetPrefix = "r600" +-- +1.7.7.6 + diff --git a/sys-devel/clang/files/cl-patches/llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch b/sys-devel/clang/files/cl-patches/llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch new file mode 100644 index 0000000..db176dd --- /dev/null +++ b/sys-devel/clang/files/cl-patches/llvm-0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch @@ -0,0 +1,27 @@ +From 17667fa3450470f7c89fc2ba4631d908cf510749 Mon Sep 17 00:00:00 2001 +From: Tom Stellard <thomas.stellard@amd.com> +Date: Wed, 14 Mar 2012 11:19:35 -0400 +Subject: [PATCH 2/2] r600: Add get_global_size and get_local_size intrinsics + +--- + include/llvm/IntrinsicsR600.td | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td +index 789fecb..0473acb 100644 +--- a/include/llvm/IntrinsicsR600.td ++++ b/include/llvm/IntrinsicsR600.td +@@ -26,6 +26,10 @@ multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> { + def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>; + } + ++defm int_r600_read_global_size : R600ReadPreloadRegisterIntrinsic_xyz < ++ "__builtin_r600_read_global_size">; ++defm int_r600_read_local_size : R600ReadPreloadRegisterIntrinsic_xyz < ++ "__builtin_r600_read_local_size">; + defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz < + "__builtin_r600_read_ngroups">; + defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz < +-- +1.7.7.6 + diff --git a/sys-devel/clang/files/clang-2.7-fixdoc.patch b/sys-devel/clang/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.000000000 +0200 ++++ llvm-2.7/tools/clang/docs/Makefile 2010-04-26 18:41:08.000000000 +0200 +@@ -46,13 +46,12 @@ + # 'make generated BUILD_FOR_WEBSITE=1' + generated:: doxygen + +-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_docsdir) + + $(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 \; + +-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz ++doxygen: regendoc + + 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.000000000 +0200 ++++ llvm-2.7/tools/clang/docs/tools/Makefile 2010-04-26 18:41:29.000000000 +0200 +@@ -24,7 +24,7 @@ + CLANG_VERSION := trunk + + # If we are in BUILD_FOR_WEBSITE mode, default to the all target. +-all:: html man ps ++all:: html man + + clean: + rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS) +@@ -58,7 +58,7 @@ + ifdef ONLY_MAN_DOCS + INSTALL_TARGETS := install-man + else +-INSTALL_TARGETS := install-html install-man install-ps ++INSTALL_TARGETS := install-html install-man + endif + + .SUFFIXES: diff --git a/sys-devel/clang/files/clang-2.8-alignof.patch b/sys-devel/clang/files/clang-2.8-alignof.patch new file mode 100644 index 0000000..a15f118 --- /dev/null +++ b/sys-devel/clang/files/clang-2.8-alignof.patch @@ -0,0 +1,258 @@ +Index: include/llvm/ADT/StringMap.h +=================================================================== +--- include/llvm/ADT/StringMap.h (révision 117773) ++++ include/llvm/ADT/StringMap.h (révision 117774) +@@ -167,7 +167,7 @@ + + unsigned AllocSize = static_cast<unsigned>(sizeof(StringMapEntry))+ + KeyLength+1; +- unsigned Alignment = alignof<StringMapEntry>(); ++ unsigned Alignment = alignOf<StringMapEntry>(); + + StringMapEntry *NewItem = + static_cast<StringMapEntry*>(Allocator.Allocate(AllocSize,Alignment)); +Index: include/llvm/Support/AlignOf.h +=================================================================== +--- include/llvm/Support/AlignOf.h (révision 117773) ++++ include/llvm/Support/AlignOf.h (révision 117774) +@@ -49,12 +49,12 @@ + + }; + +-/// alignof - A templated function that returns the mininum alignment of ++/// alignOf - A templated function that returns the mininum alignment of + /// of a type. This provides no extra functionality beyond the AlignOf + /// class besides some cosmetic cleanliness. Example usage: +-/// alignof<int>() returns the alignment of an int. ++/// alignOf<int>() returns the alignment of an int. + template <typename T> +-static inline unsigned alignof() { return AlignOf<T>::Alignment; } ++static inline unsigned alignOf() { return AlignOf<T>::Alignment; } + + } // end namespace llvm + #endif +Index: include/llvm/Support/Allocator.h +=================================================================== +--- include/llvm/Support/Allocator.h (révision 117773) ++++ include/llvm/Support/Allocator.h (révision 117774) +@@ -201,7 +201,7 @@ + char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr : + (char *)Slab + Slab->Size; + for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) { +- Ptr = Allocator.AlignPtr(Ptr, alignof<T>()); ++ Ptr = Allocator.AlignPtr(Ptr, alignOf<T>()); + if (Ptr + sizeof(T) <= End) + reinterpret_cast<T*>(Ptr)->~T(); + } +Index: include/llvm/CodeGen/SlotIndexes.h +=================================================================== +--- include/llvm/CodeGen/SlotIndexes.h (révision 117773) ++++ include/llvm/CodeGen/SlotIndexes.h (révision 117774) +@@ -393,7 +393,7 @@ + IndexListEntry *entry = + static_cast<IndexListEntry*>( + ileAllocator.Allocate(sizeof(IndexListEntry), +- alignof<IndexListEntry>())); ++ alignOf<IndexListEntry>())); + + new (entry) IndexListEntry(mi, index); + +Index: tools/clang/lib/Basic/IdentifierTable.cpp +=================================================================== +--- tools/clang/lib/Basic/IdentifierTable.cpp (révision 117774) ++++ tools/clang/lib/Basic/IdentifierTable.cpp (révision 117775) +@@ -390,7 +390,7 @@ + unsigned Size = sizeof(MultiKeywordSelector) + nKeys*sizeof(IdentifierInfo *); + MultiKeywordSelector *SI = + (MultiKeywordSelector*)SelTabImpl.Allocator.Allocate(Size, +- llvm::alignof<MultiKeywordSelector>()); ++ llvm::alignOf<MultiKeywordSelector>()); + new (SI) MultiKeywordSelector(nKeys, IIV); + SelTabImpl.Table.InsertNode(SI, InsertPos); + return Selector(SI); +Index: tools/clang/lib/AST/ExprCXX.cpp +=================================================================== +--- tools/clang/lib/AST/ExprCXX.cpp (révision 117774) ++++ tools/clang/lib/AST/ExprCXX.cpp (révision 117775) +@@ -233,7 +233,7 @@ + if (NumTemplateArgs != 0) + size += ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs); + +- void *Mem = C.Allocate(size, llvm::alignof<UnresolvedLookupExpr>()); ++ void *Mem = C.Allocate(size, llvm::alignOf<UnresolvedLookupExpr>()); + UnresolvedLookupExpr *E = new (Mem) UnresolvedLookupExpr(EmptyShell()); + E->HasExplicitTemplateArgs = NumTemplateArgs != 0; + return E; +@@ -261,7 +261,7 @@ + if (NumResults) { + Results = static_cast<DeclAccessPair *>( + C.Allocate(sizeof(DeclAccessPair) * NumResults, +- llvm::alignof<DeclAccessPair>())); ++ llvm::alignOf<DeclAccessPair>())); + memcpy(Results, &*Begin.getIterator(), + NumResults * sizeof(DeclAccessPair)); + } +@@ -737,7 +737,7 @@ + if (TemplateArgs) + size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs); + +- void *Mem = C.Allocate(size, llvm::alignof<CXXDependentScopeMemberExpr>()); ++ void *Mem = C.Allocate(size, llvm::alignOf<CXXDependentScopeMemberExpr>()); + return new (Mem) CXXDependentScopeMemberExpr(C, Base, BaseType, + IsArrow, OperatorLoc, + Qualifier, QualifierRange, +@@ -756,7 +756,7 @@ + + std::size_t size = sizeof(CXXDependentScopeMemberExpr) + + ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs); +- void *Mem = C.Allocate(size, llvm::alignof<CXXDependentScopeMemberExpr>()); ++ void *Mem = C.Allocate(size, llvm::alignOf<CXXDependentScopeMemberExpr>()); + CXXDependentScopeMemberExpr *E + = new (Mem) CXXDependentScopeMemberExpr(C, 0, QualType(), + 0, SourceLocation(), 0, +@@ -812,7 +812,7 @@ + if (TemplateArgs) + size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs); + +- void *Mem = C.Allocate(size, llvm::alignof<UnresolvedMemberExpr>()); ++ void *Mem = C.Allocate(size, llvm::alignOf<UnresolvedMemberExpr>()); + return new (Mem) UnresolvedMemberExpr(C, + Dependent ? C.DependentTy : C.OverloadTy, + Dependent, HasUnresolvedUsing, Base, BaseType, +@@ -826,7 +826,7 @@ + if (NumTemplateArgs != 0) + size += ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs); + +- void *Mem = C.Allocate(size, llvm::alignof<UnresolvedMemberExpr>()); ++ void *Mem = C.Allocate(size, llvm::alignOf<UnresolvedMemberExpr>()); + UnresolvedMemberExpr *E = new (Mem) UnresolvedMemberExpr(EmptyShell()); + E->HasExplicitTemplateArgs = NumTemplateArgs != 0; + return E; +Index: tools/clang/lib/AST/DeclObjC.cpp +=================================================================== +--- tools/clang/lib/AST/DeclObjC.cpp (révision 117774) ++++ tools/clang/lib/AST/DeclObjC.cpp (révision 117775) +@@ -711,7 +711,7 @@ + void ObjCClassDecl::setClassList(ASTContext &C, ObjCInterfaceDecl*const*List, + const SourceLocation *Locs, unsigned Num) { + ForwardDecls = (ObjCClassRef*) C.Allocate(sizeof(ObjCClassRef)*Num, +- llvm::alignof<ObjCClassRef>()); ++ llvm::alignOf<ObjCClassRef>()); + for (unsigned i = 0; i < Num; ++i) + new (&ForwardDecls[i]) ObjCClassRef(List[i], Locs[i]); + +Index: tools/clang/lib/AST/Stmt.cpp +=================================================================== +--- tools/clang/lib/AST/Stmt.cpp (révision 117774) ++++ tools/clang/lib/AST/Stmt.cpp (révision 117775) +@@ -416,7 +416,7 @@ + Stmt *atFinallyStmt) { + unsigned Size = sizeof(ObjCAtTryStmt) + + (1 + NumCatchStmts + (atFinallyStmt != 0)) * sizeof(Stmt *); +- void *Mem = Context.Allocate(Size, llvm::alignof<ObjCAtTryStmt>()); ++ void *Mem = Context.Allocate(Size, llvm::alignOf<ObjCAtTryStmt>()); + return new (Mem) ObjCAtTryStmt(atTryLoc, atTryStmt, CatchStmts, NumCatchStmts, + atFinallyStmt); + } +@@ -426,7 +426,7 @@ + bool HasFinally) { + unsigned Size = sizeof(ObjCAtTryStmt) + + (1 + NumCatchStmts + HasFinally) * sizeof(Stmt *); +- void *Mem = Context.Allocate(Size, llvm::alignof<ObjCAtTryStmt>()); ++ void *Mem = Context.Allocate(Size, llvm::alignOf<ObjCAtTryStmt>()); + return new (Mem) ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally); + } + +@@ -448,7 +448,7 @@ + std::size_t Size = sizeof(CXXTryStmt); + Size += ((numHandlers + 1) * sizeof(Stmt)); + +- void *Mem = C.Allocate(Size, llvm::alignof<CXXTryStmt>()); ++ void *Mem = C.Allocate(Size, llvm::alignOf<CXXTryStmt>()); + return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers, numHandlers); + } + +@@ -457,7 +457,7 @@ + std::size_t Size = sizeof(CXXTryStmt); + Size += ((numHandlers + 1) * sizeof(Stmt)); + +- void *Mem = C.Allocate(Size, llvm::alignof<CXXTryStmt>()); ++ void *Mem = C.Allocate(Size, llvm::alignOf<CXXTryStmt>()); + return new (Mem) CXXTryStmt(Empty, numHandlers); + } + +Index: tools/clang/lib/AST/Expr.cpp +=================================================================== +--- tools/clang/lib/AST/Expr.cpp (révision 117774) ++++ tools/clang/lib/AST/Expr.cpp (révision 117775) +@@ -257,7 +257,7 @@ + if (TemplateArgs) + Size += ExplicitTemplateArgumentList::sizeFor(*TemplateArgs); + +- void *Mem = Context.Allocate(Size, llvm::alignof<DeclRefExpr>()); ++ void *Mem = Context.Allocate(Size, llvm::alignOf<DeclRefExpr>()); + return new (Mem) DeclRefExpr(Qualifier, QualifierRange, D, NameInfo, + TemplateArgs, T); + } +@@ -271,7 +271,7 @@ + if (NumTemplateArgs) + Size += ExplicitTemplateArgumentList::sizeFor(NumTemplateArgs); + +- void *Mem = Context.Allocate(Size, llvm::alignof<DeclRefExpr>()); ++ void *Mem = Context.Allocate(Size, llvm::alignOf<DeclRefExpr>()); + return new (Mem) DeclRefExpr(EmptyShell()); + } + +@@ -432,7 +432,7 @@ + // any concatenated string tokens. + void *Mem = C.Allocate(sizeof(StringLiteral)+ + sizeof(SourceLocation)*(NumStrs-1), +- llvm::alignof<StringLiteral>()); ++ llvm::alignOf<StringLiteral>()); + StringLiteral *SL = new (Mem) StringLiteral(Ty); + + // OPTIMIZE: could allocate this appended to the StringLiteral. +@@ -452,7 +452,7 @@ + StringLiteral *StringLiteral::CreateEmpty(ASTContext &C, unsigned NumStrs) { + void *Mem = C.Allocate(sizeof(StringLiteral)+ + sizeof(SourceLocation)*(NumStrs-1), +- llvm::alignof<StringLiteral>()); ++ llvm::alignOf<StringLiteral>()); + StringLiteral *SL = new (Mem) StringLiteral(QualType()); + SL->StrData = 0; + SL->ByteLength = 0; +@@ -714,7 +714,7 @@ + if (targs) + Size += ExplicitTemplateArgumentList::sizeFor(*targs); + +- void *Mem = C.Allocate(Size, llvm::alignof<MemberExpr>()); ++ void *Mem = C.Allocate(Size, llvm::alignOf<MemberExpr>()); + MemberExpr *E = new (Mem) MemberExpr(base, isarrow, memberdecl, nameinfo, ty); + + if (hasQualOrFound) { +Index: tools/clang/lib/AST/DeclCXX.cpp +=================================================================== +--- tools/clang/lib/AST/DeclCXX.cpp (révision 117774) ++++ tools/clang/lib/AST/DeclCXX.cpp (révision 117775) +@@ -1057,7 +1057,7 @@ + unsigned NumIndices) { + void *Mem = Context.Allocate(sizeof(CXXBaseOrMemberInitializer) + + sizeof(VarDecl *) * NumIndices, +- llvm::alignof<CXXBaseOrMemberInitializer>()); ++ llvm::alignOf<CXXBaseOrMemberInitializer>()); + return new (Mem) CXXBaseOrMemberInitializer(Context, Member, MemberLoc, + L, Init, R, Indices, NumIndices); + } +Index: tools/clang/lib/Lex/TokenLexer.cpp +=================================================================== +--- tools/clang/lib/Lex/TokenLexer.cpp (révision 117774) ++++ tools/clang/lib/Lex/TokenLexer.cpp (révision 117775) +@@ -287,7 +287,7 @@ + llvm::BumpPtrAllocator &Alloc = PP.getPreprocessorAllocator(); + Token *Res = + static_cast<Token *>(Alloc.Allocate(sizeof(Token)*ResultToks.size(), +- llvm::alignof<Token>())); ++ llvm::alignOf<Token>())); + if (NumTokens) + memcpy(Res, &ResultToks[0], NumTokens*sizeof(Token)); + Tokens = Res; diff --git a/sys-devel/clang/files/clang-2.8-darwin-prefix.patch b/sys-devel/clang/files/clang-2.8-darwin-prefix.patch new file mode 100644 index 0000000..555b8ee --- /dev/null +++ b/sys-devel/clang/files/clang-2.8-darwin-prefix.patch @@ -0,0 +1,127 @@ +This code looks as if it is written by Apple, lots of assumptions that +only hold for them and their scenario. + +--- tools/clang/lib/Driver/ToolChains.cpp ++++ tools/clang/lib/Driver/ToolChains.cpp +@@ -131,7 +131,7 @@ + GCCVersion[2] = 1; + + // Set up the tool chain paths to match gcc. +- ToolChainDir = "i686-apple-darwin"; ++ ToolChainDir = "@GENTOO_PORTAGE_CHOST@"; + ToolChainDir += llvm::utostr(DarwinVersion[0]); + ToolChainDir += "/"; + ToolChainDir += llvm::utostr(GCCVersion[0]); +@@ -141,9 +141,9 @@ + ToolChainDir += llvm::utostr(GCCVersion[2]); + + // Try the next major version if that tool chain dir is invalid. +- std::string Tmp = "/usr/lib/gcc/" + ToolChainDir; ++ std::string Tmp = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir; + if (!llvm::sys::Path(Tmp).exists()) { +- std::string Next = "i686-apple-darwin"; ++ std::string Next = "@GENTOO_PORTAGE_CHOST_ARCH@"; + Next += llvm::utostr(DarwinVersion[0] + 1); + Next += "/"; + Next += llvm::utostr(GCCVersion[0]); +@@ -155,7 +155,7 @@ + // Use that if it exists, otherwise hope the user isn't linking. + // + // FIXME: Drop dependency on gcc's tool chain. +- Tmp = "/usr/lib/gcc/" + Next; ++ Tmp = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + Next; + if (llvm::sys::Path(Tmp).exists()) + ToolChainDir = Next; + } +@@ -168,7 +168,7 @@ + Path += "/x86_64"; + getFilePaths().push_back(Path); + +- Path = "/usr/lib/gcc/"; ++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/"; + Path += ToolChainDir; + Path += "/x86_64"; + getFilePaths().push_back(Path); +@@ -179,7 +179,7 @@ + Path += ToolChainDir; + getFilePaths().push_back(Path); + +- Path = "/usr/lib/gcc/"; ++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/"; + Path += ToolChainDir; + getFilePaths().push_back(Path); + +@@ -188,7 +188,7 @@ + Path += ToolChainDir; + getProgramPaths().push_back(Path); + +- Path = "/usr/libexec/gcc/"; ++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/libexec/gcc/"; + Path += ToolChainDir; + getProgramPaths().push_back(Path); + +@@ -291,14 +291,14 @@ + + // FIXME: Derive these correctly. + if (getArchName() == "x86_64") { +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir + ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir + + "/x86_64")); + // Intentionally duplicated for (temporary) gcc bug compatibility. +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir + ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir + + "/x86_64")); + } + +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/" + ToolChainDir)); ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/" + ToolChainDir)); + + Tmp = getDriver().Dir + "/../lib/gcc/" + ToolChainDir; + if (llvm::sys::Path(Tmp).exists()) +@@ -306,18 +306,18 @@ + Tmp = getDriver().Dir + "/../lib/gcc"; + if (llvm::sys::Path(Tmp).exists()) + CmdArgs.push_back(Args.MakeArgString("-L" + Tmp)); +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir)); ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir)); + // Intentionally duplicated for (temporary) gcc bug compatibility. +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir)); ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir)); + Tmp = getDriver().Dir + "/../lib/" + ToolChainDir; + if (llvm::sys::Path(Tmp).exists()) + CmdArgs.push_back(Args.MakeArgString("-L" + Tmp)); + Tmp = getDriver().Dir + "/../lib"; + if (llvm::sys::Path(Tmp).exists()) + CmdArgs.push_back(Args.MakeArgString("-L" + Tmp)); +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir + ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir + + "/../../../" + ToolChainDir)); +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir + ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir + + "/../../..")); + } + +@@ -386,22 +386,7 @@ + P.eraseComponent(); // .../usr/bin -> ../usr + P.appendComponent("lib"); + P.appendComponent("gcc"); +- switch (getTriple().getArch()) { +- default: +- assert(0 && "Invalid Darwin arch!"); +- case llvm::Triple::x86: +- case llvm::Triple::x86_64: +- P.appendComponent("i686-apple-darwin10"); +- break; +- case llvm::Triple::arm: +- case llvm::Triple::thumb: +- P.appendComponent("arm-apple-darwin10"); +- break; +- case llvm::Triple::ppc: +- case llvm::Triple::ppc64: +- P.appendComponent("powerpc-apple-darwin10"); +- break; +- } ++ P.appendComponent("@GENTOO_PORTAGE_CHOST@"); + P.appendComponent("4.2.1"); + + // Determine the arch specific GCC subdirectory. diff --git a/sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch b/sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch new file mode 100644 index 0000000..f60d051 --- /dev/null +++ b/sys-devel/clang/files/clang-2.8-gcc-4.4.4.patch @@ -0,0 +1,16 @@ +Index: tools/clang/lib/Frontend/InitHeaderSearch.cpp +=================================================================== +--- tools/clang/lib/Frontend/InitHeaderSearch.cpp (révision 119347) ++++ tools/clang/lib/Frontend/InitHeaderSearch.cpp (révision 119348) +@@ -745,6 +745,11 @@ + "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4", + "x86_64-pc-linux-gnu", "32", "", triple); + ++ // Gentoo amd64 gcc 4.4.4 ++ AddGnuCPlusPlusIncludePaths( ++ "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4", ++ "x86_64-pc-linux-gnu", "32", "", triple); ++ + // Gentoo amd64 llvm-gcc trunk + AddGnuCPlusPlusIncludePaths( + "/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1", diff --git a/sys-devel/clang/files/clang-2.9-darwin-prefix.patch b/sys-devel/clang/files/clang-2.9-darwin-prefix.patch new file mode 100644 index 0000000..8f79e7f --- /dev/null +++ b/sys-devel/clang/files/clang-2.9-darwin-prefix.patch @@ -0,0 +1,125 @@ +--- tools/clang/lib/Driver/ToolChains.cpp.orig 2011-03-21 22:29:27.000000000 +0100 ++++ tools/clang/lib/Driver/ToolChains.cpp 2011-04-07 10:33:41.771314057 +0200 +@@ -139,7 +139,7 @@ + GCCVersion[2] = 1; + + // Set up the tool chain paths to match gcc. +- ToolChainDir = "i686-apple-darwin"; ++ ToolChainDir = "@GENTOO_PORTAGE_CHOST@"; + ToolChainDir += llvm::utostr(DarwinVersion[0]); + ToolChainDir += "/"; + ToolChainDir += llvm::utostr(GCCVersion[0]); +@@ -149,10 +149,10 @@ + ToolChainDir += llvm::utostr(GCCVersion[2]); + + // Try the next major version if that tool chain dir is invalid. +- std::string Tmp = "/usr/lib/gcc/" + ToolChainDir; ++ std::string Tmp = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir; + bool Exists; + if (llvm::sys::fs::exists(Tmp, Exists) || Exists) { +- std::string Next = "i686-apple-darwin"; ++ std::string Next = "@GENTOO_PORTAGE_CHOST_ARCH@"; + Next += llvm::utostr(DarwinVersion[0] + 1); + Next += "/"; + Next += llvm::utostr(GCCVersion[0]); +@@ -164,7 +164,7 @@ + // Use that if it exists, otherwise hope the user isn't linking. + // + // FIXME: Drop dependency on gcc's tool chain. +- Tmp = "/usr/lib/gcc/" + Next; ++ Tmp = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + Next; + if (!llvm::sys::fs::exists(Tmp, Exists) && Exists) + ToolChainDir = Next; + } +@@ -177,7 +177,7 @@ + Path += "/x86_64"; + getFilePaths().push_back(Path); + +- Path = "/usr/lib/gcc/"; ++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/"; + Path += ToolChainDir; + Path += "/x86_64"; + getFilePaths().push_back(Path); +@@ -188,7 +188,7 @@ + Path += ToolChainDir; + getFilePaths().push_back(Path); + +- Path = "/usr/lib/gcc/"; ++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/"; + Path += ToolChainDir; + getFilePaths().push_back(Path); + +@@ -197,7 +197,7 @@ + Path += ToolChainDir; + getProgramPaths().push_back(Path); + +- Path = "/usr/libexec/gcc/"; ++ Path = "@GENTOO_PORTAGE_EPREFIX@/usr/libexec/gcc/"; + Path += ToolChainDir; + getProgramPaths().push_back(Path); + +@@ -300,14 +300,14 @@ + + // FIXME: Derive these correctly. + if (getArchName() == "x86_64") { +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir + ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir + + "/x86_64")); + // Intentionally duplicated for (temporary) gcc bug compatibility. +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir + ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir + + "/x86_64")); + } + +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/" + ToolChainDir)); ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/" + ToolChainDir)); + + Tmp = getDriver().Dir + "/../lib/gcc/" + ToolChainDir; + bool Exists; +@@ -316,18 +316,18 @@ + Tmp = getDriver().Dir + "/../lib/gcc"; + if (!llvm::sys::fs::exists(Tmp, Exists) && Exists) + CmdArgs.push_back(Args.MakeArgString("-L" + Tmp)); +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir)); ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir)); + // Intentionally duplicated for (temporary) gcc bug compatibility. +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir)); ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir)); + Tmp = getDriver().Dir + "/../lib/" + ToolChainDir; + if (!llvm::sys::fs::exists(Tmp, Exists) && Exists) + CmdArgs.push_back(Args.MakeArgString("-L" + Tmp)); + Tmp = getDriver().Dir + "/../lib"; + if (!llvm::sys::fs::exists(Tmp, Exists) && Exists) + CmdArgs.push_back(Args.MakeArgString("-L" + Tmp)); +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir + ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir + + "/../../../" + ToolChainDir)); +- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir + ++ CmdArgs.push_back(Args.MakeArgString("-L@GENTOO_PORTAGE_EPREFIX@/usr/lib/gcc/" + ToolChainDir + + "/../../..")); + } + +@@ -416,22 +416,7 @@ + P.eraseComponent(); // .../usr/bin -> ../usr + P.appendComponent("lib"); + P.appendComponent("gcc"); +- switch (getTriple().getArch()) { +- default: +- assert(0 && "Invalid Darwin arch!"); +- case llvm::Triple::x86: +- case llvm::Triple::x86_64: +- P.appendComponent("i686-apple-darwin10"); +- break; +- case llvm::Triple::arm: +- case llvm::Triple::thumb: +- P.appendComponent("arm-apple-darwin10"); +- break; +- case llvm::Triple::ppc: +- case llvm::Triple::ppc64: +- P.appendComponent("powerpc-apple-darwin10"); +- break; +- } ++ P.appendComponent("@GENTOO_PORTAGE_CHOST@"); + P.appendComponent("4.2.1"); + + // Determine the arch specific GCC subdirectory. diff --git a/sys-devel/clang/files/clang-2.9-gccversions.patch b/sys-devel/clang/files/clang-2.9-gccversions.patch new file mode 100644 index 0000000..775a9e6 --- /dev/null +++ b/sys-devel/clang/files/clang-2.9-gccversions.patch @@ -0,0 +1,12 @@ +--- a/llvm-2.9/tools/clang/lib/Driver/ToolChains.cpp 2011-08-10 15:05:32.969155113 -0400 ++++ a/llvm-2.9/tools/clang/lib/Driver/ToolChains.cpp 2011-08-10 15:06:45.449159147 -0400 +@@ -1449,7 +1449,8 @@ + GccTriple = "i586-suse-linux"; + } + +- const char* GccVersions[] = {"4.5.2", "4.5.1", "4.5", "4.4.5", "4.4.4", ++ const char* GccVersions[] = {"4.6.2", "4.6.1", "4.6", "4.5.3", "4.5.2", ++ "4.5.1", "4.5", "4.4.6", "4.4.5", "4.4.4", + "4.4.3", "4.4", "4.3.4", "4.3.3", "4.3.2", + "4.3", "4.2.4", "4.2.3", "4.2.2", "4.2.1", + "4.2"}; diff --git a/sys-devel/clang/files/clang-3.0-fix_cxx_include_root.patch b/sys-devel/clang/files/clang-3.0-fix_cxx_include_root.patch new file mode 100644 index 0000000..e1beff3 --- /dev/null +++ b/sys-devel/clang/files/clang-3.0-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.000000000 +0100 +@@ -1586,12 +1586,13 @@ + // This is of the form /foo/bar/include/c++/4.5.2/ + if (CxxIncludeRoot.back() == '/') + 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 include + StringRef Version = llvm::sys::path::filename(CxxIncludeRoot); + llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the version +- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the c++ +- llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the include ++ llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the ARCH + GccInstallPath = 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.0-freebsd-runtime-gcc-detection.patch b/sys-devel/clang/files/clang-3.0-freebsd-runtime-gcc-detection.patch new file mode 100644 index 0000000..5c016f5 --- /dev/null +++ b/sys-devel/clang/files/clang-3.0-freebsd-runtime-gcc-detection.patch @@ -0,0 +1,20 @@ +diff -upNr a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp +--- a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 15:45:01.333127000 -0400 ++++ b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 16:16:26.023642076 -0400 +@@ -1215,6 +1215,16 @@ FreeBSD::FreeBSD(const HostInfo &Host, c + } else { + getFilePaths().push_back("/usr/lib"); + } ++ ++ llvm::OwningPtr<llvm::MemoryBuffer> File; ++ if (!llvm::MemoryBuffer::getFile("/etc/env.d/gcc/config-" + getDriver().DefaultHostTriple, File)) ++ { ++ bool Exists; ++ StringRef Version = File.get()->getBuffer().rsplit('-').second.substr(0,5); ++ const std::string GentooPath = "/usr/lib/gcc/" + getDriver().DefaultHostTriple + "/" + Version.str(); ++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists) ++ getFilePaths().push_back(GentooPath); ++ } + } + + Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA, diff --git a/sys-devel/clang/files/clang-3.0-gentoo-binutils-apple.patch b/sys-devel/clang/files/clang-3.0-gentoo-binutils-apple.patch new file mode 100644 index 0000000..944ccaf --- /dev/null +++ b/sys-devel/clang/files/clang-3.0-gentoo-binutils-apple.patch @@ -0,0 +1,29 @@ +http://llvm.org/bugs/show_bug.cgi?id=8339 +https://bugs.gentoo.org/show_bug.cgi?id=395013 +http://llvm.org/viewvc/llvm-project?view=rev&revision=151612 + +Tweak version detection bit to cope with Gentoo's slightly different +output for ld -v. + +--- autoconf/m4/link_options.m4 ++++ autoconf/m4/link_options.m4 +@@ -10,7 +10,7 @@ + + # Check for ld64. + if (echo "$version_string" | grep -q "ld64"); then +- llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)#\1#") ++ llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)\( (.*)\)\?#\1#") + else + llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#") + fi +--- configure ++++ configure +@@ -7528,7 +7528,7 @@ + + # Check for ld64. + if (echo "$version_string" | grep -q "ld64"); then +- llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)#\1#") ++ llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)\( (.*)\)\?#\1#") + else + llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#") + fi diff --git a/sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch b/sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch new file mode 100644 index 0000000..a1f7ce2 --- /dev/null +++ b/sys-devel/clang/files/clang-3.0-linux-runtime-gcc-detection.patch @@ -0,0 +1,43 @@ +diff -upNr a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp +--- a/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 15:39:01.070411000 -0400 ++++ b/llvm-3.0.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-23 15:39:22.371785000 -0400 +@@ -1382,6 +1382,7 @@ enum LinuxDistro { + DebianSqueeze, + DebianWheezy, + Exherbo, ++ Gentoo, + RHEL4, + RHEL5, + RHEL6, +@@ -1403,6 +1404,10 @@ enum LinuxDistro { + UnknownDistro + }; + ++static bool IsGentoo(enum LinuxDistro Distro) { ++ return Distro == Gentoo; ++} ++ + static bool IsRedhat(enum LinuxDistro Distro) { + return Distro == Fedora13 || Distro == Fedora14 || + Distro == Fedora15 || Distro == FedoraRawhide || +@@ -1433,7 +1438,9 @@ static LinuxDistro DetectLinuxDistro(llv + SmallVector<StringRef, 8> Lines; + Data.split(Lines, "\n"); + for (unsigned int i = 0, s = Lines.size(); i < s; ++ i) { +- if (Lines[i] == "DISTRIB_CODENAME=hardy") ++ if (Lines[i] == "DISTRIB_ID=\"Gentoo\"") ++ return Gentoo; ++ else if (Lines[i] == "DISTRIB_CODENAME=hardy") + return UbuntuHardy; + else if (Lines[i] == "DISTRIB_CODENAME=intrepid") + return UbuntuIntrepid; +@@ -1597,6 +1604,9 @@ Linux::GCCInstallationDetector::GCCInsta + GccInstallPath.append("/"); + GccInstallPath.append(CXX_INCLUDE_ARCH); + GccInstallPath.append("/"); ++ llvm::OwningPtr<llvm::MemoryBuffer> File; ++ if (!llvm::MemoryBuffer::getFile("/etc/env.d/gcc/config-" + D.DefaultHostTriple, File)) ++ Version = File.get()->getBuffer().rsplit('-').second.substr(0,5); + GccInstallPath.append(Version); + GccParentLibPath = GccInstallPath + "/../../.."; + IsValid = true; diff --git a/sys-devel/clang/files/clang-3.0-recognize-amd-k10-enable-sse4a.patch b/sys-devel/clang/files/clang-3.0-recognize-amd-k10-enable-sse4a.patch new file mode 100644 index 0000000..90f99ab --- /dev/null +++ b/sys-devel/clang/files/clang-3.0-recognize-amd-k10-enable-sse4a.patch @@ -0,0 +1,82 @@ +--- llvm.orig/contrib/llvm/tools/clang/lib/Basic/Targets.cpp 2011/10/22 14:08:43 226633 ++++ llvm/contrib/llvm/tools/clang/lib/Basic/Targets.cpp 2011/10/30 22:20:17 226951 +@@ -1282,6 +1282,7 @@ + CK_K8SSE3, + CK_Opteron, + CK_OpteronSSE3, ++ CK_AMDFAM10, + + /// This specification is deprecated and will be removed in the future. + /// Users should prefer \see CK_K8. +@@ -1381,6 +1382,7 @@ + .Case("k8-sse3", CK_K8SSE3) + .Case("opteron", CK_Opteron) + .Case("opteron-sse3", CK_OpteronSSE3) ++ .Case("amdfam10", CK_AMDFAM10) + .Case("x86-64", CK_x86_64) + .Case("geode", CK_Geode) + .Default(CK_Generic); +@@ -1441,6 +1443,7 @@ + case CK_K8SSE3: + case CK_Opteron: + case CK_OpteronSSE3: ++ case CK_AMDFAM10: + case CK_x86_64: + return true; + } +@@ -1459,12 +1462,10 @@ + Features["ssse3"] = false; + Features["sse41"] = false; + Features["sse42"] = false; ++ Features["sse4a"] = false; + Features["aes"] = false; + Features["avx"] = false; + +- // LLVM does not currently recognize this. +- // Features["sse4a"] = false; +- + // FIXME: This *really* should not be here. + + // X86_64 always has SSE2. +@@ -1561,6 +1562,11 @@ + setFeatureEnabled(Features, "sse3", true); + setFeatureEnabled(Features, "3dnowa", true); + break; ++ case CK_AMDFAM10: ++ setFeatureEnabled(Features, "sse3", true); ++ setFeatureEnabled(Features, "sse4a", true); ++ setFeatureEnabled(Features, "3dnowa", true); ++ break; + case CK_C3_2: + setFeatureEnabled(Features, "mmx", true); + setFeatureEnabled(Features, "sse", true); +@@ -1604,6 +1610,8 @@ + else if (Name == "avx") + Features["avx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["ssse3"] = Features["sse41"] = Features["sse42"] = true; ++ else if (Name == "sse4a") ++ Features["sse4a"] = true; + } else { + if (Name == "mmx") + Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false; +@@ -1630,6 +1638,8 @@ + Features["aes"] = false; + else if (Name == "avx") + Features["avx"] = false; ++ else if (Name == "sse4a") ++ Features["sse4a"] = false; + } + + return true; +@@ -1826,6 +1836,11 @@ + Builder.defineMacro("__k8__"); + Builder.defineMacro("__tune_k8__"); + break; ++ case CK_AMDFAM10: ++ Builder.defineMacro("__amdfam10"); ++ Builder.defineMacro("__amdfam10__"); ++ Builder.defineMacro("__tune_amdfam10__"); ++ break; + case CK_Geode: + Builder.defineMacro("__geode"); + Builder.defineMacro("__geode__"); diff --git a/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch new file mode 100644 index 0000000..1053bf3 --- /dev/null +++ b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch @@ -0,0 +1,188 @@ +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 +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,162 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, + } + } + ++void FreeBSD::AddClangSystemIncludeArgs(const ArgList &DriverArgs, ++ ArgStringList &CC1Args) const { ++ const Driver &D = getDriver(); ++ ++ if (DriverArgs.hasArg(options::OPT_nostdinc)) ++ return; ++ ++ if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) ++ addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/local/include"); ++ ++ 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 != "") { ++ SmallVector<StringRef, 5> dirs; ++ CIncludeDirs.split(dirs, ":"); ++ for (SmallVectorImpl<StringRef>::iterator I = dirs.begin(), E = dirs.end(); ++ I != E; ++I) { ++ StringRef Prefix = 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 for the ++ // target triple. ++ ++ // Implement generic Debian multiarch support. ++ const StringRef X86_64MultiarchIncludeDirs[] = { ++ "/usr/include/x86_64-linux-gnu", ++ ++ // FIXME: These are older forms of multiarch. It's not clear that they'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[] = { ++ "/usr/include/i386-linux-gnu", ++ ++ // FIXME: These are older forms of multiarch. It's not clear that they'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[] = { ++ "/usr/include/arm-linux-gnueabi" ++ }; ++ const StringRef MIPSMultiarchIncludeDirs[] = { ++ "/usr/include/mips-linux-gnu" ++ }; ++ const StringRef MIPSELMultiarchIncludeDirs[] = { ++ "/usr/include/mipsel-linux-gnu" ++ }; ++ const StringRef PPCMultiarchIncludeDirs[] = { ++ "/usr/include/powerpc-linux-gnu" ++ }; ++ const StringRef PPC64MultiarchIncludeDirs[] = { ++ "/usr/include/powerpc64-linux-gnu" ++ }; ++ ArrayRef<StringRef> MultiarchIncludeDirs; ++ if (getTriple().getArch() == llvm::Triple::x86_64) { ++ MultiarchIncludeDirs = X86_64MultiarchIncludeDirs; ++ } else if (getTriple().getArch() == llvm::Triple::x86) { ++ MultiarchIncludeDirs = X86MultiarchIncludeDirs; ++ } else if (getTriple().getArch() == llvm::Triple::arm) { ++ MultiarchIncludeDirs = ARMMultiarchIncludeDirs; ++ } else if (getTriple().getArch() == llvm::Triple::mips) { ++ MultiarchIncludeDirs = MIPSMultiarchIncludeDirs; ++ } else if (getTriple().getArch() == llvm::Triple::mipsel) { ++ MultiarchIncludeDirs = MIPSELMultiarchIncludeDirs; ++ } else if (getTriple().getArch() == llvm::Triple::ppc) { ++ MultiarchIncludeDirs = PPCMultiarchIncludeDirs; ++ } else if (getTriple().getArch() == llvm::Triple::ppc64) { ++ MultiarchIncludeDirs = PPC64MultiarchIncludeDirs; ++ } ++ for (ArrayRef<StringRef>::iterator I = MultiarchIncludeDirs.begin(), ++ E = MultiarchIncludeDirs.end(); ++ I != E; ++I) { ++ if (llvm::sys::fs::exists(D.SysRoot + *I)) { ++ addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + *I); ++ break; ++ } ++ } ++ ++ if (getTriple().getOS() == llvm::Triple::RTEMS) ++ return; ++ ++ // Add an include of '/include' directly. This isn't provided by default by ++ // system GCCs, but is often used with cross-compiling GCCs, and harmless 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/include"); ++} ++ ++/// \brief Helper to add the thre variant paths for a libstdc++ installation. ++/*static*/ bool FreeBSD::addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir, ++ const ArgList &DriverArgs, ++ 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) == 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 adjacent to ++ // the lib directory of the GCC installation. Note that this is expect to be ++ // equivalent to '/usr/include/c++/X.Y' in almost all cases. ++ StringRef LibDir = GCCInstallation.getParentLibPath(); ++ StringRef InstallDir = GCCInstallation.getInstallPath(); ++ StringRef Version = 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, so if the ++ // first attempt to find the headers fails, try this pattern. ++ addLibStdCXXIncludePaths(InstallDir + "/include/g++-v4", ++ (GCCInstallation.getTriple().str() + ++ GCCInstallation.getMultiarchSuffix()), ++ DriverArgs, CC1Args); ++ } ++} ++ + /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly. + + 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: + + 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) const; ++ ++private: ++ static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir, ++ const ArgList &DriverArgs, ++ ArgStringList &CC1Args); + }; + + 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..702606f --- /dev/null +++ b/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-lib-path.patch @@ -0,0 +1,20 @@ +This patch causes problem for multilib: GCCInstallation.getInstallPath() is +empty in that case and 'clang -m32 foo.c' will put a -L with nothing after it +but the .o file generated, effectively dropping it. +With recent freebsd-lib versions, it is only needed for c++ with libstdc++, +which is actually broken because clang++ cannot find the headers. it is fine +with clang++ -stdlib=libc++. +aballier@g.o + +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:08:48.393073000 -0400 ++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 04:11: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()); + } + + Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA, diff --git a/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch b/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch new file mode 100644 index 0000000..49f1085 --- /dev/null +++ b/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch @@ -0,0 +1,29 @@ +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:32:31.593191000 -0400 ++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:38:31.733163513 -0400 +@@ -1145,6 +1145,25 @@ Generic_GCC::GCCInstallationDetector::GC + Prefixes.push_back(D.InstalledDir + "/.."); + } + ++ llvm::OwningPtr<llvm::MemoryBuffer> File; ++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) { ++ if (!llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str(), File)) ++ { ++ bool Exists; ++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str(); ++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText; ++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists) ++ { ++ Version = GCCVersion::Parse(VersionText); ++ GCCInstallPath = GentooPath; ++ GCCParentLibPath = GCCInstallPath + "/../../.."; ++ GCCTriple.setTriple(CandidateTripleAliases[k]); ++ IsValid = true; ++ return; ++ } ++ } ++ } ++ + // Loop over the various components which exist and select the best GCC + // installation available. GCC installs are ranked by version number. + Version = GCCVersion::Parse("0.0.0"); 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 new file mode 100644 index 0000000..79f4f9f --- /dev/null +++ b/sys-devel/clang/files/clang-3.1-increase-parser-recursion-limit.patch @@ -0,0 +1,15 @@ +Backported from r155737. + +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 +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: + } + } + +- enum { MaxDepth = 256 }; ++ enum { MaxDepth = 512 }; + + bool diagnoseOverflow(); + bool diagnoseMissingClose(); diff --git a/sys-devel/clang/metadata.xml b/sys-devel/clang/metadata.xml new file mode 100644 index 0000000..466ad97 --- /dev/null +++ b/sys-devel/clang/metadata.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer> + <email>clang@gentoo.org</email> + <name>Gentoo clang support project</name> + </maintainer> + <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. + +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</longdescription> + <use> + <flag name='multitarget'>Build all host targets (default: host only)</flag> + <flag name='static-analyzer'>Install the Clang static analyzer</flag> + <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> + </use> +</pkgmetadata> |