[cfe-commits] r141145 - in /cfe/trunk: lib/Driver/ test/Driver/ test/Driver/Inputs/fake_install_tree/ test/Driver/Inputs/fake_install_tree/lib/ test/Driver/Inputs/fake_install_tree/lib/gcc/ test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/ test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/ test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/ test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/
Chandler Carruth
chandlerc at gmail.com
Tue Oct 4 18:01:59 PDT 2011
Author: chandlerc
Date: Tue Oct 4 20:01:57 2011
New Revision: 141145
URL: http://llvm.org/viewvc/llvm-project?rev=141145&view=rev
Log:
Implement the feature I was originally driving toward when I started
this saga. Teach the driver to detect a GCC installed along side Clang
using the existing InstalledDir support in the Clang driver. This makes
a lot of Clang's behavior more automatic when it is installed along side
GCC.
Also include the first test cases (more to come, honest) which test both
the install directory behavior, and the version sorting behavior to show
that we're actually searching for the best candidate GCC installation
now.
Added:
cfe/trunk/test/Driver/Inputs/fake_install_tree/
cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/
cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/
cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/
cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/
cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o
cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/
cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/
cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/crtbegin.o
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/linux-ld.c
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=141145&r1=141144&r2=141145&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Oct 4 20:01:57 2011
@@ -1587,6 +1587,7 @@
D.PrefixDirs.end());
Prefixes.push_back(D.SysRoot);
Prefixes.push_back(D.SysRoot + "/usr");
+ Prefixes.push_back(D.InstalledDir);
// Loop over the various components which exist and select the best GCC
// installation available. GCC installs are ranked by version number.
Added: cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o?rev=141145&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/crtbegin.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/fake_install_tree/lib/gcc/x86_64-unknown-linux/4.5.0/crtbegin.o?rev=141145&view=auto
==============================================================================
(empty)
Modified: cfe/trunk/test/Driver/linux-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=141145&r1=141144&r2=141145&view=diff
==============================================================================
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Tue Oct 4 20:01:57 2011
@@ -90,3 +90,23 @@
// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
// CHECK-64-TO-32: "-L[[SYSROOT]]/lib"
// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -ccc-host-triple i386-unknown-linux -m32 \
+// RUN: -ccc-install-dir %S/Inputs/fake_install_tree \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-32 %s
+// CHECK-INSTALL-DIR-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-INSTALL-DIR-32: "{{.*}}/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o"
+// CHECK-INSTALL-DIR-32: "-L{{.*}}/Inputs/fake_install_tree/lib/gcc/i386-unknown-linux/4.7.0"
+//
+// Check that with 64-bit builds, we don't actually use the install directory
+// as its version of GCC is lower than our sysrooted version.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -ccc-host-triple x86_64-unknown-linux -m64 \
+// RUN: -ccc-install-dir %S/Inputs/fake_install_tree \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-64 %s
+// CHECK-INSTALL-DIR-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-INSTALL-DIR-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o"
+// CHECK-INSTALL-DIR-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
More information about the cfe-commits
mailing list