[cfe-commits] r146142 - /cfe/trunk/lib/Driver/ToolChains.cpp

Hal Finkel hfinkel at anl.gov
Wed Dec 7 21:50:03 PST 2011


Author: hfinkel
Date: Wed Dec  7 23:50:03 2011
New Revision: 146142

URL: http://llvm.org/viewvc/llvm-project?rev=146142&view=rev
Log:
Allow clang to find gcc libs on suse ppc64

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=146142&r1=146141&r2=146142&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Dec  7 23:50:03 2011
@@ -1256,7 +1256,8 @@
     static const char *const PPCLibDirs[] = { "/lib32", "/lib" };
     static const char *const PPCTriples[] = {
       "powerpc-linux-gnu",
-      "powerpc-unknown-linux-gnu"
+      "powerpc-unknown-linux-gnu",
+      "powerpc-suse-linux"
     };
     LibDirs.append(PPCLibDirs, PPCLibDirs + llvm::array_lengthof(PPCLibDirs));
     Triples.append(PPCTriples, PPCTriples + llvm::array_lengthof(PPCTriples));
@@ -1264,6 +1265,7 @@
     static const char *const PPC64LibDirs[] = { "/lib64", "/lib" };
     static const char *const PPC64Triples[] = {
       "powerpc64-unknown-linux-gnu",
+      "powerpc64-suse-linux",
       "ppc64-redhat-linux"
     };
     LibDirs.append(PPC64LibDirs,
@@ -1309,6 +1311,16 @@
         continue;
       if (CandidateVersion <= Version)
         continue;
+
+      // Some versions of SUSE and Fedora on ppc64 put 32-bit libs
+      // in what would normally be GccInstallPath and put the 64-bit
+      // libs in a subdirectory named 64. We need the 64-bit libs
+      // for linking.
+      bool UseSlash64 = false;
+      if (HostArch == llvm::Triple::ppc64 &&
+            llvm::sys::fs::exists(LI->path() + "/64/crtbegin.o"))
+        UseSlash64 = true;
+
       if (!llvm::sys::fs::exists(LI->path() + "/crtbegin.o"))
         continue;
 
@@ -1319,6 +1331,7 @@
       // Linux.
       GccInstallPath = LibDir + Suffixes[i] + "/" + VersionText.str();
       GccParentLibPath = GccInstallPath + InstallSuffixes[i];
+      if (UseSlash64) GccInstallPath = GccInstallPath + "/64";
       IsValid = true;
     }
   }





More information about the cfe-commits mailing list