I submitted these patches to http://llvm.org/bugs/show_bug.cgi?id=14417 yesterday, and was directed to resubmit them on this mailing list.

This is what I posted on the bug report:
=====================================================================
DragonFly is unique in that it has two base compilers. For a few years, those compilers were gcc 4.1 and gcc 4.4. At first gcc 4.1 was the primary compiler, and now gcc 4.4 is the primary compiler.

For the latest release, gcc 4.7 was brought into base and gcc 4.1 removed. At this point, clang stopped working on DragonFly because it had gcc41 in its internal search path.

The clang driver looks for crt* stuff in /usr/lib/gcc41, which no longer
exists.  The standard c++ library is also located there.

The attached patch changes the driver to first look in /usr/lib/gcc47 and then fallback to /usr/lib/gcc44. The fallback should guarantee that the latest clangs run on several past releases of DragonFly BSD as well as the latest version.

The patches were generated against clang release 3.1.
=====================================================================

The patch is attached. It would be great if it made it into branch 3.2 as well.

Regards,
John

$NetBSD$

DragonFly no longer has gcc 4.1 in base, so clang stopped working.
We prefer to use gcc 4.7 if available due to a better libstdc++.
The fallback is gcc 4.4 which has been available for several years.

--- tools/clang/lib/Driver/ToolChains.cpp.orig  2012-05-12 00:16:02.000000000 
+0000
+++ tools/clang/lib/Driver/ToolChains.cpp
@@ -2307,7 +2307,8 @@ DragonFly::DragonFly(const Driver &D, co
 
   getFilePaths().push_back(getDriver().Dir + "/../lib");
   getFilePaths().push_back("/usr/lib");
-  getFilePaths().push_back("/usr/lib/gcc41");
+  getFilePaths().push_back("/usr/lib/gcc47");
+  getFilePaths().push_back("/usr/lib/gcc44");
 }
 
 Tool &DragonFly::SelectTool(const Compilation &C, const JobAction &JA,
--- tools/clang/lib/Driver/Tools.cpp.orig       2012-04-18 21:32:25.000000000 
+0000
+++ tools/clang/lib/Driver/Tools.cpp
@@ -5499,14 +5499,21 @@ void dragonfly::Link::ConstructJob(Compi
       !Args.hasArg(options::OPT_nodefaultlibs)) {
     // FIXME: GCC passes on -lgcc, -lgcc_pic and a whole lot of
     //         rpaths
-    CmdArgs.push_back("-L/usr/lib/gcc41");
+    CmdArgs.push_back("-L/usr/lib/gcc47");
+    CmdArgs.push_back("-L/usr/lib/gcc44");
 
     if (!Args.hasArg(options::OPT_static)) {
       CmdArgs.push_back("-rpath");
-      CmdArgs.push_back("/usr/lib/gcc41");
+      CmdArgs.push_back("/usr/lib/gcc47");
 
       CmdArgs.push_back("-rpath-link");
-      CmdArgs.push_back("/usr/lib/gcc41");
+      CmdArgs.push_back("/usr/lib/gcc47");
+
+      CmdArgs.push_back("-rpath");
+      CmdArgs.push_back("/usr/lib/gcc44");
+
+      CmdArgs.push_back("-rpath-link");
+      CmdArgs.push_back("/usr/lib/gcc44");
 
       CmdArgs.push_back("-rpath");
       CmdArgs.push_back("/usr/lib");
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to