From e8be6652cebf005b39d490d72fd4d63e52779160 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 25 Jan 2012 22:55:16 +0000 Subject: [PATCH] Revert r148981 because it fails test/Driver/freebsd.c Original log: Author: chandlerc Date: Wed Jan 25 21:32:31 2012 +0000 Try to unbreak the FreeBSD toolchain's detection of 32-bit targets inside a 64-bit freebsd machine with the 32-bit compatibility layer installed. The FreeBSD image always has the /usr/lib32 directory, so test for the more concrete existence of crt1.o. Also enhance the tests for freebsd to clarify what these trees look like and exercise the new code. Thanks to all the FreeBSD folks for helping me understand what caused the failure and how we might fix it. =] That helps a lot. Also, yay build bots. llvm-svn: 148993 --- clang/lib/Driver/ToolChains.cpp | 6 +++--- .../Inputs/basic_freebsd64_tree/usr/lib/crt1.o | 0 .../Inputs/basic_freebsd_tree/usr/lib/crt1.o | 0 .../Inputs/basic_freebsd_tree/usr/lib32/.keep | 0 .../Inputs/multiarch_freebsd64_tree/lib/.keep | 0 .../Inputs/multiarch_freebsd64_tree/usr/lib/.keep | 0 .../multiarch_freebsd64_tree/usr/lib/crt1.o | 0 .../multiarch_freebsd64_tree/usr/lib32/.keep | 0 .../multiarch_freebsd64_tree/usr/lib32/crt1.o | 0 clang/test/Driver/freebsd.c | 15 ++++----------- 10 files changed, 7 insertions(+), 14 deletions(-) delete mode 100644 clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/crt1.o delete mode 100644 clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/crt1.o delete mode 100644 clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/.keep delete mode 100644 clang/test/Driver/Inputs/multiarch_freebsd64_tree/lib/.keep delete mode 100644 clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/.keep delete mode 100644 clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/crt1.o delete mode 100644 clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/.keep delete mode 100644 clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/crt1.o diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index c39d6243465b..44f51e4c5d5a 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -1627,11 +1627,11 @@ Tool &OpenBSD::SelectTool(const Compilation &C, const JobAction &JA, FreeBSD::FreeBSD(const Driver &D, const llvm::Triple& Triple) : Generic_ELF(D, Triple) { - // When targeting 32-bit platforms, look for '/usr/lib32/crt1.o' and fall - // back to '/usr/lib' if it doesn't exist. + // When targeting 32-bit platforms, look for '/usr/lib32' first and fall back + // to '/usr/lib' for the remaining cases. if ((Triple.getArch() == llvm::Triple::x86 || Triple.getArch() == llvm::Triple::ppc) && - llvm::sys::fs::exists(getDriver().SysRoot + "/usr/lib32/crt1.o")) + llvm::sys::fs::exists(getDriver().SysRoot + "/usr/lib32")) getFilePaths().push_back(getDriver().SysRoot + "/usr/lib32"); else getFilePaths().push_back(getDriver().SysRoot + "/usr/lib"); diff --git a/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/crt1.o b/clang/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/crt1.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/crt1.o b/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib/crt1.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/.keep b/clang/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/multiarch_freebsd64_tree/lib/.keep b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/lib/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/.keep b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/crt1.o b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/crt1.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/.keep b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/crt1.o b/clang/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/crt1.o deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/freebsd.c b/clang/test/Driver/freebsd.c index c7edef93f3a2..a25d6e0de423 100644 --- a/clang/test/Driver/freebsd.c +++ b/clang/test/Driver/freebsd.c @@ -1,21 +1,14 @@ -// RUN: %clang -no-canonical-prefixes --sysroot=%S/Inputs/basic_freebsd_tree -ccc-clang-archs "" -target powerpc-pc-freebsd8 %s -### 2> %t +// RUN: %clang -no-canonical-prefixes --sysroot=%S/Inputs/basic_freebsd_tree -ccc-clang-archs "" -target powerpc64-pc-freebsd8 %s -### 2> %t // RUN: FileCheck --check-prefix=CHECK-PPC < %t %s // // CHECK-PPC: clang{{.*}}" "-cc1" "-triple" "powerpc64-pc-freebsd8" // CHECK-PPC: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]" // CHECK-PPC: "--eh-frame-hdr" "-dynamic-linker" "{{.*}}ld-elf{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "-L[[SYSROOT]]/usr/lib" "{{.*}}.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "{{.*}}crtend.o" "{{.*}}crtn.o" -// -// RUN: %clang -no-canonical-prefixes --sysroot=%S/Inputs/basic_freebsd64_tree -ccc-clang-archs "" -target powerpc64-pc-freebsd8 %s -### 2> %t -// RUN: FileCheck --check-prefix=CHECK-PPC < %t %s -// -// CHECK-PPC: clang{{.*}}" "-cc1" "-triple" "powerpc64-pc-freebsd8" -// CHECK-PPC: ld{{.*}}" "--sysroot=[[SYSROOT:[^"]+]]" -// CHECK-PPC: "--eh-frame-hdr" "-dynamic-linker" "{{.*}}ld-elf{{.*}}" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "-L[[SYSROOT]]/usr/lib" "{{.*}}.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "{{.*}}crtend.o" "{{.*}}crtn.o" -// -// + + // Check that -m32 properly adjusts the toolchain flags. // -// RUN: %clang -no-canonical-prefixes --sysroot=%S/Inputs/multiarch_freebsd64_tree -target x86_64-pc-freebsd8 -m32 -### %s 2> %t +// RUN: %clang -no-canonical-prefixes --sysroot=%S/Inputs/basic_freebsd64_tree -target x86_64-pc-freebsd8 -m32 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-LIB32 < %t %s // // CHECK-LIB32: clang{{.*}}" "-cc1" "-triple" "i386-pc-freebsd8"