Gentoo Archives: gentoo-commits

From: "Richard Yao (ryao)" <ryao@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-devel/clang/files: clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch clang-3.1-gentoo-runtime-gcc-detection-v3.patch clang-3.1-gentoo-runtime-gcc-detection-v2.patch
Date: Thu, 07 Jun 2012 00:28:13
Message-Id: 20120607002756.17E3F2004C@flycatcher.gentoo.org
1 ryao 12/06/07 00:27:56
2
3 Added: clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch
4 clang-3.1-gentoo-runtime-gcc-detection-v3.patch
5 Removed: clang-3.1-gentoo-runtime-gcc-detection-v2.patch
6 Log:
7 Fix bug #417913
8
9 (Portage version: 2.1.10.49/cvs/Linux x86_64)
10
11 Revision Changes Path
12 1.1 sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch?rev=1.1&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch?rev=1.1&content-type=text/plain
16
17 Index: clang-3.1-gentoo-freebsd-fix-cxx-paths-v2.patch
18 ===================================================================
19 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
20 index 1e282f2..1d6835b 100644
21 --- a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp
22 +++ b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp
23 @@ -2305,6 +2305,162 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
24 }
25 }
26
27 +void FreeBSD::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
28 + ArgStringList &CC1Args) const {
29 + const Driver &D = getDriver();
30 +
31 + if (DriverArgs.hasArg(options::OPT_nostdinc))
32 + return;
33 +
34 + if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
35 + addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/local/include");
36 +
37 + if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
38 + llvm::sys::Path P(D.ResourceDir);
39 + P.appendComponent("include");
40 + addSystemInclude(DriverArgs, CC1Args, P.str());
41 + }
42 +
43 + if (DriverArgs.hasArg(options::OPT_nostdlibinc))
44 + return;
45 +
46 + // Check for configure-time C include directories.
47 + StringRef CIncludeDirs(C_INCLUDE_DIRS);
48 + if (CIncludeDirs != "") {
49 + SmallVector<StringRef, 5> dirs;
50 + CIncludeDirs.split(dirs, ":");
51 + for (SmallVectorImpl<StringRef>::iterator I = dirs.begin(), E = dirs.end();
52 + I != E; ++I) {
53 + StringRef Prefix = llvm::sys::path::is_absolute(*I) ? D.SysRoot : "";
54 + addExternCSystemInclude(DriverArgs, CC1Args, Prefix + *I);
55 + }
56 + return;
57 + }
58 +
59 + // Lacking those, try to detect the correct set of system includes for the
60 + // target triple.
61 +
62 + // Implement generic Debian multiarch support.
63 + const StringRef X86_64MultiarchIncludeDirs[] = {
64 + "/usr/include/x86_64-linux-gnu",
65 +
66 + // FIXME: These are older forms of multiarch. It's not clear that they're
67 + // in use in any released version of Debian, so we should consider
68 + // removing them.
69 + "/usr/include/i686-linux-gnu/64",
70 + "/usr/include/i486-linux-gnu/64"
71 + };
72 + const StringRef X86MultiarchIncludeDirs[] = {
73 + "/usr/include/i386-linux-gnu",
74 +
75 + // FIXME: These are older forms of multiarch. It's not clear that they're
76 + // in use in any released version of Debian, so we should consider
77 + // removing them.
78 + "/usr/include/x86_64-linux-gnu/32",
79 + "/usr/include/i686-linux-gnu",
80 + "/usr/include/i486-linux-gnu"
81 + };
82 + const StringRef ARMMultiarchIncludeDirs[] = {
83 + "/usr/include/arm-linux-gnueabi"
84 + };
85 + const StringRef MIPSMultiarchIncludeDirs[] = {
86 + "/usr/include/mips-linux-gnu"
87 + };
88 + const StringRef MIPSELMultiarchIncludeDirs[] = {
89 + "/usr/include/mipsel-linux-gnu"
90 + };
91 + const StringRef PPCMultiarchIncludeDirs[] = {
92 + "/usr/include/powerpc-linux-gnu"
93 + };
94 + const StringRef PPC64MultiarchIncludeDirs[] = {
95 + "/usr/include/powerpc64-linux-gnu"
96 + };
97 + ArrayRef<StringRef> MultiarchIncludeDirs;
98 + if (getTriple().getArch() == llvm::Triple::x86_64) {
99 + MultiarchIncludeDirs = X86_64MultiarchIncludeDirs;
100 + } else if (getTriple().getArch() == llvm::Triple::x86) {
101 + MultiarchIncludeDirs = X86MultiarchIncludeDirs;
102 + } else if (getTriple().getArch() == llvm::Triple::arm) {
103 + MultiarchIncludeDirs = ARMMultiarchIncludeDirs;
104 + } else if (getTriple().getArch() == llvm::Triple::mips) {
105 + MultiarchIncludeDirs = MIPSMultiarchIncludeDirs;
106 + } else if (getTriple().getArch() == llvm::Triple::mipsel) {
107 + MultiarchIncludeDirs = MIPSELMultiarchIncludeDirs;
108 + } else if (getTriple().getArch() == llvm::Triple::ppc) {
109 + MultiarchIncludeDirs = PPCMultiarchIncludeDirs;
110 + } else if (getTriple().getArch() == llvm::Triple::ppc64) {
111 + MultiarchIncludeDirs = PPC64MultiarchIncludeDirs;
112 + }
113 + for (ArrayRef<StringRef>::iterator I = MultiarchIncludeDirs.begin(),
114 + E = MultiarchIncludeDirs.end();
115 + I != E; ++I) {
116 + if (llvm::sys::fs::exists(D.SysRoot + *I)) {
117 + addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + *I);
118 + break;
119 + }
120 + }
121 +
122 + if (getTriple().getOS() == llvm::Triple::RTEMS)
123 + return;
124 +
125 + // Add an include of '/include' directly. This isn't provided by default by
126 + // system GCCs, but is often used with cross-compiling GCCs, and harmless to
127 + // add even when Clang is acting as-if it were a system compiler.
128 + addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include");
129 +
130 + addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/include");
131 +}
132 +
133 +/// \brief Helper to add the thre variant paths for a libstdc++ installation.
134 +/*static*/ bool FreeBSD::addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
135 + const ArgList &DriverArgs,
136 + ArgStringList &CC1Args) {
137 + if (!llvm::sys::fs::exists(Base))
138 + return false;
139 + addSystemInclude(DriverArgs, CC1Args, Base);
140 + addSystemInclude(DriverArgs, CC1Args, Base + "/" + TargetArchDir);
141 + addSystemInclude(DriverArgs, CC1Args, Base + "/backward");
142 + return true;
143 +}
144 +
145 +void FreeBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
146 + ArgStringList &CC1Args) const {
147 + if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
148 + DriverArgs.hasArg(options::OPT_nostdincxx))
149 + return;
150 +
151 + // Check if libc++ has been enabled and provide its include paths if so.
152 + if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) {
153 + // libc++ is always installed at a fixed path on Linux currently.
154 + addSystemInclude(DriverArgs, CC1Args,
155 + getDriver().SysRoot + "/usr/include/c++/v1");
156 + return;
157 + }
158 +
159 + // We need a detected GCC installation on Linux to provide libstdc++'s
160 + // headers. We handled the libc++ case above.
161 + if (!GCCInstallation.isValid())
162 + return;
163 +
164 + // By default, look for the C++ headers in an include directory adjacent to
165 + // the lib directory of the GCC installation. Note that this is expect to be
166 + // equivalent to '/usr/include/c++/X.Y' in almost all cases.
167 + StringRef LibDir = GCCInstallation.getParentLibPath();
168 + StringRef InstallDir = GCCInstallation.getInstallPath();
169 + StringRef Version = GCCInstallation.getVersion();
170 + if (!addLibStdCXXIncludePaths(LibDir + "/../include/c++/" + Version,
171 + (GCCInstallation.getTriple().str() +
172 + GCCInstallation.getMultiarchSuffix()),
173 + DriverArgs, CC1Args)) {
174 + // Gentoo is weird and places its headers inside the GCC install, so if the
175 + // first attempt to find the headers fails, try this pattern.
176 + addLibStdCXXIncludePaths(InstallDir + "/include/g++-v4",
177 + (GCCInstallation.getTriple().str() +
178 + GCCInstallation.getMultiarchSuffix()),
179 + DriverArgs, CC1Args);
180 + }
181 +}
182 +
183 /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
184
185 DragonFly::DragonFly(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
186 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
187 index eaa6be1..bba891e 100644
188 --- a/a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h
189 +++ b/b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.h
190 @@ -489,6 +489,16 @@ public:
191
192 virtual Tool &SelectTool(const Compilation &C, const JobAction &JA,
193 const ActionList &Inputs) const;
194 +
195 + virtual void AddClangSystemIncludeArgs(const ArgList &DriverArgs,
196 + ArgStringList &CC1Args) const;
197 + virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
198 + ArgStringList &CC1Args) const;
199 +
200 +private:
201 + static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
202 + const ArgList &DriverArgs,
203 + ArgStringList &CC1Args);
204 };
205
206 class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {
207
208
209
210 1.1 sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch
211
212 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch?rev=1.1&view=markup
213 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/clang/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch?rev=1.1&content-type=text/plain
214
215 Index: clang-3.1-gentoo-runtime-gcc-detection-v3.patch
216 ===================================================================
217 diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp
218 --- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:32:31.593191000 -0400
219 +++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:38:31.733163513 -0400
220 @@ -1145,6 +1145,25 @@ Generic_GCC::GCCInstallationDetector::GC
221 Prefixes.push_back(D.InstalledDir + "/..");
222 }
223
224 + llvm::OwningPtr<llvm::MemoryBuffer> File;
225 + for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) {
226 + if (!llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str(), File))
227 + {
228 + bool Exists;
229 + const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str();
230 + const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText;
231 + if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists)
232 + {
233 + Version = GCCVersion::Parse(VersionText);
234 + GCCInstallPath = GentooPath;
235 + GCCParentLibPath = GCCInstallPath + "/../../..";
236 + GCCTriple.setTriple(CandidateTripleAliases[k]);
237 + IsValid = true;
238 + return;
239 + }
240 + }
241 + }
242 +
243 // Loop over the various components which exist and select the best GCC
244 // installation available. GCC installs are ranked by version number.
245 Version = GCCVersion::Parse("0.0.0");