Teach the driver to not try to use 'lib32' multilib spellings on ARM
which doesn't use that multilib. As a consequence, fix Clang's support for cross compiling environments that were relying on this quirk to ensure the correct library search path ordering. This also re-instates the new test cases from Rafael's r193528 for cross-compiling to ARM on Ubuntu 13.10 without any of the changes to the existing test cases (they were no longer needed). This solution was the result of a lot of IRC debugging and trying to understand *exactly* what quirk was being relied upon. It took some time for me to figure out that it was the use of 'lib32' is a multilib that was throwing a wrench in the works. In case you are thinking that its silly to use a multilib of 'lib' at all, entertainingly, GCC does so as well (you can see it with the .../lib/../lib/crt1.o pattern it uses), and the 2-phase sequence of search paths (multilib followed by non-multilib) has observable (if dubious) consequences. =/ Yuck. llvm-svn: 193601
This commit is contained in:
parent
18b5701a68
commit
da797048d9
|
@ -2264,13 +2264,26 @@ static void addPathIfExists(Twine Path, ToolChain::path_list &Paths) {
|
|||
|
||||
static StringRef getMultilibDir(const llvm::Triple &Triple,
|
||||
const ArgList &Args) {
|
||||
if (!isMipsArch(Triple.getArch()))
|
||||
return Triple.isArch32Bit() ? "lib32" : "lib64";
|
||||
if (isMipsArch(Triple.getArch())) {
|
||||
// lib32 directory has a special meaning on MIPS targets.
|
||||
// It contains N32 ABI binaries. Use this folder if produce
|
||||
// code for N32 ABI only.
|
||||
if (hasMipsN32ABIArg(Args))
|
||||
return "lib32";
|
||||
return Triple.isArch32Bit() ? "lib" : "lib64";
|
||||
}
|
||||
|
||||
// lib32 directory has a special meaning on MIPS targets.
|
||||
// It contains N32 ABI binaries. Use this folder if produce
|
||||
// code for N32 ABI only.
|
||||
if (hasMipsN32ABIArg(Args))
|
||||
// It happens that only x86 and PPC use the 'lib32' variant of multilib, and
|
||||
// using that variant while targeting other architectures causes problems
|
||||
// because the libraries are laid out in shared system roots that can't cope
|
||||
// with a 'lib32' multilib search path being considered. So we only enable
|
||||
// them when we know we may need it.
|
||||
//
|
||||
// FIXME: This is a bit of a hack. We should really unify this code for
|
||||
// reasoning about multilib spellings with the lib dir spellings in the
|
||||
// GCCInstallationDetector, but that is a more significant refactoring.
|
||||
if (Triple.getArch() == llvm::Triple::x86 ||
|
||||
Triple.getArch() == llvm::Triple::ppc)
|
||||
return "lib32";
|
||||
|
||||
return Triple.isArch32Bit() ? "lib" : "lib64";
|
||||
|
|
|
@ -245,19 +245,55 @@
|
|||
// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3{{/|\\\\}}crtend.o"
|
||||
// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf{{/|\\\\}}crtn.o"
|
||||
//
|
||||
// Check Ubuntu 13.10 on x86-64 targeting arm-linux-gnueabihf.
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-linux-gnueabihf \
|
||||
// RUN: --sysroot=%S/Inputs/x86-64_ubuntu_13.10 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-X86-64-UBUNTU-13-10-ARM-HF %s
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-dynamic-linker" "/lib/ld-linux-armhf.so.3"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crt1.o"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crti.o"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8{{/|\\\\}}crtbegin.o"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/lib/../lib"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/../lib"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8{{/|\\\\}}crtend.o"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crtn.o"
|
||||
//
|
||||
// Check Ubuntu 13.10 on x86-64 targeting arm-linux-gnueabi.
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-linux-gnueabi \
|
||||
// RUN: --sysroot=%S/Inputs/x86-64_ubuntu_13.10 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-X86-64-UBUNTU-13-10-ARM %s
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "-dynamic-linker" "/lib/ld-linux.so.3"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crt1.o"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crti.o"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtbegin.o"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/lib/../lib"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/../lib"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtend.o"
|
||||
// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crtn.o"
|
||||
//
|
||||
// Check fedora 18 on arm.
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=armv7-unknown-linux-gnueabihf \
|
||||
// RUN: --sysroot=%S/Inputs/fedora_18_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-FEDORA-18-ARM-HF %s
|
||||
// CHECK-FEDORA-18-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
||||
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../..{{/|\\\\}}crt1.o"
|
||||
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../..{{/|\\\\}}crti.o"
|
||||
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crt1.o"
|
||||
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crti.o"
|
||||
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2{{/|\\\\}}crtbegin.o"
|
||||
// CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2"
|
||||
// CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../.."
|
||||
// CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib"
|
||||
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2{{/|\\\\}}crtend.o"
|
||||
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../..{{/|\\\\}}crtn.o"
|
||||
// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crtn.o"
|
||||
//
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: --target=arm-unknown-linux-gnueabi \
|
||||
|
|
Loading…
Reference in New Issue