[cfe-commits] r148981 - in /cfe/trunk: lib/Driver/ test/Driver/ test/Driver/Inputs/basic_freebsd64_tree/usr/lib/ test/Driver/Inputs/basic_freebsd_tree/usr/lib/ test/Driver/Inputs/basic_freebsd_tree/usr/lib32/ test/Driver/Inputs/multiarch_freebsd64_tree/ test/Driver/Inputs/multiarch_freebsd64_tree/lib/ test/Driver/Inputs/multiarch_freebsd64_tree/usr/ test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/ test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/

Chandler Carruth chandlerc at gmail.com
Wed Jan 25 13:32:31 PST 2012


Author: chandlerc
Date: Wed Jan 25 15:32:31 2012
New Revision: 148981

URL: http://llvm.org/viewvc/llvm-project?rev=148981&view=rev
Log:
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.

Added:
    cfe/trunk/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/crt1.o
    cfe/trunk/test/Driver/Inputs/basic_freebsd_tree/usr/lib/crt1.o
    cfe/trunk/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/
    cfe/trunk/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/.keep
    cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/
    cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/lib/
    cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/lib/.keep
    cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/
    cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/
    cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/.keep
    cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/crt1.o
    cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/
    cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/.keep
    cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/crt1.o
Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/test/Driver/freebsd.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=148981&r1=148980&r2=148981&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Jan 25 15:32:31 2012
@@ -1627,11 +1627,11 @@
 FreeBSD::FreeBSD(const Driver &D, const llvm::Triple& Triple)
   : Generic_ELF(D, Triple) {
 
-  // When targeting 32-bit platforms, look for '/usr/lib32' first and fall back
-  // to '/usr/lib' for the remaining cases.
+  // When targeting 32-bit platforms, look for '/usr/lib32/crt1.o' and fall
+  // back to '/usr/lib' if it doesn't exist.
   if ((Triple.getArch() == llvm::Triple::x86 ||
        Triple.getArch() == llvm::Triple::ppc) &&
-      llvm::sys::fs::exists(getDriver().SysRoot + "/usr/lib32"))
+      llvm::sys::fs::exists(getDriver().SysRoot + "/usr/lib32/crt1.o"))
     getFilePaths().push_back(getDriver().SysRoot + "/usr/lib32");
   else
     getFilePaths().push_back(getDriver().SysRoot + "/usr/lib");

Added: cfe/trunk/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/crt1.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_freebsd64_tree/usr/lib/crt1.o?rev=148981&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/basic_freebsd_tree/usr/lib/crt1.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_freebsd_tree/usr/lib/crt1.o?rev=148981&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/basic_freebsd_tree/usr/lib32/.keep?rev=148981&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/lib/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/lib/.keep?rev=148981&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/.keep?rev=148981&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/crt1.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib/crt1.o?rev=148981&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/.keep
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/.keep?rev=148981&view=auto
==============================================================================
    (empty)

Added: cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/crt1.o
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/multiarch_freebsd64_tree/usr/lib32/crt1.o?rev=148981&view=auto
==============================================================================
    (empty)

Modified: cfe/trunk/test/Driver/freebsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd.c?rev=148981&r1=148980&r2=148981&view=diff
==============================================================================
--- cfe/trunk/test/Driver/freebsd.c (original)
+++ cfe/trunk/test/Driver/freebsd.c Wed Jan 25 15:32:31 2012
@@ -1,14 +1,21 @@
-// RUN: %clang -no-canonical-prefixes --sysroot=%S/Inputs/basic_freebsd_tree -ccc-clang-archs "" -target powerpc64-pc-freebsd8 %s -### 2> %t
+// RUN: %clang -no-canonical-prefixes --sysroot=%S/Inputs/basic_freebsd_tree -ccc-clang-archs "" -target powerpc-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/basic_freebsd64_tree -target x86_64-pc-freebsd8 -m32 -### %s 2> %t
+// RUN: %clang -no-canonical-prefixes --sysroot=%S/Inputs/multiarch_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"





More information about the cfe-commits mailing list