> Sure thing.
> openSUSE 11.1, 64bit:
> # gcc -v -m32 t.cc 2>&1 | sed -n '/^ /p' | sed -n 2,3p
> /usr/include/c++/4.3
> /usr/include/c++/4.3/x86_64-suse-linux/32
> gcc -v -m64 t.cc 2>&1 | sed -n '/^ /p' | sed -n 2,3p
> /usr/include/c++/4.3
> /usr/include/c++/4.3/x86_64-suse-linux
> Please note that the "32" in the path for -m32 is a symlink to the
> directory it is in and thus superfluous, so removing it would yield the
> paths we have now.
Thanks. I added it to the patch anyway. Making it similar to gcc makes
it easier to
(for example) compare preprocessed output.
> I have to admit that I don't understand why you need one entry for
> openSUSE 11.2 32bit and one for 64bit. Doesn't the new
> AddGnuCPlusPlusIncludePaths have the parameters to merge these two
> entries? Same applies to the openSUSE 11.1 entries. Or is this all about
> the compiler target arch instead of the OS arch? Then it would make sense.
It is about the -m32/-m64 options :-)
I assume that 32 and 64 bit openSUSE means that binaries are 32 or 64 bits
(run file /bin/bash). In both cases gcc should be able to produce 32 and 64 bit
binaries, and have different search paths.
>From what is in InitHeaderSearch.cpp I assume that a 32 bit openSUSE 11.2
searches in
/usr/include/c++/4.4/i586-suse-linux for 32 bit
and
/usr/include/c++/4.4/i586-suse-linux/something for 64 bit
What I will work next is on making this available at compile time via
configure :-)
> Regards,
> Carl-Daniel
>
> --
> Developer quote of the week:
> "We are juggling too many chainsaws and flaming arrows and tigers."
>
>
Cheers,
--
Rafael Ávila de Espíndola
Index: include/clang/Frontend/InitHeaderSearch.h
===================================================================
--- include/clang/Frontend/InitHeaderSearch.h (revision 84011)
+++ include/clang/Frontend/InitHeaderSearch.h (working copy)
@@ -59,7 +59,9 @@
/// AddGnuCPlusPlusIncludePaths - Add the necessary paths to suport a gnu
/// libstdc++.
- void AddGnuCPlusPlusIncludePaths(const std::string &Base, const char *Arch);
+ void AddGnuCPlusPlusIncludePaths(const std::string &Base, const char *Dir32,
+ const char *Dir64,
+ const llvm::Triple &triple);
/// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to suport a MinGW
/// libstdc++.
Index: lib/Frontend/InitHeaderSearch.cpp
===================================================================
--- lib/Frontend/InitHeaderSearch.cpp (revision 84011)
+++ lib/Frontend/InitHeaderSearch.cpp (working copy)
@@ -103,10 +103,18 @@
}
void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(const std::string &Base,
- const char *Arch) {
- AddPath(Base, System, true, false, false);
- AddPath(Base + "/" + Arch, System, true, false, false);
- AddPath(Base + "/backward", System, true, false, false);
+ const char *Dir32,
+ const char *Dir64,
+ const llvm::Triple &triple) {
+ llvm::Triple::ArchType arch = triple.getArch();
+ bool is64bit = arch == llvm::Triple::ppc64 || arch == llvm::Triple::x86_64;
+
+ AddPath(Base, System, true, false, false);
+ if (is64bit)
+ AddPath(Base + "/" + Dir64, System, true, false, false);
+ else
+ AddPath(Base + "/" + Dir32, System, true, false, false);
+ AddPath(Base + "/backward", System, true, false, false);
}
void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(const std::string &Base,
@@ -234,7 +242,7 @@
}
void InitHeaderSearch::AddDefaultSystemIncludePaths(const LangOptions &Lang,
- const llvm::Triple &triple) {
+ const llvm::Triple &triple) {
// FIXME: temporary hack: hard-coded paths.
llvm::Triple::OSType os = triple.getOS();
@@ -299,56 +307,91 @@
switch (os) {
case llvm::Triple::Darwin:
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
- "i686-apple-darwin10");
+ "i686-apple-darwin10",
+ "i686-apple-darwin10/x86_64",
+ triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
- "i686-apple-darwin8");
+ "i686-apple-darwin8",
+ "i686-apple-darwin8",
+ triple);
break;
case llvm::Triple::Linux:
// Ubuntu 7.10 - Gutsy Gibbon
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.3",
- "i486-linux-gnu");
+ "i486-linux-gnu",
+ "i486-linux-gnu",
+ triple);
// Ubuntu 9.04
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.3",
- "x86_64-linux-gnu");
+ "x86_64-linux-gnu/32",
+ "x86_64-linux-gnu",
+ triple);
// Fedora 8
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2",
- "i386-redhat-linux");
+ "i386-redhat-linux",
+ "i386-redhat-linux",
+ triple);
// Fedora 9
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0",
- "i386-redhat-linux");
+ "i386-redhat-linux",
+ "i386-redhat-linux",
+ triple);
// Fedora 10
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
- "i386-redhat-linux");
- // openSUSE 11.1
+ "i386-redhat-linux",
+ "i386-redhat-linux",
+ triple);
+ // openSUSE 11.1 32 bit
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
- "i586-suse-linux");
+ "i586-suse-linux",
+ "i586-suse-linux",
+ triple);
+ // openSUSE 11.1 64 bit
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
- "x86_64-suse-linux");
+ "x86_64-suse-linux/32",
+ "x86_64-suse-linux",
+ triple);
// openSUSE 11.2
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
- "i586-suse-linux");
+ "i586-suse-linux",
+ "i586-suse-linux",
+ triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
- "x86_64-suse-linux");
+ "x86_64-suse-linux",
+ "x86_64-suse-linux",
+ triple);
// Arch Linux 2008-06-24
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1",
- "i686-pc-linux-gnu");
+ "i686-pc-linux-gnu",
+ "i686-pc-linux-gnu",
+ triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1",
- "x86_64-unknown-linux-gnu");
+ "x86_64-unknown-linux-gnu",
+ "x86_64-unknown-linux-gnu",
+ triple);
// Gentoo x86 2009.0 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4",
- "i686-pc-linux-gnu");
+ "i686-pc-linux-gnu",
+ "i686-pc-linux-gnu",
+ triple);
// Gentoo x86 2008.0 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4",
- "i686-pc-linux-gnu");
+ "i686-pc-linux-gnu",
+ "i686-pc-linux-gnu",
+ triple);
// Ubuntu 8.10
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
- "i486-pc-linux-gnu");
+ "i486-pc-linux-gnu",
+ "i486-pc-linux-gnu",
+ triple);
// Gentoo amd64 stable
AddGnuCPlusPlusIncludePaths(
"/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4",
- "i686-pc-linux-gnu");
+ "i686-pc-linux-gnu",
+ "i686-pc-linux-gnu",
+ triple);
break;
case llvm::Triple::FreeBSD:
// DragonFly
@@ -359,7 +402,9 @@
case llvm::Triple::Solaris:
// AuroraUX
AddGnuCPlusPlusIncludePaths("/opt/gcc4/include/c++/4.2.4",
- "i386-pc-solaris2.11");
+ "i386-pc-solaris2.11",
+ "i386-pc-solaris2.11",
+ triple);
break;
default:
break;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits