[PATCH] Support cross-compiling for Arm on x86

Chandler Carruth chandlerc at gmail.com
Wed Oct 30 10:29:42 PDT 2013

Comment at: lib/Driver/ToolChains.cpp:2704-2711
@@ -2697,1 +2703,10 @@
+  llvm::error_code EC;
+  for (llvm::sys::fs::directory_iterator LI(ParentPath.str(), EC), LE;
+       !EC && LI != LE; LI = LI.increment(EC)) {
+    StringRef VersionText = llvm::sys::path::filename(LI->path());
+    if (addLibStdCXXIncludePaths(GCCMultiArchDir + VersionText.str(),
+                                 TripleStr + BiarchSuffix,
+                                 DriverArgs, CC1Args))
+      break;
+  }
This looks completely wrong. It is adding the first version of the headers that happens to be found by walking the directory. This isn't even going to be the newest, it could be literally *any* version.

What problem are you actually trying to solve? Is it that the GCC installation is under a Major.Minor directory, and the headers are under a Major.Minor.Patch directory? Why on earth would that happen? It doesn't make any sense to me and so doesn't seem like something we should really support. I expect the GCC installation to have the same version number spelling as the libstdc++ installation, which seems like a sane place to be. Anything else and we're running the risk of version skew.


More information about the cfe-commits mailing list