[cfe-dev] Clang support for Arch Linux

Kevin Winchester kjwinchester at gmail.com
Thu Feb 24 16:39:30 PST 2011


Hi,

I need to apply the patch below in order for clang to work properly on
Arch Linux, due to errors finding crt*.o.  I am not sure if this is
the best way to fix the issue, but it seems to work for me.  I've
attached the patch as a file as well, since I know that GMail tends to
mangle them.

-- 
Kevin Winchester

---

Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp	(revision 126451)
+++ lib/Driver/ToolChains.cpp	(working copy)
@@ -1281,6 +1281,7 @@
   UbuntuKarmic,
   UbuntuLucid,
   UbuntuMaverick,
+  ArchLinux,
   UnknownDistro
 };

@@ -1367,6 +1368,9 @@
   if (!llvm::sys::fs::exists("/etc/exherbo-release", Exists) && Exists)
     return Exherbo;

+  if (!llvm::sys::fs::exists("/etc/arch-release", Exists) && Exists)
+    return ArchLinux;
+
   return UnknownDistro;
 }

@@ -1436,7 +1440,7 @@
       GccTriple = "i586-suse-linux";
   }

-  const char* GccVersions[] = {"4.5.1", "4.5", "4.4.5", "4.4.4",
"4.4.3", "4.4",
+  const char* GccVersions[] = {"4.5.2", "4.5.1", "4.5", "4.4.5",
"4.4.4", "4.4.3", "4.4",
                                "4.3.4", "4.3.3", "4.3.2", "4.3"};
   std::string Base = "";
   for (unsigned i = 0; i < sizeof(GccVersions)/sizeof(char*); ++i) {
@@ -1498,6 +1502,9 @@
       Distro == UbuntuKarmic)
     ExtraOpts.push_back("--build-id");

+  if (Distro == ArchLinux)
+    Lib = "lib";
+
   Paths.push_back(Base + Suffix);
   if (HasMultilib(Arch, Distro)) {
     if (IsOpenSuse(Distro) && Is32Bits)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: archlinux.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110224/5ee2d8e8/attachment.bin>


More information about the cfe-dev mailing list