]> granicus.if.org Git - clang/commitdiff
Fix gcc search for cross-compiler on Ubuntu 13.04.
authorEli Friedman <eli.friedman@gmail.com>
Fri, 26 Jul 2013 00:53:40 +0000 (00:53 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 26 Jul 2013 00:53:40 +0000 (00:53 +0000)
Just more craziness to find crtbegin.o etc.

Patch by Stephen Kelly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187175 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains.cpp
test/Driver/Inputs/ubuntu_13.04_multiarch_tree/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/crtbegin.o [new file with mode: 0644]
test/Driver/linux-header-search.cpp

index d41be3dbf5ade6628b4b466e9fee8b9fccfd7cb3..90851b49ad0049bbc59b7b7b5a1f8419870cf6dc 100644 (file)
@@ -1343,6 +1343,8 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
   // up to the lib directory.
   const std::string LibSuffixes[] = {
     "/gcc/" + CandidateTriple.str(),
+    // Debian puts cross-compilers in gcc-cross
+    "/gcc-cross/" + CandidateTriple.str(),
     "/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(),
 
     // The Freescale PPC SDK has the gcc libraries in
@@ -1355,8 +1357,13 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
     // triple.
     "/i386-linux-gnu/gcc/" + CandidateTriple.str()
   };
-  const std::string InstallSuffixes[] = { "/../../..", "/../../../..", "/../..",
-                                          "/../../../.." };
+  const std::string InstallSuffixes[] = {
+    "/../../..",    // gcc/
+    "/../../..",    // gcc-cross/
+    "/../../../..", // <triple>/gcc/
+    "/../..",       // <triple>/
+    "/../../../.."  // i386-linux-gnu/gcc/<triple>/
+  };
   // Only look at the final, weird Ubuntu suffix for i386-linux-gnu.
   const unsigned NumLibSuffixes =
       (llvm::array_lengthof(LibSuffixes) - (TargetArch != llvm::Triple::x86));
diff --git a/test/Driver/Inputs/ubuntu_13.04_multiarch_tree/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/crtbegin.o b/test/Driver/Inputs/ubuntu_13.04_multiarch_tree/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/crtbegin.o
new file mode 100644 (file)
index 0000000..c6cac69
--- /dev/null
@@ -0,0 +1 @@
+empty
index 1a85f9aae5f9afcf302e2aa12366e4918c9b40e2..e9ccf62864f08498e3512b2c42fdfa9b24ce995e 100644 (file)
 // CHECK-UBUNTU-13-04: "-internal-externc-isystem" "[[SYSROOT]]/include"
 // CHECK-UBUNTU-13-04: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
 //
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN:     -target arm-linux-gnueabihf \
+// RUN:     --sysroot=%S/Inputs/ubuntu_13.04_multiarch_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-UBUNTU-13-04-CROSS %s
+// CHECK-UBUNTU-13-04-CROSS: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
+// CHECK-UBUNTU-13-04-CROSS: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../include/c++/4.7"
+// CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../include/c++/4.7/backward"
+// CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../include/arm-linux-gnueabihf/c++/4.7"
+// CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
+// CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "{{.*}}/lib{{(64|32)?}}/clang/{{[0-9]\.[0-9]}}/include"
+// CHECK-UBUNTU-13-04-CROSS: "-internal-externc-isystem" "[[SYSROOT]]/include"
+// CHECK-UBUNTU-13-04-CROSS: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
+//
 // Test Ubuntu/Debian's new version of multiarch, with -m32.
 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
 // RUN:     -target x86_64-unknown-linux-gnu -m32 \