[cfe-commits] r140999 - in /cfe/trunk: lib/Driver/ test/Driver/ test/Driver/Inputs/multilib_32bit_linux_tree/ test/Driver/Inputs/multilib_32bit_linux_tree/lib/ test/Driver/Inputs/multilib_32bit_linux_tree/lib32/ test/Driver/Inputs/multilib_32bit_linux_tree/lib64/ test/Driver/Inputs/multilib_32bit_linux_tree/usr/ test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/ test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/ test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux...
Chandler Carruth
chandlerc at gmail.com
Mon Oct 3 02:00:51 PDT 2011
Author: chandlerc
Date: Mon Oct 3 04:00:50 2011
New Revision: 140999
URL: http://llvm.org/viewvc/llvm-project?rev=140999&view=rev
Log:
Enable generic multilib support on 32bit hosts. Previously this was only
enabled for debian hosts, which is quite odd. I think all restriction on
when Clang attempts to use a multilib installation should go away. Clang
is fundamentally a cross compiler. It behaves more like GCC when built
as a cross compiler, and so it should just use multilib installs when
they are present on the system. However, there is a very specific
exemption for Exherbo, which I can't test on, so I'm leaving that in
place.
With this, check in a generic test tree for multilib on a 32-bit host.
This stubs out many directories that most distributions don't use but
that uptsream GCC supports. This is intended to be an agnostic test that
the driver behaves properly compared with the GCC driver it aims for
compatibility with.
Also, fix a bug in the driver that this testing exposed (see!) where it
was incorrectly testing the target architecture rather than the host
architecture.
If anyone is having trouble with the tree-structure stubs I'm creating
to test this, let me know and I can revisit the design. I chose this
over (for example) a tar-ball in order to make tests run faster at the
small, hopefully amortized VCS cost.
Added:
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib/.keep
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/.keep
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/.keep
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/.keep
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/.keep
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/.keep
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/.keep
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/.keep
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/
cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/.keep
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=140999&r1=140998&r2=140999&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 3 04:00:50 2011
@@ -1378,25 +1378,17 @@
Distro == UbuntuNatty || Distro == UbuntuOneiric;
}
-static bool IsDebianBased(enum LinuxDistro Distro) {
- return IsDebian(Distro) || IsUbuntu(Distro);
-}
-
+// FIXME: This should be deleted. We should assume a multilib environment, and
+// fallback gracefully if any parts of it are absent.
static bool HasMultilib(llvm::Triple::ArchType Arch, enum LinuxDistro Distro) {
if (Arch == llvm::Triple::x86_64) {
bool Exists;
if (Distro == Exherbo &&
(llvm::sys::fs::exists("/usr/lib32/libc.so", Exists) || !Exists))
return false;
-
- return true;
}
- if (Arch == llvm::Triple::ppc64)
- return true;
- if ((Arch == llvm::Triple::x86 || Arch == llvm::Triple::ppc) &&
- IsDebianBased(Distro))
- return true;
- return false;
+
+ return true;
}
static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) {
@@ -1690,7 +1682,7 @@
getArch() == llvm::Triple::ppc);
const std::string Suffix32 = Arch == llvm::Triple::x86_64 ? "/32" : "";
- const std::string Suffix64 = Is32Bits ? "/64" : "";
+ const std::string Suffix64 = Arch == llvm::Triple::x86_64 ? "" : "/64";
const std::string Suffix = Is32Bits ? Suffix32 : Suffix64;
const std::string Multilib = Is32Bits ? "lib32" : "lib64";
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib/.keep?rev=140999&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib32/.keep?rev=140999&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/lib64/.keep?rev=140999&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib/.keep?rev=140999&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib32/.keep?rev=140999&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/i386-unknown-linux/lib64/.keep?rev=140999&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/.keep?rev=140999&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o?rev=140999&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o?rev=140999&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib32/.keep?rev=140999&view=auto
==============================================================================
(empty)
Added: cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multilib_32bit_linux_tree/usr/lib64/.keep?rev=140999&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=140999&r1=140998&r2=140999&view=diff
==============================================================================
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Mon Oct 3 04:00:50 2011
@@ -24,3 +24,36 @@
// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
// CHECK-LD-64: "-L[[SYSROOT]]/lib"
// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -ccc-host-triple i386-unknown-linux -m32 \
+// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-32-TO-32 %s
+// CHECK-32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-32-TO-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib32"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib32"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
+// CHECK-32-TO-32: "-L[[SYSROOT]]/lib"
+// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -ccc-host-triple i386-unknown-linux -m64 \
+// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-32-TO-64 %s
+// CHECK-32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-32-TO-64: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/64"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib64"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib64"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
+// CHECK-32-TO-64: "-L[[SYSROOT]]/lib"
+// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib"
More information about the cfe-commits
mailing list