[cfe-dev] [PATCH] driver improvements for freebsd-*-mips*

Brooks Davis brooks at freebsd.org
Tue Aug 28 06:16:07 PDT 2012


On Tue, Aug 28, 2012 at 03:27:23PM +0400, Simon Atanasyan wrote:
> Hi,
> 
> On Tue, Aug 28, 2012 at 2:31 PM, Brooks Davis <brooks at freebsd.org> wrote:
> > Here you go.  The following diff assumes that mips-as.c is copied to
> > freebsd-mips-as.c before being applied.
> 
> In general the patch looks good to me. Just a small note. The first
> line of freebsd.c contains "REQUIRES" clause enumerates targets
> required to run the test. Could you please add
> "mips-registered-target" to that list?

Sure, here's a new patch (it also contains a test for linkage in the -pg
on FreeBSD, but that can be trimmed and committed later if desired).

-- Brooks

Index: freebsd.c
===================================================================
--- freebsd.c	(revision 162742)
+++ freebsd.c	(working copy)
@@ -1,4 +1,4 @@
-// REQUIRES: ppc32-registered-target,ppc64-registered-target
+// REQUIRES: ppc32-registered-target,ppc64-registered-target,mips-registered-target
 // RUN: %clang -ccc-clang-archs powerpc -no-canonical-prefixes \
 // RUN:   -target powerpc-pc-freebsd8 %s    \
 // RUN:   --sysroot=%S/Inputs/basic_freebsd_tree -### 2>&1 \
@@ -43,4 +43,37 @@
 // CHECK-LDFLAGS8: --enable-new-dtags
 // CHECK-LDFLAGS9: --hash-style=both
 // CHECK-LDFLAGS9: --enable-new-dtags
-
+//
+// Check that we do not pass --hash-style=gnu and --hash-style=both to linker
+// and provide correct path to the dynamic linker for MIPS platforms.
+// Also verify that we tell the assembler to target the right ISA and ABI.
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN:     -target mips-unknown-freebsd10.0 -ccc-clang-archs mips \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS %s
+// CHECK-MIPS: "{{.*}}ld"
+// CHECK-MIPS: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
+// CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN:     -target mipsel-unknown-freebsd10.0 -ccc-clang-archs mipsel \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPSEL %s
+// CHECK-MIPSEL: "{{.*}}ld"
+// CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
+// CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN:     -target mips64-unknown-freebsd10.0 -ccc-clang-archs mips64 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS64 %s
+// CHECK-MIPS64: "{{.*}}ld"
+// CHECK-MIPS64: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
+// CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN:     -target mips64el-unknown-freebsd10.0 -ccc-clang-archs mips64el \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL %s
+// CHECK-MIPS64EL: "{{.*}}ld"
+// CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
+// CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
+//
+// RUN: %clang -target i386-unknown-freebsd -pg -### %s \
+// RUN:     --sysroot=%S/Inputs/basic_freebsd_tree 2>&1 \
+// RUN:   | FileCheck -check-prefix=LINK_PG %s
+// LINK_PG: "{{.*}}ld"
+// LINK_PG: gcrt1.o
Index: freebsd-mips-as.c
===================================================================
--- freebsd-mips-as.c	(working copy)
+++ freebsd-mips-as.c	(working copy)
@@ -1,38 +1,56 @@
 // Check passing options to the assembler for MIPS targets.
 //
-// RUN: %clang -target mips-linux-gnu -### \
+// RUN: %clang -target mips-unknown-freebsd -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS32-EB-AS %s
 // MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
 // MIPS32-EB-AS-NOT: "-KPIC"
 //
-// RUN: %clang -target mips-linux-gnu -### \
+// RUN: %clang -target mips-unknown-freebsd -### \
 // RUN:   -no-integrated-as -fPIC -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS32-EB-PIC %s
 // MIPS32-EB-PIC: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
 // MIPS32-EB-PIC: "-KPIC"
 //
-// RUN: %clang -target mipsel-linux-gnu -### \
+// RUN: %clang -target mips-unknown-freebsd -### \
+// RUN:   -no-integrated-as -fpic -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS32-EB-PIC-SMALL %s
+// MIPS32-EB-PIC-SMALL: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
+// MIPS32-EB-PIC-SMALL: "-KPIC"
+//
+// RUN: %clang -target mips-unknown-freebsd -### \
+// RUN:   -no-integrated-as -fPIE -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS32-EB-PIE %s
+// MIPS32-EB-PIE: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
+// MIPS32-EB-PIE: "-KPIC"
+//
+// RUN: %clang -target mips-unknown-freebsd -### \
+// RUN:   -no-integrated-as -fpie -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=MIPS32-EB-PIE-SMALL %s
+// MIPS32-EB-PIE-SMALL: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
+// MIPS32-EB-PIE-SMALL: "-KPIC"
+//
+// RUN: %clang -target mipsel-unknown-freebsd -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS32-EL-AS %s
 // MIPS32-EL-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EL"
 //
-// RUN: %clang -target mips64-linux-gnu -### \
+// RUN: %clang -target mips64-unknown-freebsd -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS64-EB-AS %s
 // MIPS64-EB-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB"
 //
-// RUN: %clang -target mips64el-linux-gnu -### \
+// RUN: %clang -target mips64el-unknown-freebsd -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS64-EL-AS %s
 // MIPS64-EL-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EL"
 //
-// RUN: %clang -target mips-linux-gnu -mabi=eabi -### \
+// RUN: %clang -target mips-unknown-freebsd -mabi=eabi -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-EABI %s
 // MIPS-EABI: as{{(.exe)?}}" "-march" "mips32" "-mabi" "eabi" "-EB"
 //
-// RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \
+// RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=MIPS-N32 %s
 // MIPS-N32: as{{(.exe)?}}" "-march" "mips64" "-mabi" "n32" "-EB"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120828/1226c60b/attachment.sig>


More information about the cfe-dev mailing list