summaryrefslogtreecommitdiff
path: root/test/Driver
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
commit13cc256e404620c1de0cbcc4e43ce1e2dbbc4898 (patch)
tree2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/Driver
parent657bc3d9848e3be92029b2416031340988cd0111 (diff)
downloadsrc-test2-13cc256e404620c1de0cbcc4e43ce1e2dbbc4898.tar.gz
src-test2-13cc256e404620c1de0cbcc4e43ce1e2dbbc4898.zip
Notes
Diffstat (limited to 'test/Driver')
-rw-r--r--test/Driver/B-opt.c22
-rwxr-xr-x[-rw-r--r--]test/Driver/Inputs/B_opt_tree/dir1/i386-unknown-linux-ld (renamed from test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_dynamic.o)0
-rwxr-xr-x[-rw-r--r--]test/Driver/Inputs/B_opt_tree/dir1/ld (renamed from test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_so.o)0
-rwxr-xr-x[-rw-r--r--]test/Driver/Inputs/B_opt_tree/dir2/ld (renamed from test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_static.o)0
-rwxr-xr-x[-rw-r--r--]test/Driver/Inputs/B_opt_tree/dir3/prefix-ld (renamed from test/Driver/Inputs/basic_android_tree/usr/lib/crtend_android.o)0
-rw-r--r--test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/bin/.keep (renamed from test/Driver/Inputs/basic_android_tree/usr/lib/crtend_so.o)0
-rw-r--r--test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/include/c++/4.4.3/.keep0
-rw-r--r--test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/lib/.keep0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbeginS.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbeginT.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtendS.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbegin.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbeginS.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbeginT.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtend.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtendS.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbegin.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbeginS.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbeginT.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtend.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtendS.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/mipsel-linux-android/bin/.keep0
-rw-r--r--test/Driver/Inputs/basic_android_tree/mipsel-linux-android/include/c++/4.4.3/.keep0
-rw-r--r--test/Driver/Inputs/basic_android_tree/mipsel-linux-android/lib/.keep0
-rw-r--r--test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_dynamic.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_so.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_static.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtend_android.o0
-rw-r--r--test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtend_so.o0
-rw-r--r--test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtfastmath.o0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/lib/.keep0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/lib32/.keep0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/lib64/.keep0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/usr/lib/crt1.o0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/usr/lib/crti.o0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/64/crtbegin.o0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/crtbegin.o0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/n32/crtbegin.o0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crt1.o0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crti.o0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crt1.o0
-rw-r--r--test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crti.o0
-rw-r--r--test/Driver/Inputs/freescale_ppc64_tree/lib64/.keep0
-rw-r--r--test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crt1.o0
-rw-r--r--test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crti.o0
-rw-r--r--test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crtn.o0
-rw-r--r--test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/powerpc64-fsl-linux/4.6.2/crtbegin.o0
-rw-r--r--test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/powerpc64-fsl-linux/4.6.2/crtend.o0
-rw-r--r--test/Driver/Inputs/freescale_ppc_tree/lib/.keep0
-rw-r--r--test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o0
-rw-r--r--test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o0
-rw-r--r--test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o0
-rw-r--r--test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o0
-rw-r--r--test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtend.o0
-rw-r--r--test/Driver/Wp-args.c8
-rw-r--r--test/Driver/altivec.cpp12
-rw-r--r--test/Driver/android-standalone.cpp65
-rw-r--r--test/Driver/apple-kext-i386.cpp55
-rw-r--r--test/Driver/arc.c6
-rw-r--r--test/Driver/arm-darwin-builtin.c2
-rw-r--r--test/Driver/asan-ld.c31
-rw-r--r--test/Driver/asan.c1
-rw-r--r--test/Driver/bindings.c58
-rw-r--r--test/Driver/bitrig.c29
-rw-r--r--test/Driver/clang-translation.c107
-rw-r--r--test/Driver/cpath.c4
-rw-r--r--test/Driver/crash-report.c3
-rw-r--r--test/Driver/darwin-arch-default.c7
-rw-r--r--test/Driver/darwin-asan-nofortify.c6
-rw-r--r--test/Driver/darwin-cc.c4
-rw-r--r--test/Driver/darwin-ld.c6
-rw-r--r--test/Driver/darwin-sdkroot.c22
-rw-r--r--test/Driver/fast-math.c49
-rw-r--r--test/Driver/freebsd-mips-as.c81
-rw-r--r--test/Driver/freebsd.c58
-rw-r--r--test/Driver/fsanitize.c23
-rw-r--r--test/Driver/gcc_forward.c2
-rw-r--r--test/Driver/hello.c18
-rw-r--r--test/Driver/immediate-options.c6
-rw-r--r--test/Driver/ios-simulator-arcruntime.c8
-rw-r--r--test/Driver/le32-unknown-nacl.cpp6
-rw-r--r--test/Driver/linker-opts.c2
-rw-r--r--test/Driver/linux-header-search.cpp4
-rw-r--r--test/Driver/linux-ld.c210
-rw-r--r--test/Driver/mips-as.c27
-rw-r--r--test/Driver/mips-features.c6
-rw-r--r--test/Driver/mips-float.c12
-rw-r--r--test/Driver/no-objc-arr.m1
-rw-r--r--test/Driver/objc++-cpp-output.mm3
-rw-r--r--test/Driver/objc-cpp-output.m3
-rw-r--r--test/Driver/openbsd.c12
-rw-r--r--test/Driver/pic.c162
-rw-r--r--test/Driver/retain-comments-from-system-headers.c9
-rw-r--r--test/Driver/rewrite-legacy-objc.m10
-rw-r--r--test/Driver/rewrite-objc.m11
-rw-r--r--test/Driver/stack-protector.c11
-rw-r--r--test/Driver/std.cpp8
-rw-r--r--test/Driver/tsan.c11
-rw-r--r--test/Driver/ubsan-ld.c10
-rw-r--r--test/Driver/warning-options.cpp5
-rw-r--r--test/Driver/working-directory-and-abs.c1
-rw-r--r--test/Driver/x86_64-nacl-defines.cpp45
-rw-r--r--test/Driver/x86_64-nacl-types.cpp37
105 files changed, 1039 insertions, 260 deletions
diff --git a/test/Driver/B-opt.c b/test/Driver/B-opt.c
new file mode 100644
index 000000000000..a0b9a11162dd
--- /dev/null
+++ b/test/Driver/B-opt.c
@@ -0,0 +1,22 @@
+// Check -B driver option.
+//
+// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \
+// RUN: -B %S/Inputs/B_opt_tree/dir1 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-B-OPT-TRIPLE %s
+// CHECK-B-OPT-TRIPLE: "{{.*}}/Inputs/B_opt_tree/dir1/i386-unknown-linux-ld"
+//
+// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \
+// RUN: -B %S/Inputs/B_opt_tree/dir2 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-B-OPT-DIR %s
+// CHECK-B-OPT-DIR: "{{.*}}/Inputs/B_opt_tree/dir2/ld"
+//
+// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \
+// RUN: -B %S/Inputs/B_opt_tree/dir3/prefix- 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-B-OPT-PREFIX %s
+// CHECK-B-OPT-PREFIX: "{{.*}}/Inputs/B_opt_tree/dir3/prefix-ld"
+//
+// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \
+// RUN: -B %S/Inputs/B_opt_tree/dir3/prefix- \
+// RUN: -B %S/Inputs/B_opt_tree/dir2 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-B-OPT-MULT %s
+// CHECK-B-OPT-MULT: "{{.*}}/Inputs/B_opt_tree/dir3/prefix-ld"
diff --git a/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_dynamic.o b/test/Driver/Inputs/B_opt_tree/dir1/i386-unknown-linux-ld
index e69de29bb2d1..e69de29bb2d1 100644..100755
--- a/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_dynamic.o
+++ b/test/Driver/Inputs/B_opt_tree/dir1/i386-unknown-linux-ld
diff --git a/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_so.o b/test/Driver/Inputs/B_opt_tree/dir1/ld
index e69de29bb2d1..e69de29bb2d1 100644..100755
--- a/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_so.o
+++ b/test/Driver/Inputs/B_opt_tree/dir1/ld
diff --git a/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_static.o b/test/Driver/Inputs/B_opt_tree/dir2/ld
index e69de29bb2d1..e69de29bb2d1 100644..100755
--- a/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_static.o
+++ b/test/Driver/Inputs/B_opt_tree/dir2/ld
diff --git a/test/Driver/Inputs/basic_android_tree/usr/lib/crtend_android.o b/test/Driver/Inputs/B_opt_tree/dir3/prefix-ld
index e69de29bb2d1..e69de29bb2d1 100644..100755
--- a/test/Driver/Inputs/basic_android_tree/usr/lib/crtend_android.o
+++ b/test/Driver/Inputs/B_opt_tree/dir3/prefix-ld
diff --git a/test/Driver/Inputs/basic_android_tree/usr/lib/crtend_so.o b/test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/bin/.keep
index e69de29bb2d1..e69de29bb2d1 100644
--- a/test/Driver/Inputs/basic_android_tree/usr/lib/crtend_so.o
+++ b/test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/bin/.keep
diff --git a/test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/include/c++/4.4.3/.keep b/test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/include/c++/4.4.3/.keep
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/include/c++/4.4.3/.keep
diff --git a/test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/lib/.keep b/test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/lib/.keep
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/arm-linux-androideabi/lib/.keep
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbeginS.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbeginS.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbeginS.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbeginT.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbeginT.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtbeginT.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtendS.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtendS.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/crtendS.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbegin.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbegin.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbegin.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbeginS.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbeginS.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbeginS.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbeginT.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbeginT.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtbeginT.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtend.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtend.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtend.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtendS.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtendS.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/crtendS.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbegin.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbegin.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbegin.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbeginS.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbeginS.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbeginS.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbeginT.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbeginT.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtbeginT.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtend.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtend.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtend.o
diff --git a/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtendS.o b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtendS.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/lib/gcc/mipsel-linux-android/4.4.3/mips-r2/crtendS.o
diff --git a/test/Driver/Inputs/basic_android_tree/mipsel-linux-android/bin/.keep b/test/Driver/Inputs/basic_android_tree/mipsel-linux-android/bin/.keep
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/mipsel-linux-android/bin/.keep
diff --git a/test/Driver/Inputs/basic_android_tree/mipsel-linux-android/include/c++/4.4.3/.keep b/test/Driver/Inputs/basic_android_tree/mipsel-linux-android/include/c++/4.4.3/.keep
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/mipsel-linux-android/include/c++/4.4.3/.keep
diff --git a/test/Driver/Inputs/basic_android_tree/mipsel-linux-android/lib/.keep b/test/Driver/Inputs/basic_android_tree/mipsel-linux-android/lib/.keep
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/mipsel-linux-android/lib/.keep
diff --git a/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_dynamic.o b/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_dynamic.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_dynamic.o
diff --git a/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_so.o b/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_so.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_so.o
diff --git a/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_static.o b/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_static.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtbegin_static.o
diff --git a/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtend_android.o b/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtend_android.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtend_android.o
diff --git a/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtend_so.o b/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtend_so.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_android_tree/sysroot/usr/lib/crtend_so.o
diff --git a/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtfastmath.o b/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtfastmath.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtfastmath.o
diff --git a/test/Driver/Inputs/debian_6_mips_tree/lib/.keep b/test/Driver/Inputs/debian_6_mips_tree/lib/.keep
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/lib/.keep
diff --git a/test/Driver/Inputs/debian_6_mips_tree/lib32/.keep b/test/Driver/Inputs/debian_6_mips_tree/lib32/.keep
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/lib32/.keep
diff --git a/test/Driver/Inputs/debian_6_mips_tree/lib64/.keep b/test/Driver/Inputs/debian_6_mips_tree/lib64/.keep
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/lib64/.keep
diff --git a/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crt1.o b/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crt1.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crt1.o
diff --git a/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crti.o b/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crti.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/usr/lib/crti.o
diff --git a/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/64/crtbegin.o b/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/64/crtbegin.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/64/crtbegin.o
diff --git a/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/crtbegin.o b/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/crtbegin.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/crtbegin.o
diff --git a/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/n32/crtbegin.o b/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/n32/crtbegin.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/usr/lib/gcc/mipsel-linux-gnu/4.4/n32/crtbegin.o
diff --git a/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crt1.o b/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crt1.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crt1.o
diff --git a/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crti.o b/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crti.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/usr/lib32/crti.o
diff --git a/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crt1.o b/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crt1.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crt1.o
diff --git a/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crti.o b/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crti.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/debian_6_mips_tree/usr/lib64/crti.o
diff --git a/test/Driver/Inputs/freescale_ppc64_tree/lib64/.keep b/test/Driver/Inputs/freescale_ppc64_tree/lib64/.keep
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc64_tree/lib64/.keep
diff --git a/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crt1.o b/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crt1.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crt1.o
diff --git a/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crti.o b/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crti.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crti.o
diff --git a/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crtn.o b/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crtn.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/crtn.o
diff --git a/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/powerpc64-fsl-linux/4.6.2/crtbegin.o b/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/powerpc64-fsl-linux/4.6.2/crtbegin.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/powerpc64-fsl-linux/4.6.2/crtbegin.o
diff --git a/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/powerpc64-fsl-linux/4.6.2/crtend.o b/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/powerpc64-fsl-linux/4.6.2/crtend.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc64_tree/usr/lib64/powerpc64-fsl-linux/4.6.2/crtend.o
diff --git a/test/Driver/Inputs/freescale_ppc_tree/lib/.keep b/test/Driver/Inputs/freescale_ppc_tree/lib/.keep
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc_tree/lib/.keep
diff --git a/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o
diff --git a/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o
diff --git a/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o
diff --git a/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o
diff --git a/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtend.o b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtend.o
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtend.o
diff --git a/test/Driver/Wp-args.c b/test/Driver/Wp-args.c
index 0ab85b4c9c76..1d1af24804a1 100644
--- a/test/Driver/Wp-args.c
+++ b/test/Driver/Wp-args.c
@@ -11,3 +11,11 @@
// CHECK: "-MT"
//
// PR4062
+
+// RUN: %clang --target i386-pc-linux-gnu -### \
+// RUN: -Wp,-MMD -fsyntax-only %s 2> %t
+// RUN: FileCheck -check-prefix MMD < %t %s
+
+// MMD: "-cc1"
+// MMD-NOT: -MMD
+// MMD: "-dependency-file" "Wp-args.d"
diff --git a/test/Driver/altivec.cpp b/test/Driver/altivec.cpp
index a8936360a3db..4e6fbe597272 100644
--- a/test/Driver/altivec.cpp
+++ b/test/Driver/altivec.cpp
@@ -1,15 +1,15 @@
// Check that we error when -faltivec is specified on non-ppc platforms.
-// RUN: %clang -ccc-clang-archs powerpc -target powerpc-unk-unk -faltivec -fsyntax-only %s
-// RUN: %clang -ccc-clang-archs powerpc64 -target powerpc64-linux-gnu -faltivec -fsyntax-only %s
-// RUN: %clang -ccc-clang-archs powerpc64 -target powerpc64-linux-gnu -maltivec -fsyntax-only %s
+// RUN: %clang -target powerpc-unk-unk -faltivec -fsyntax-only %s
+// RUN: %clang -target powerpc64-linux-gnu -faltivec -fsyntax-only %s
+// RUN: %clang -target powerpc64-linux-gnu -maltivec -fsyntax-only %s
// RUN: %clang -target i386-pc-win32 -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
// RUN: %clang -target x86_64-unknown-freebsd -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
// RUN: %clang -target armv6-apple-darwin -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
// RUN: %clang -target armv7-apple-darwin -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
-// RUN: %clang -ccc-clang-archs mips -target mips-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
-// RUN: %clang -ccc-clang-archs mips64 -target mips64-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
-// RUN: %clang -ccc-clang-archs sparc -target sparc-unknown-solaris -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang -target mips-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang -target mips64-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
+// RUN: %clang -target sparc-unknown-solaris -faltivec -fsyntax-only %s 2>&1 | FileCheck %s
// CHECK: invalid argument '-faltivec' only allowed with 'ppc/ppc64'
diff --git a/test/Driver/android-standalone.cpp b/test/Driver/android-standalone.cpp
new file mode 100644
index 000000000000..dc41ed7559a2
--- /dev/null
+++ b/test/Driver/android-standalone.cpp
@@ -0,0 +1,65 @@
+// Test header and library paths when Clang is used with Android standalone
+// toolchain.
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-androideabi \
+// RUN: -B%S/Inputs/basic_android_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck %s
+// CHECK: {{.*}}clang{{.*}}" "-cc1"
+// CHECK: "-internal-isystem" "{{.*}}/arm-linux-androideabi/include/c++/4.4.3"
+// CHECK: "-internal-isystem" "{{.*}}/arm-linux-androideabi/include/c++/4.4.3/arm-linux-androideabi"
+// CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/include"
+// CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
+// CHECK: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.4.3"
+// CHECK: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/lib"
+// CHECK: "-L{{.*}}/sysroot/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mipsel-linux-android \
+// RUN: -mips32 \
+// RUN: -B%S/Inputs/basic_android_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-MIPS %s
+// CHECK-MIPS: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MIPS: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3"
+// CHECK-MIPS: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3/mipsel-linux-android"
+// CHECK-MIPS: "-internal-externc-isystem" "{{.*}}/sysroot/include"
+// CHECK-MIPS: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
+// CHECK-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-MIPS: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3"
+// CHECK-MIPS: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/../../../../mipsel-linux-android/lib"
+// CHECK-MIPS: "-L{{.*}}/sysroot/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mipsel-linux-android \
+// RUN: -march=mips32 -mips32r2 \
+// RUN: -B%S/Inputs/basic_android_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-MIPSR2 %s
+// CHECK-MIPSR2: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MIPSR2: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3"
+// CHECK-MIPSR2: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3/mipsel-linux-android"
+// CHECK-MIPSR2: "-internal-externc-isystem" "{{.*}}/sysroot/include"
+// CHECK-MIPSR2: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
+// CHECK-MIPSR2: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-MIPSR2: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/mips-r2"
+// CHECK-MIPSR2: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/../../../../mipsel-linux-android/lib"
+// CHECK-MIPSR2: "-L{{.*}}/sysroot/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mipsel-linux-android \
+// RUN: -mips32 -march=mips32r2 \
+// RUN: -B%S/Inputs/basic_android_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-MIPSR2-A %s
+// CHECK-MIPSR2-A: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MIPSR2-A: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3"
+// CHECK-MIPSR2-A: "-internal-isystem" "{{.*}}/mipsel-linux-android/include/c++/4.4.3/mipsel-linux-android"
+// CHECK-MIPSR2-A: "-internal-externc-isystem" "{{.*}}/sysroot/include"
+// CHECK-MIPSR2-A: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include"
+// CHECK-MIPSR2-A: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-MIPSR2-A: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/mips-r2"
+// CHECK-MIPSR2-A: "-L{{.*}}/lib/gcc/mipsel-linux-android/4.4.3/../../../../mipsel-linux-android/lib"
+// CHECK-MIPSR2-A: "-L{{.*}}/sysroot/usr/lib"
diff --git a/test/Driver/apple-kext-i386.cpp b/test/Driver/apple-kext-i386.cpp
deleted file mode 100644
index eb9f9578e9cb..000000000000
--- a/test/Driver/apple-kext-i386.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Check that we transparently fallback to llvm-gcc for i386 kexts, we don't
-// support the ABI they use (yet).
-
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN: -fapple-kext -### -fsyntax-only %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK < %t %s
-
-// CHECK: cc1plus"
-// CHECK: "-fapple-kext"
-
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN: -mkernel -### -fsyntax-only %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-MKERNEL < %t %s
-
-// CHECK-MKERNEL: cc1plus"
-// CHECK-MKERNEL: "-mkernel"
-
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN: -Wno-self-assign -Wc++11-extensions -Wno-microsoft -Wmicrosoft -Wvla \
-// RUN: -faltivec -mthumb -mcpu=G4 -mlongcall -mno-longcall -msoft-float \
-// RUN: -fapple-kext -### -fsyntax-only %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED < %t %s
-
-// CHECK-UNSUPPORTED: cc1plus"
-// CHECK-UNSUPPORTED-NOT: "-Wno-self-assign"
-// CHECK-UNSUPPORTED-NOT: "-Wc++11-extensions"
-// CHECK-UNSUPPORTED-NOT: "-Wno-microsoft"
-// CHECK-UNSUPPORTED-NOT: "-Wmicrosoft"
-// CHECK-UNSUPPORTED-NOT: "-Wvla"
-// CHECK-UNSUPPORTED-NOT: "-faltivec"
-// CHECK-UNSUPPORTED-NOT: "-mthumb"
-// CHECK-UNSUPPORTED-NOT: "-mlongcall"
-// CHECK-UNSUPPORTED: "-mno-longcall"
-// CHECK-UNSUPPORTED: "-msoft-float"
-
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN: -Wconstant-logical-operand -save-temps \
-// RUN: -fapple-kext -### -fsyntax-only %s 2> %t
-// RUN: FileCheck --check-prefix=CHECK-UNSUPPORTED2 < %t %s
-
-// CHECK-UNSUPPORTED2: cc1plus"
-// CHECK-UNSUPPORTED2-NOT: "-Wconstant-logical-operand"
-
-// Check that -serialize-diagnostics does not cause an "argument unused" error.
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN: -Wall -fapple-kext -### -serialize-diagnostics %t.dia -c %s 2>&1 | \
-// RUN: FileCheck --check-prefix=CHECK-UNUSED %s
-
-// Check that --serialize-diagnostics does not cause an "argument unused" error.
-// RUN: %clang -target i386-apple-darwin10 \
-// RUN: -Wall -fapple-kext -### --serialize-diagnostics %t.dia -c %s 2>&1 | \
-// RUN: FileCheck --check-prefix=CHECK-UNUSED %s
-
-// CHECK-UNUSED-NOT: argument unused
-// CHECK-UNUSED: cc1plus
diff --git a/test/Driver/arc.c b/test/Driver/arc.c
index 5a5720c04aee..4c99e5773acc 100644
--- a/test/Driver/arc.c
+++ b/test/Driver/arc.c
@@ -8,10 +8,10 @@
// Just to test clang is working.
# foo
-// CHECK: error: -fobjc-arc is not supported with legacy abi
+// CHECK: error: -fobjc-arc is not supported on platforms using the legacy runtime
// CHECK-NOT: invalid preprocessing directive
-// NOTOBJC-NOT: error: -fobjc-arc is not supported with legacy abi
+// NOTOBJC-NOT: error: -fobjc-arc is not supported on platforms using the legacy runtime
// NOTOBJC: invalid preprocessing directive
-// UNSUPPORTED: error: -fobjc-arc is not supported on current deployment target
+// UNSUPPORTED: error: -fobjc-arc is not supported on versions of OS X prior to 10.6
diff --git a/test/Driver/arm-darwin-builtin.c b/test/Driver/arm-darwin-builtin.c
index 41f13f3f7c23..be50b6898729 100644
--- a/test/Driver/arm-darwin-builtin.c
+++ b/test/Driver/arm-darwin-builtin.c
@@ -8,7 +8,7 @@
// RUX: not grep -- "-fno-builtin-strcat" %t &&
// RUX: not grep -- "-fno-builtin-strcpy" %t &&
-// RUN: %clang -ccc-no-clang -target x86_64-apple-darwin9 -arch arm -### -fsyntax-only %s -fbuiltin-strcat -fbuiltin-strcpy 2> %t
+// RUN: %clang -target x86_64-apple-darwin9 -arch arm -### -fsyntax-only %s -fbuiltin-strcat -fbuiltin-strcpy 2> %t
// RUN: not grep -- "-fno-builtin-strcat" %t
// RUN: not grep -- "-fno-builtin-strcpy" %t
diff --git a/test/Driver/asan-ld.c b/test/Driver/asan-ld.c
index daf046b53716..59dbda15c88d 100644
--- a/test/Driver/asan-ld.c
+++ b/test/Driver/asan-ld.c
@@ -4,6 +4,12 @@
// RUN: -target i386-unknown-linux -faddress-sanitizer \
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
// RUN: | FileCheck --check-prefix=CHECK-LINUX %s
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux -fsanitize=address \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LINUX %s
+//
// CHECK-LINUX: "{{.*}}ld{{(.exe)?}}"
// CHECK-LINUX-NOT: "-lc"
// CHECK-LINUX: libclang_rt.asan-i386.a"
@@ -13,19 +19,32 @@
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -target arm-linux-androideabi -faddress-sanitizer \
-// RUN: --sysroot=%S/Inputs/basic_android_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-androideabi -fsanitize=address \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
+//
// CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}"
// CHECK-ANDROID-NOT: "-lc"
-// CHECK-ANDROID: "-u" "__asan_preinit" "-lasan"
-// CHECK-ANDROID: "-lasan_preload" "-ldl"
+// CHECK-ANDROID: libclang_rt.asan-arm-android.so"
+// CHECK-ANDROID-NOT: "-lpthread"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -target arm-linux-androideabi -faddress-sanitizer \
-// RUN: --sysroot=%S/Inputs/basic_android_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -shared \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SHARED %s
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-androideabi -fsanitize=address \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -shared \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SHARED %s
+//
// CHECK-ANDROID-SHARED: "{{.*}}ld{{(.exe)?}}"
// CHECK-ANDROID-SHARED-NOT: "-lc"
-// CHECK-ANDROID-SHARED-NOT: "-lasan"
-// CHECK-ANDROID-SHARED: "-lasan_preload" "-ldl"
+// CHECK-ANDROID-SHARED: libclang_rt.asan-arm-android.so"
+// CHECK-ANDROID-SHARED-NOT: "-lpthread"
diff --git a/test/Driver/asan.c b/test/Driver/asan.c
index 4c9a1b6c4423..c9b3796b4436 100644
--- a/test/Driver/asan.c
+++ b/test/Driver/asan.c
@@ -2,6 +2,7 @@
// RUN: %clang -O1 -target i386-unknown-unknown -faddress-sanitizer %s -S -emit-llvm -o - | FileCheck %s
// RUN: %clang -O2 -target i386-unknown-unknown -faddress-sanitizer %s -S -emit-llvm -o - | FileCheck %s
// RUN: %clang -O3 -target i386-unknown-unknown -faddress-sanitizer %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -target i386-unknown-unknown -fsanitize=address %s -S -emit-llvm -o - | FileCheck %s
// Verify that -faddress-sanitizer invokes asan instrumentation.
int foo(int *a) { return *a; }
diff --git a/test/Driver/bindings.c b/test/Driver/bindings.c
index a7cda19bcb3f..d25fc8f8afd6 100644
--- a/test/Driver/bindings.c
+++ b/test/Driver/bindings.c
@@ -1,49 +1,25 @@
// Basic binding.
-// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings %s 2> %t
-// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: ".*\.s"' %t
-// RUN: grep '"gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
-// RUN: grep '"gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings %s 2>&1 | FileCheck %s --check-prefix=CHECK01
+// CHECK01: "clang", inputs: ["{{.*}}bindings.c"], output: "{{.*}}.s"
+// CHECK01: "gcc::Assemble", inputs: ["{{.*}}.s"], output: "{{.*}}.o"
+// CHECK01: "gcc::Link", inputs: ["{{.*}}.o"], output: "a.out"
-// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang %s 2> %t
-// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: ".*\.s"' %t
-// RUN: grep '"gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
-// RUN: grep '"gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t
-
-// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -no-integrated-cpp %s 2> %t
-// RUN: grep '"gcc::Preprocess", inputs: \[".*bindings.c"\], output: ".*\.i"' %t
-// RUN: grep '"gcc::Compile", inputs: \[".*\.i"\], output: ".*\.s"' %t
-// RUN: grep '"gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
-// RUN: grep '"gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t
+// Clang control options
-// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -x c-header %s 2> %t
-// RUN: grep '"gcc::Precompile", inputs: \[".*bindings.c"\], output: ".*bindings.c.gch' %t
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix=CHECK05
+// CHECK05: "clang", inputs: ["{{.*}}bindings.c"], output: (nothing)
-// Clang control options
+// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -fsyntax-only -x c++ %s 2>&1 | FileCheck %s --check-prefix=CHECK08
+// CHECK08: "clang", inputs: ["{{.*}}bindings.c"], output: (nothing)
-// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -fsyntax-only %s 2> %t
-// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: (nothing)' %t
-// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -fsyntax-only %s 2> %t
-// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: (nothing)' %t
-// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang-cxx -fsyntax-only -x c++ %s 2> %t
-// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: (nothing)' %t
-// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-clang-cxx -fsyntax-only -x c++ %s 2> %t
-// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: (nothing)' %t
-// RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -ccc-no-clang-cpp -fsyntax-only -no-integrated-cpp %s 2> %t
-// RUN: grep '"gcc::Preprocess", inputs: \[".*bindings.c"\], output: ".*\.i"' %t
-// RUN: grep '"clang", inputs: \[".*\.i"\], output: (nothing)' %t
-// RUN: %clang -target i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs i386 %s -S -arch ppc 2> %t
-// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
-// RUN: %clang -target i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs powerpc %s -S -arch ppc 2> %t
-// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
+// RUN: %clang -target i386-apple-darwin9 -ccc-print-bindings %s -S -arch ppc 2>&1 | FileCheck %s --check-prefix=CHECK11
+// CHECK11: "clang", inputs: ["{{.*}}bindings.c"], output: "bindings.s"
-// RUN: %clang -target powerpc-unknown-unknown -ccc-print-bindings -ccc-clang-archs "" %s -S 2> %t
-// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
-// RUN: %clang -target powerpc-unknown-unknown -ccc-print-bindings -ccc-clang-archs "i386" %s -S 2> %t
-// RUN: grep '"gcc::Compile", inputs: \[".*bindings.c"\], output: "bindings.s"' %t
+// RUN: %clang -target powerpc-unknown-unknown -ccc-print-bindings %s -S 2>&1 | FileCheck %s --check-prefix=CHECK12
+// CHECK12: "clang", inputs: ["{{.*}}bindings.c"], output: "bindings.s"
// Darwin bindings
-// RUN: %clang -target i386-apple-darwin9 -no-integrated-as -ccc-print-bindings %s 2> %t
-// RUN: grep '"clang", inputs: \[".*bindings.c"\], output: ".*\.s"' %t
-// RUN: grep '"darwin::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t
-// RUN: grep '"darwin::Link", inputs: \[".*\.o"\], output: "a.out"' %t
-
+// RUN: %clang -target i386-apple-darwin9 -no-integrated-as -ccc-print-bindings %s 2>&1 | FileCheck %s --check-prefix=CHECK14
+// CHECK14: "clang", inputs: ["{{.*}}bindings.c"], output: "{{.*}}.s"
+// CHECK14: "darwin::Assemble", inputs: ["{{.*}}.s"], output: "{{.*}}.o"
+// CHECK14: "darwin::Link", inputs: ["{{.*}}.o"], output: "a.out"
diff --git a/test/Driver/bitrig.c b/test/Driver/bitrig.c
new file mode 100644
index 000000000000..876a9cdb9eae
--- /dev/null
+++ b/test/Driver/bitrig.c
@@ -0,0 +1,29 @@
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LD-C %s
+// CHECK-LD-C: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-LD-C: ld{{.*}}" {{.*}} "-lc" "-lclang_rt.amd64"
+
+// RUN: %clangxx -no-canonical-prefixes -target amd64-pc-bitrig %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LD-CXX %s
+// CHECK-LD-CXX: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-LD-CXX: ld{{.*}}" {{.*}} "-lstdc++" "-lm" "-lc" "-lclang_rt.amd64"
+
+// RUN: %clangxx -stdlib=libc++ -no-canonical-prefixes -target amd64-pc-bitrig %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LD-CXX-STDLIB %s
+// CHECK-LD-CXX-STDLIB: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-LD-CXX-STDLIB: ld{{.*}}" {{.*}} "-lc++" "-lcxxrt" "-lgcc" "-lm" "-lc" "-lclang_rt.amd64"
+
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig -pthread %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PTHREAD %s
+// CHECK-PTHREAD: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-PTHREAD: ld{{.*}}" {{.*}} "{{.*}}crtbegin.o" {{.*}}.o" "-lpthread" "-lc" "-lclang_rt.amd64" "{{.*}}crtend.o"
+
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig -pg -pthread %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PG-PTHREAD %s
+// CHECK-PG-PTHREAD: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-PG-PTHREAD: ld{{.*}}" {{.*}} "{{.*}}crtbegin.o" {{.*}}.o" "-lpthread_p" "-lc_p" "-lclang_rt.amd64" "{{.*}}crtend.o"
+
+// RUN: %clang -no-canonical-prefixes -target amd64-pc-bitrig -shared -pg -pthread %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PG-PTHREAD-SHARED %s
+// CHECK-PG-PTHREAD-SHARED: clang{{.*}}" "-cc1" "-triple" "amd64-pc-bitrig"
+// CHECK-PG-PTHREAD-SHARED: ld{{.*}}" {{.*}} "{{.*}}crtbeginS.o" {{.*}}.o" "-lpthread" "-lclang_rt.amd64" "{{.*}}crtendS.o"
diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c
index 76196da9fc3d..3ddb189eb10d 100644
--- a/test/Driver/clang-translation.c
+++ b/test/Driver/clang-translation.c
@@ -1,22 +1,27 @@
-// RUN: %clang -target i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm -funwind-tables -fvisibility=hidden 2> %t.log
-// RUN: grep '"-triple" "i386-unknown-unknown"' %t.log
-// RUN: grep '"-S"' %t.log
-// RUN: grep '"-disable-free"' %t.log
-// RUN: grep '"-mrelocation-model" "static"' %t.log
-// RUN: grep '"-mdisable-fp-elim"' %t.log
-// RUN: grep '"-munwind-tables"' %t.log
-// RUN: grep '"-Os"' %t.log
-// RUN: grep '"-o" .*clang-translation.*' %t.log
-// RUN: grep '"-masm-verbose"' %t.log
-// RUN: grep '"-fvisibility" "hidden"' %t.log
-// RUN: %clang -target i386-apple-darwin9 -### -S %s -o %t.s 2> %t.log
-// RUN: grep '"-target-cpu" "yonah"' %t.log
-// RUN: %clang -target x86_64-apple-darwin9 -### -S %s -o %t.s 2> %t.log
-// RUN: grep '"-target-cpu" "core2"' %t.log
+// RUN: %clang -target i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm -funwind-tables -fvisibility=hidden 2>&1 | FileCheck -check-prefix=I386 %s
+// I386: "-triple" "i386-unknown-unknown"
+// I386: "-S"
+// I386: "-disable-free"
+// I386: "-mrelocation-model" "static"
+// I386: "-mdisable-fp-elim"
+// I386: "-masm-verbose"
+// I386: "-munwind-tables"
+// I386: "-Os"
+// I386: "-fvisibility"
+// I386: "hidden"
+// I386: "-o"
+// I386: clang-translation
+// RUN: %clang -target i386-apple-darwin9 -### -S %s -o %t.s 2>&1 | \
+// RUN: FileCheck -check-prefix=YONAH %s
+// YONAH: "-target-cpu"
+// YONAH: "yonah"
+// RUN: %clang -target x86_64-apple-darwin9 -### -S %s -o %t.s 2>&1 | \
+// RUN: FileCheck -check-prefix=CORE2 %s
+// CORE2: "-target-cpu"
+// CORE2: "core2"
-// RUN: %clang -target x86_64-apple-darwin10 -### -S %s 2> %t.log \
-// RUN: -arch armv7
-// RUN: FileCheck -check-prefix=ARMV7_DEFAULT %s < %t.log
+// RUN: %clang -target x86_64-apple-darwin10 -### -S %s -arch armv7 2>&1 | \
+// RUN: FileCheck -check-prefix=ARMV7_DEFAULT %s
// ARMV7_DEFAULT: clang
// ARMV7_DEFAULT: "-cc1"
// ARMV7_DEFAULT-NOT: "-msoft-float"
@@ -24,9 +29,8 @@
// ARMV7_DEFAULT-NOT: "-msoft-float"
// ARMV7_DEFAULT: "-x" "c"
-// RUN: %clang -target x86_64-apple-darwin10 -### -S %s 2> %t.log \
-// RUN: -arch armv7 -msoft-float
-// RUN: FileCheck -check-prefix=ARMV7_SOFTFLOAT %s < %t.log
+// RUN: %clang -target x86_64-apple-darwin10 -### -S %s -arch armv7 \
+// RUN: -msoft-float 2>&1 | FileCheck -check-prefix=ARMV7_SOFTFLOAT %s
// ARMV7_SOFTFLOAT: clang
// ARMV7_SOFTFLOAT: "-cc1"
// ARMV7_SOFTFLOAT: "-msoft-float"
@@ -35,9 +39,8 @@
// ARMV7_SOFTFLOAT: "-neon"
// ARMV7_SOFTFLOAT: "-x" "c"
-// RUN: %clang -target x86_64-apple-darwin10 -### -S %s 2> %t.log \
-// RUN: -arch armv7 -mhard-float
-// RUN: FileCheck -check-prefix=ARMV7_HARDFLOAT %s < %t.log
+// RUN: %clang -target x86_64-apple-darwin10 -### -S %s -arch armv7 \
+// RUN: -mhard-float 2>&1 | FileCheck -check-prefix=ARMV7_HARDFLOAT %s
// ARMV7_HARDFLOAT: clang
// ARMV7_HARDFLOAT: "-cc1"
// ARMV7_HARDFLOAT-NOT: "-msoft-float"
@@ -45,32 +48,60 @@
// ARMV7_HARDFLOAT-NOT: "-msoft-float"
// ARMV7_HARDFLOAT: "-x" "c"
-// RUN: %clang -target arm-linux -### -S %s 2> %t.log \
-// RUN: -march=armv5e
-// RUN: FileCheck -check-prefix=ARMV5E %s < %t.log
+// RUN: %clang -target arm-linux -### -S %s -march=armv5e 2>&1 | \
+// RUN: FileCheck -check-prefix=ARMV5E %s
// ARMV5E: clang
// ARMV5E: "-cc1"
// ARMV5E: "-target-cpu" "arm1022e"
-// RUN: %clang -ccc-clang-archs powerpc64 \
-// RUN: -target powerpc64-unknown-linux-gnu -### -S %s 2> %t.log \
-// RUN: -mcpu=G5
-// RUN: FileCheck -check-prefix=PPCG5 %s < %t.log
+// RUN: %clang -target powerpc64-unknown-linux-gnu \
+// RUN: -### -S %s -mcpu=G5 2>&1 | FileCheck -check-prefix=PPCG5 %s
// PPCG5: clang
// PPCG5: "-cc1"
// PPCG5: "-target-cpu" "g5"
-// RUN: %clang -ccc-clang-archs powerpc64 \
-// RUN: -target powerpc64-unknown-linux-gnu -### -S %s 2> %t.log \
-// RUN: -mcpu=power7
-// RUN: FileCheck -check-prefix=PPCPWR7 %s < %t.log
+// RUN: %clang -target powerpc64-unknown-linux-gnu \
+// RUN: -### -S %s -mcpu=power7 2>&1 | FileCheck -check-prefix=PPCPWR7 %s
// PPCPWR7: clang
// PPCPWR7: "-cc1"
// PPCPWR7: "-target-cpu" "pwr7"
-// RUN: %clang -ccc-clang-archs powerpc64 \
-// RUN: -target powerpc64-unknown-linux-gnu -### -S %s 2> %t.log
-// RUN: FileCheck -check-prefix=PPC64NS %s < %t.log
+// RUN: %clang -target powerpc64-unknown-linux-gnu \
+// RUN: -### -S %s 2>&1 | FileCheck -check-prefix=PPC64NS %s
// PPC64NS: clang
// PPC64NS: "-cc1"
// PPC64NS: "-target-cpu" "ppc64"
+
+// RUN: %clang -target powerpc-fsl-linux -### -S %s \
+// RUN: -mcpu=e500mc 2>&1 | FileCheck -check-prefix=PPCE500MC %s
+// PPCE500MC: clang
+// PPCE500MC: "-cc1"
+// PPCE500MC: "-target-cpu" "e500mc"
+
+// RUN: %clang -target powerpc64-fsl-linux -### -S \
+// RUN: %s -mcpu=e5500 2>&1 | FileCheck -check-prefix=PPCE5500 %s
+// PPCE5500: clang
+// PPCE5500: "-cc1"
+// PPCE5500: "-target-cpu" "e5500"
+
+// RUN: %clang -target amd64-unknown-openbsd5.2 -### -S %s 2>&1 | \
+// RUN: FileCheck -check-prefix=AMD64 %s
+// AMD64: clang
+// AMD64: "-cc1"
+// AMD64: "-triple"
+// AMD64: "amd64-unknown-openbsd5.2"
+// AMD64: "-munwind-tables"
+
+// RUN: %clang -target amd64--mingw32 -### -S %s 2>&1 | \
+// RUN: FileCheck -check-prefix=AMD64-MINGW %s
+// AMD64-MINGW: clang
+// AMD64-MINGW: "-cc1"
+// AMD64-MINGW: "-triple"
+// AMD64-MINGW: "amd64--mingw32"
+// AMD64-MINGW: "-munwind-tables"
+
+// RUN: %clang -target i386-linux-android -### -S %s 2>&1 \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=ANDROID-X86 %s
+// ANDROID-X86: clang
+// ANDROID-X86: "-target-cpu" "core2"
diff --git a/test/Driver/cpath.c b/test/Driver/cpath.c
index bd7c8d0ab5f0..ea6ba49d6d51 100644
--- a/test/Driver/cpath.c
+++ b/test/Driver/cpath.c
@@ -1,8 +1,8 @@
// RUN: mkdir -p %T/test1 %T/test2 %T/test3
// RUN: env "CPATH=%T/test1%{pathsep}%T/test2" %clang -x c -E -v %s 2>&1 | FileCheck %s -check-prefix=CPATH
-// CPATH: -I {{.*}}/test1
-// CPATH: -I {{.*}}/test2
+// CPATH: -I{{.*}}/test1
+// CPATH: -I{{.*}}/test2
// CPATH: search starts here
// CPATH: test1
// CPATH: test2
diff --git a/test/Driver/crash-report.c b/test/Driver/crash-report.c
index 7adaf42a2c95..bfcd5732b33d 100644
--- a/test/Driver/crash-report.c
+++ b/test/Driver/crash-report.c
@@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: mkdir %t
-// RUN: env TMPDIR=%t TEMP=%t TMP=%t %clang -fsyntax-only %s \
+// RUN: env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1 %clang -fsyntax-only %s \
// RUN: -F/tmp/ -I /tmp/ -idirafter /tmp/ -iquote /tmp/ -isystem /tmp/ \
// RUN: -iprefix /the/prefix -iwithprefix /tmp -iwithprefixbefore /tmp/ \
// RUN: -internal-isystem /tmp/ -internal-externc-isystem /tmp/ \
@@ -25,3 +25,4 @@ FOO
// CHECKSH-NOT: -iwithprefixbefore /tmp/
// CHECKSH-NOT: -internal-isystem /tmp/
// CHECKSH-NOT: -internal-externc-isystem /tmp/
+// CHECKSH-NOT: -dwarf-debug-flags
diff --git a/test/Driver/darwin-arch-default.c b/test/Driver/darwin-arch-default.c
new file mode 100644
index 000000000000..60bf61de8a34
--- /dev/null
+++ b/test/Driver/darwin-arch-default.c
@@ -0,0 +1,7 @@
+// Check that the name of the arch we bind is "ppc" not "powerpc".
+//
+// RUN: %clang -target powerpc-apple-darwin8 -### \
+// RUN: -ccc-print-phases %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-POWERPC < %t %s
+//
+// CHECK-POWERPC: bind-arch, "ppc"
diff --git a/test/Driver/darwin-asan-nofortify.c b/test/Driver/darwin-asan-nofortify.c
new file mode 100644
index 000000000000..7f325e097b38
--- /dev/null
+++ b/test/Driver/darwin-asan-nofortify.c
@@ -0,0 +1,6 @@
+// Make sure AddressSanitizer disables _FORTIFY_SOURCE on Darwin.
+
+// RUN: %clang -faddress-sanitizer %s -E -dM -target x86_64-darwin - | FileCheck %s
+// RUN: %clang -fsanitize=address %s -E -dM -target x86_64-darwin - | FileCheck %s
+
+// CHECK: #define _FORTIFY_SOURCE 0
diff --git a/test/Driver/darwin-cc.c b/test/Driver/darwin-cc.c
deleted file mode 100644
index 85cdf12fb19f..000000000000
--- a/test/Driver/darwin-cc.c
+++ /dev/null
@@ -1,4 +0,0 @@
-// RUN: %clang -ccc-no-clang -target i386-apple-darwin10 -m32 -### -MD -g -fast -Q -dA -mkernel -ansi -aFOO -S -o /tmp/OUTPUTNAME -g0 -gfull -O2 -Werror -pedantic -Wmost -w -std=c99 -trigraphs -v -pg -fFOO -undef -Qn --param a=b -fmudflap -coverage -save-temps -nostdinc -I ARG0 -F ARG1 -I ARG2 -P -MF ARG3 -MG -MP -remap -g3 -H -D ARG4 -U ARG5 -A ARG6 -D ARG7 -U ARG8 -A ARG9 -include ARG10 -pthread %s 2> %t.log
-// RUN: FileCheck %s < %t.log
-// CHECK: {{ ".*cc1.*" "-E" "-nostdinc" "-v" "-I" "ARG0" "-FARG1" "-I" "ARG2" "-P" "-MD" "[^"]*/OUTPUTNAME.d" "-MF" "ARG3" "-MG" "-MP" "-MQ" "[^"]*/OUTPUTNAME" "-remap" "-dD" "-H" "-D__STATIC__" "-D_REENTRANT" "-D" "ARG4" "-U" "ARG5" "-A" "ARG6" "-D" "ARG7" "-U" "ARG8" "-A" "ARG9" "-include" "ARG10" ".*darwin-cc.c" "-D_MUDFLAP" "-include" "mf-runtime.h" "-m32" "-mkernel" "-mtune=core2" "-mmacosx-version-min=10.6.0" "-ansi" "-std=c99" "-trigraphs" "-Werror" "-pedantic" "-Wmost" "-w" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-O2" "-undef" "-fpch-preprocess" "-o" ".*darwin-cc.i"}}
-// CHECK: {{ ".*cc1.*" "-fpreprocessed" ".*darwin-cc.i" "-O3" "-dumpbase" ".*darwin-cc.c" "-dA" "-m32" "-mkernel" "-mtune=core2" "-mmacosx-version-min=10.6.0" "-ansi" "-aFOO" "-auxbase-strip" "[^"]*/OUTPUTNAME" "-g" "-g0" "-g" "-g3" "-O2" "-Werror" "-pedantic" "-Wmost" "-w" "-ansi" "-std=c99" "-trigraphs" "-version" "-p" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-undef" "-fno-ident" "-o" "[^"]*/OUTPUTNAME" "--param" "a=b" "-fno-builtin" "-fno-merge-constants" "-fprofile-arcs" "-ftest-coverage"}}
diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c
index 4cda37f9b2e3..cd511e034f13 100644
--- a/test/Driver/darwin-ld.c
+++ b/test/Driver/darwin-ld.c
@@ -80,7 +80,7 @@
// LINK_OLDER_NODEMANGLE-NOT: "-demangle"
// LINK_OLDER_NODEMANGLE: "-lSystem"
-// RUN: %clang -target x86_64-apple-darwin10 -### %t.o \
+// RUN: %clang -target x86_64-apple-darwin10 -### %s \
// RUN: -mlinker-version=117 -flto 2> %t.log
// RUN: cat %t.log
// RUN: FileCheck -check-prefix=LINK_OBJECT_LTO_PATH %s < %t.log
@@ -122,6 +122,10 @@
// RUN: FileCheck -check-prefix=LINK_NO_CRT1 %s < %t.log
// LINK_NO_CRT1-NOT: crt
+// RUN: %clang -target armv7-apple-ios6.0 -miphoneos-version-min=6.0 -### %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_NO_IOS_CRT1 %s < %t.log
+// LINK_NO_IOS_CRT1-NOT: crt
+
// RUN: %clang -target i386-apple-darwin12 -pg -### %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_PG %s < %t.log
// LINK_PG: -lgcrt1.o
diff --git a/test/Driver/darwin-sdkroot.c b/test/Driver/darwin-sdkroot.c
new file mode 100644
index 000000000000..5abf08156362
--- /dev/null
+++ b/test/Driver/darwin-sdkroot.c
@@ -0,0 +1,22 @@
+// Check that SDKROOT is used to define the default for -isysroot on Darwin.
+//
+// RUN: rm -rf %t.tmpdir
+// RUN: mkdir -p %t.tmpdir
+// RUN: env SDKROOT=%t.tmpdir %clang -target x86_64-apple-darwin10 \
+// RUN: -c %s -### 2> %t.log
+// RUN: FileCheck --check-prefix=CHECK-BASIC < %t.log %s
+//
+// CHECK-BASIC: clang
+// CHECK-BASIC: "-cc1"
+// CHECK-BASIC: "-isysroot" "{{.*tmpdir}}"
+
+// Check that we don't use SDKROOT as the default if it is not a valid path.
+
+// RUN: rm -rf %t.nonpath
+// RUN: env SDKROOT=%t.nonpath %clang -target x86_64-apple-darwin10 \
+// RUN: -c %s -### 2> %t.log
+// RUN: FileCheck --check-prefix=CHECK-NONPATH < %t.log %s
+//
+// CHECK-NONPATH: clang
+// CHECK-NONPATH: "-cc1"
+// CHECK-NONPATH-NOT: "-isysroot"
diff --git a/test/Driver/fast-math.c b/test/Driver/fast-math.c
index 8426f0950acf..17bf6ed617dd 100644
--- a/test/Driver/fast-math.c
+++ b/test/Driver/fast-math.c
@@ -12,16 +12,46 @@
// CHECK-NO-INFS: "-cc1"
// CHECK-NO-INFS: "-menable-no-infs"
//
+// RUN: %clang -### -fno-fast-math -fno-honor-infinities -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-NO-INFS %s
+// CHECK-NO-FAST-MATH-NO-INFS: "-cc1"
+// CHECK-NO-FAST-MATH-NO-INFS: "-menable-no-infs"
+//
+// RUN: %clang -### -fno-honor-infinities -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-INFS-NO-FAST-MATH %s
+// CHECK-NO-INFS-NO-FAST-MATH: "-cc1"
+// CHECK-NO-INFS-NO-FAST-MATH-NOT: "-menable-no-infs"
+//
// RUN: %clang -### -fno-honor-nans -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NO-NANS %s
// CHECK-NO-NANS: "-cc1"
// CHECK-NO-NANS: "-menable-no-nans"
//
+// RUN: %clang -### -fno-fast-math -fno-honor-nans -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-NO-NANS %s
+// CHECK-NO-FAST-MATH-NO-NANS: "-cc1"
+// CHECK-NO-FAST-MATH-NO-NANS: "-menable-no-nans"
+//
+// RUN: %clang -### -fno-honor-nans -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-NANS-NO-FAST-MATH %s
+// CHECK-NO-NANS-NO-FAST-MATH: "-cc1"
+// CHECK-NO-NANS-NO-FAST-MATH-NOT: "-menable-no-nans"
+//
// RUN: %clang -### -fmath-errno -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-MATH-ERRNO %s
// CHECK-MATH-ERRNO: "-cc1"
// CHECK-MATH-ERRNO: "-fmath-errno"
//
+// RUN: %clang -### -fno-fast-math -fmath-errno -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-MATH-ERRNO %s
+// CHECK-NO-FAST-MATH-MATH-ERRNO: "-cc1"
+// CHECK-NO-FAST-MATH-MATH-ERRNO: "-fmath-errno"
+//
+// RUN: %clang -### -fmath-errno -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-MATH-ERRNO-NO-FAST-MATH %s
+// CHECK-MATH-ERRNO-NO-FAST-MATH: "-cc1"
+// CHECK-MATH-ERRNO-NO-FAST-MATH-NOT: "-fmath-errno"
+//
// RUN: %clang -### -fmath-errno -fno-math-errno -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
// RUN: %clang -### -target i686-apple-darwin -c %s 2>&1 \
@@ -43,6 +73,18 @@
// CHECK-UNSAFE-MATH: "-cc1"
// CHECK-UNSAFE-MATH: "-menable-unsafe-fp-math"
//
+// RUN: %clang -### -fno-fast-math -fno-math-errno -fassociative-math -freciprocal-math \
+// RUN: -fno-signed-zeros -fno-trapping-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-UNSAFE-MATH %s
+// CHECK-NO-FAST-MATH-UNSAFE-MATH: "-cc1"
+// CHECK-NO-FAST-MATH-UNSAFE-MATH: "-menable-unsafe-fp-math"
+//
+// RUN: %clang -### -fno-fast-math -fno-math-errno -fassociative-math -freciprocal-math \
+// RUN: -fno-fast-math -fno-signed-zeros -fno-trapping-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH-NO-FAST-MATH %s
+// CHECK-UNSAFE-MATH-NO-FAST-MATH: "-cc1"
+// CHECK-UNSAFE-MATH-NO-FAST-MATH-NOT: "-menable-unsafe-fp-math"
+//
// Check that various umbrella flags also enable these frontend options.
// RUN: %clang -### -ffast-math -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NO-INFS %s
@@ -63,12 +105,19 @@
// impact remains even if every optimization is disabled.
// RUN: %clang -### -ffast-math -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-FAST-MATH %s
+// RUN: %clang -### -fno-fast-math -ffast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-FAST-MATH %s
// RUN: %clang -### -ffast-math -fno-finite-math-only \
// RUN: -fno-unsafe-math-optimizations -fmath-errno -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-FAST-MATH %s
// CHECK-FAST-MATH: "-cc1"
// CHECK-FAST-MATH: "-ffast-math"
//
+// RUN: %clang -### -ffast-math -fno-fast-math -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH %s
+// CHECK-NO-FAST-MATH: "-cc1"
+// CHECK-NO-FAST-MATH-NOT: "-ffast-math"
+//
// Check various means of disabling these flags, including disabling them after
// they've been enabled via an umbrella flag.
// RUN: %clang -### -fno-honor-infinities -fhonor-infinities -c %s 2>&1 \
diff --git a/test/Driver/freebsd-mips-as.c b/test/Driver/freebsd-mips-as.c
new file mode 100644
index 000000000000..54ff1875155b
--- /dev/null
+++ b/test/Driver/freebsd-mips-as.c
@@ -0,0 +1,81 @@
+// Check passing options to the assembler for MIPS targets.
+//
+// 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-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 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-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-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-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-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"
+//
+// RUN: %clang -target mips-linux-freebsd -march=mips32r2 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-32R2 %s
+// MIPS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mips-unknown-freebsd -mips32 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-32 %s
+// MIPS-ALIAS-32: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mips-unknown-freebsd -mips32r2 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R2 %s
+// MIPS-ALIAS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mips-unknown-freebsd -mips64 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-64 %s
+// MIPS-ALIAS-64: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB"
+//
+// RUN: %clang -target mips-unknown-freebsd -mips64r2 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R2 %s
+// MIPS-ALIAS-64R2: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EB"
diff --git a/test/Driver/freebsd.c b/test/Driver/freebsd.c
index 642c60ce77b5..db53d4ddd8a1 100644
--- a/test/Driver/freebsd.c
+++ b/test/Driver/freebsd.c
@@ -1,5 +1,5 @@
-// REQUIRES: ppc32-registered-target,ppc64-registered-target
-// RUN: %clang -ccc-clang-archs powerpc -no-canonical-prefixes \
+// REQUIRES: ppc32-registered-target,ppc64-registered-target,mips-registered-target
+// RUN: %clang -no-canonical-prefixes \
// RUN: -target powerpc-pc-freebsd8 %s \
// RUN: --sysroot=%S/Inputs/basic_freebsd_tree -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PPC %s
@@ -7,7 +7,7 @@
// 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 -ccc-clang-archs powerpc64 -no-canonical-prefixes \
+// RUN: %clang -no-canonical-prefixes \
// RUN: -target powerpc64-pc-freebsd8 %s \
// RUN: --sysroot=%S/Inputs/basic_freebsd64_tree -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PPC64 %s
@@ -43,4 +43,56 @@
// 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 \
+// 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 \
+// 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 \
+// 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 \
+// 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 -no-canonical-prefixes -target x86_64-pc-freebsd8 -static %s \
+// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-STATIC %s
+// CHECK-STATIC: crt1.o
+// CHECK-STATIC: crtbeginT.o
+
+// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -shared %s \
+// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-SHARED %s
+// CHECK-SHARED: crti.o
+// CHECK-SHARED: crtbeginS.o
+
+// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -pie %s \
+// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PIE %s
+// CHECK-PIE: pie
+// CHECK-PIE: Scrt1.o
+// CHECK-PIE: crtbeginS.o
+// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 %s \
+// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NORMAL %s
+// CHECK-NORMAL: crt1.o
+// CHECK-NORMAL: crtbegin.o
diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c
new file mode 100644
index 000000000000..9f7cd46c6cf7
--- /dev/null
+++ b/test/Driver/fsanitize.c
@@ -0,0 +1,23 @@
+// RUN: %clang -target x86_64-linux-gnu -fcatch-undefined-behavior %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED
+// CHECK-UNDEFINED: "-fsanitize={{((signed-integer-overflow|divide-by-zero|shift|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow),?){11}"}}
+
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread,undefined -fno-thread-sanitizer -fno-sanitize=float-cast-overflow,vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PARTIAL-UNDEFINED
+// CHECK-PARTIAL-UNDEFINED: "-fsanitize={{((signed-integer-overflow|divide-by-zero|shift|unreachable|return|vla-bound|alignment|null|object-size),?){9}"}}
+
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-rtti %s -c -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-RTTI
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-rtti %s -c -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-RTTI
+// CHECK-VPTR-NO-RTTI: '-fsanitize=vptr' not allowed with '-fno-rtti'
+
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,thread -fno-rtti %s -c -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANT
+// CHECK-SANA-SANT: '-fsanitize=address' not allowed with '-fsanitize=thread'
+
+// RUN: %clang -target x86_64-linux-gnu -faddress-sanitizer -fthread-sanitizer -fno-rtti %s -c -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-TSAN
+// CHECK-ASAN-TSAN: '-faddress-sanitizer' not allowed with '-fthread-sanitizer'
+
+// RUN: %clang -target x86_64-linux-gnu -fcatch-undefined-behavior -fthread-sanitizer -fno-thread-sanitizer -faddress-sanitizer -fno-address-sanitizer -c -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=CHECK-DEPRECATED
+// CHECK-DEPRECATED: argument '-fcatch-undefined-behavior' is deprecated, use '-fsanitize=undefined' instead
+// CHECK-DEPRECATED: argument '-fthread-sanitizer' is deprecated, use '-fsanitize=thread' instead
+// CHECK-DEPRECATED: argument '-fno-thread-sanitizer' is deprecated, use '-fno-sanitize=thread' instead
+// CHECK-DEPRECATED: argument '-faddress-sanitizer' is deprecated, use '-fsanitize=address' instead
+// CHECK-DEPRECATED: argument '-fno-address-sanitizer' is deprecated, use '-fno-sanitize=address' instead
diff --git a/test/Driver/gcc_forward.c b/test/Driver/gcc_forward.c
index 77f401b92e5a..8eead214feef 100644
--- a/test/Driver/gcc_forward.c
+++ b/test/Driver/gcc_forward.c
@@ -1,7 +1,7 @@
// Check that we don't try to forward -Xclang or -mlinker-version to GCC.
//
// RUN: %clang -target powerpc-unknown-unknown \
-// RUN: -ccc-clang-archs i386 -c %s \
+// RUN: -c %s \
// RUN: -Xclang foo-bar \
// RUN: -mlinker-version=10 -### 2> %t
// RUN: FileCheck < %t %s
diff --git a/test/Driver/hello.c b/test/Driver/hello.c
deleted file mode 100644
index c2260e53eb38..000000000000
--- a/test/Driver/hello.c
+++ /dev/null
@@ -1,18 +0,0 @@
-// RUN: %clang -ccc-echo -o %t.exe %s 2> %t.log
-
-// Make sure we used clang.
-// RUN: grep 'clang\(-[0-9.]\+\)\?\(\.[Ee][Xx][Ee]\)\?" -cc1 .*hello.c' %t.log
-
-// RUN: %t.exe > %t.out
-// RUN: grep "I'm a little driver, short and stout." %t.out
-
-// FIXME: We don't have a usable assembler on Windows, so we can't build real
-// apps yet.
-// XFAIL: win32
-
-#include <stdio.h>
-
-int main() {
- printf("I'm a little driver, short and stout.");
- return 0;
-}
diff --git a/test/Driver/immediate-options.c b/test/Driver/immediate-options.c
index 5a3ec872b4fe..2b54ecf7c150 100644
--- a/test/Driver/immediate-options.c
+++ b/test/Driver/immediate-options.c
@@ -1,4 +1,6 @@
-// RUN: %clang --help
-// RUN: %clang --help-hidden
+// RUN: %clang --help | grep isystem
+// RUN: %clang --help | not grep ast-dump
+// RUN: %clang --help | not grep ccc-cxx
+// RUN: %clang --help-hidden | grep ccc-cxx
// RUN: %clang -dumpversion
// RUN: %clang -print-search-dirs
diff --git a/test/Driver/ios-simulator-arcruntime.c b/test/Driver/ios-simulator-arcruntime.c
index 33d34924ced1..605df93f4957 100644
--- a/test/Driver/ios-simulator-arcruntime.c
+++ b/test/Driver/ios-simulator-arcruntime.c
@@ -1,8 +1,8 @@
-// RUN: %clang -### -x objective-c -target i386-apple-darwin10 -arch i386 -mmacosx-version-min=10.6 -D__IPHONE_OS_VERSION_MIN_REQUIRED=40201 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
-// RUN: %clang -### -x objective-c -target i386-apple-darwin10 -arch i386 -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
+// RUN: %clang -### -x objective-c -target i386-apple-darwin10 -arch i386 -mios-simulator-version-min=4.2.1 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
+// RUN: %clang -### -x objective-c -target i386-apple-darwin10 -arch i386 -mios-simulator-version-min=5.0.0 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
//
-// CHECK-OPTIONS1: i386-apple-macosx10.6.0
+// CHECK-OPTIONS1: i386-apple-ios4.2.1
// CHECK-OPTIONS1: -fobjc-runtime=ios-4.2.1
-// CHECK-OPTIONS2: i386-apple-macosx10.6.0
+// CHECK-OPTIONS2: i386-apple-ios5.0.0
// CHECK-OPTIONS2: -fobjc-runtime=ios-5.0.0
diff --git a/test/Driver/le32-unknown-nacl.cpp b/test/Driver/le32-unknown-nacl.cpp
index f68b2206f209..61388c5ca186 100644
--- a/test/Driver/le32-unknown-nacl.cpp
+++ b/test/Driver/le32-unknown-nacl.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang -target le32-unknown-nacl -ccc-clang-archs le32 -ccc-echo %s -emit-llvm-only -c 2>&1 | FileCheck %s -check-prefix=ECHO
-// RUN: %clang -target le32-unknown-nacl -ccc-clang-archs le32 %s -emit-llvm -S -c -o - | FileCheck %s
-// RUN: %clang -target le32-unknown-nacl -ccc-clang-archs le32 %s -emit-llvm -S -c -pthread -o - | FileCheck %s -check-prefix=THREADS
+// RUN: %clang -target le32-unknown-nacl -ccc-echo %s -emit-llvm-only -c 2>&1 | FileCheck %s -check-prefix=ECHO
+// RUN: %clang -target le32-unknown-nacl %s -emit-llvm -S -c -o - | FileCheck %s
+// RUN: %clang -target le32-unknown-nacl %s -emit-llvm -S -c -pthread -o - | FileCheck %s -check-prefix=THREADS
// ECHO: {{.*}} -cc1 {{.*}}le32-unknown-nacl.c
diff --git a/test/Driver/linker-opts.c b/test/Driver/linker-opts.c
index 85e180c4e210..2a96a17c70d3 100644
--- a/test/Driver/linker-opts.c
+++ b/test/Driver/linker-opts.c
@@ -1,5 +1,5 @@
// RUN: env LIBRARY_PATH=%T/test1 %clang -x c %s -### 2>&1 | FileCheck %s
-// CHECK: "-L" "{{.*}}/test1"
+// CHECK: "-L{{.*}}/test1"
// GCC driver is used as linker on cygming. It should be aware of LIBRARY_PATH.
// XFAIL: cygwin,mingw32,win32
diff --git a/test/Driver/linux-header-search.cpp b/test/Driver/linux-header-search.cpp
index ea82660811d2..065bd34566d7 100644
--- a/test/Driver/linux-header-search.cpp
+++ b/test/Driver/linux-header-search.cpp
@@ -45,7 +45,7 @@
// CHECK-DEBIAN-X86-64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/x86_64-linux-gnu"
// CHECK-DEBIAN-X86-64: "-internal-externc-isystem" "[[SYSROOT]]/include"
// CHECK-DEBIAN-X86-64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
-// RUN: %clang -ccc-clang-archs powerpc -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
// RUN: -target powerpc-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC %s
@@ -59,7 +59,7 @@
// CHECK-DEBIAN-PPC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/powerpc-linux-gnu"
// CHECK-DEBIAN-PPC: "-internal-externc-isystem" "[[SYSROOT]]/include"
// CHECK-DEBIAN-PPC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
-// RUN: %clang -ccc-clang-archs powerpc64 -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
// RUN: -target powerpc64-linux-gnu \
// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC64 %s
diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c
index a6831b62a904..72370297f40e 100644
--- a/test/Driver/linux-ld.c
+++ b/test/Driver/linux-ld.c
@@ -238,33 +238,47 @@
// and provide correct path to the dynamic linker and emulation mode when build
// for MIPS platforms.
// RUN: %clang %s -### -o %t.o 2>&1 \
-// RUN: -target mips-linux-gnu -ccc-clang-archs mips \
+// RUN: -target mips-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-MIPS %s
// CHECK-MIPS: "{{.*}}ld{{(.exe)?}}"
// CHECK-MIPS: "-m" "elf32btsmip"
// CHECK-MIPS: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
// CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
// RUN: %clang %s -### -o %t.o 2>&1 \
-// RUN: -target mipsel-linux-gnu -ccc-clang-archs mipsel \
+// RUN: -target mipsel-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-MIPSEL %s
// CHECK-MIPSEL: "{{.*}}ld{{(.exe)?}}"
// CHECK-MIPSEL: "-m" "elf32ltsmip"
// CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
// CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
// RUN: %clang %s -### -o %t.o 2>&1 \
-// RUN: -target mips64-linux-gnu -ccc-clang-archs mips64 \
+// RUN: -target mips64-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-MIPS64 %s
// CHECK-MIPS64: "{{.*}}ld{{(.exe)?}}"
// CHECK-MIPS64: "-m" "elf64btsmip"
// CHECK-MIPS64: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
// CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
// RUN: %clang %s -### -o %t.o 2>&1 \
-// RUN: -target mips64el-linux-gnu -ccc-clang-archs mips64el \
+// RUN: -target mips64el-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL %s
// CHECK-MIPS64EL: "{{.*}}ld{{(.exe)?}}"
// CHECK-MIPS64EL: "-m" "elf64ltsmip"
// CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
// CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: -target mips64-linux-gnu -mabi=n32 \
+// RUN: | FileCheck --check-prefix=CHECK-MIPS64-N32 %s
+// CHECK-MIPS64-N32: "{{.*}}ld{{(.exe)?}}"
+// CHECK-MIPS64-N32: "-m" "elf32btsmipn32"
+// CHECK-MIPS64-N32: "-dynamic-linker" "{{.*}}/lib32/ld.so.1"
+// CHECK-MIPS64-N32-NOT: "--hash-style={{gnu|both}}"
+// RUN: %clang %s -### -o %t.o 2>&1 \
+// RUN: -target mips64el-linux-gnu -mabi=n32 \
+// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-N32 %s
+// CHECK-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}"
+// CHECK-MIPS64EL-N32: "-m" "elf32ltsmipn32"
+// CHECK-MIPS64EL-N32: "-dynamic-linker" "{{.*}}/lib32/ld.so.1"
+// CHECK-MIPS64EL-N32-NOT: "--hash-style={{gnu|both}}"
//
// Thoroughly exercise the Debian multiarch environment.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -361,11 +375,45 @@
// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/lib"
// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mips64-linux-gnu -mabi=n32 \
+// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64-N32 %s
+// CHECK-DEBIAN-MIPS64-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-MIPS64-N32: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/n32/crtbegin.o"
+// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/n32"
+// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
+// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
+// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mips64el-linux-gnu -mabi=n32 \
+// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64EL-N32 %s
+// CHECK-DEBIAN-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/n32/crtbegin.o"
+// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/n32"
+// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
+// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
+// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib"
//
// Test linker invocation on Android.
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -target arm-linux-androideabi \
-// RUN: --sysroot=%S/Inputs/basic_android_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mipsel-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
// CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
// CHECK-ANDROID: "{{.*}}/crtbegin_dynamic.o"
@@ -376,10 +424,26 @@
// CHECK-ANDROID: "{{.*}}/crtend_android.o"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -target arm-linux-androideabi \
-// RUN: --sysroot=%S/Inputs/basic_android_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -shared \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -shared \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mipsel-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -shared \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -shared \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
// CHECK-ANDROID-SO: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-ANDROID-SO: "-Bsymbolic"
// CHECK-ANDROID-SO: "{{.*}}/crtbegin_so.o"
// CHECK-ANDROID-SO: "-L[[SYSROOT]]/usr/lib"
// CHECK-ANDROID-SO-NOT: "gcc_s"
@@ -388,7 +452,22 @@
// CHECK-ANDROID-SO: "{{.*}}/crtend_so.o"
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -target arm-linux-androideabi \
-// RUN: --sysroot=%S/Inputs/basic_android_tree \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -static \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -static \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mipsel-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -static \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: -static \
// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
// CHECK-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
@@ -398,3 +477,120 @@
// CHECK-ANDROID-STATIC: "-lgcc"
// CHECK-ANDROID-STATIC-NOT: "gcc_s"
// CHECK-ANDROID-STATIC: "{{.*}}/crtend_android.o"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-androideabi \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -pie \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -pie \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mipsel-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -pie \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-linux-android \
+// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN: -pie \
+// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
+// CHECK-ANDROID-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-ANDROID-PIE: "{{.*}}/crtbegin_dynamic.o"
+// CHECK-ANDROID-PIE: "-L[[SYSROOT]]/usr/lib"
+// CHECK-ANDROID-PIE-NOT: "gcc_s"
+// CHECK-ANDROID-PIE: "-lgcc"
+// CHECK-ANDROID-PIE-NOT: "gcc_s"
+// CHECK-ANDROID-PIE: "{{.*}}/crtend_android.o"
+//
+// Check linker invocation on Debian 6 MIPS 32/64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mipsel-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPSEL %s
+// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib/crt1.o"
+// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib/crti.o"
+// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/crtbegin.o"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib/../lib"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/../lib"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mips64el-linux-gnu \
+// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL %s
+// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64/crt1.o"
+// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64/crti.o"
+// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/64/crtbegin.o"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/64"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib/../lib64"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/../lib64"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target mips64el-linux-gnu -mabi=n32 \
+// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
+// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-N32 %s
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32/crt1.o"
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32/crti.o"
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/n32/crtbegin.o"
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/n32"
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32"
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/lib/../lib32"
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/../lib32"
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/lib"
+// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib"
+//
+// Test linker invocation for Freescale SDK (OpenEmbedded).
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc-fsl-linux \
+// RUN: --sysroot=%S/Inputs/freescale_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-FSL-PPC %s
+// CHECK-FSL-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-FSL-PPC: "-m" "elf32ppclinux"
+// CHECK-FSL-PPC: "{{.*}}/crt1.o"
+// CHECK-FSL-PPC: "{{.*}}/crtbegin.o"
+// CHECK-FSL-PPC: "-L[[SYSROOT]]/usr/lib"
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc64-fsl-linux \
+// RUN: --sysroot=%S/Inputs/freescale_ppc64_tree \
+// RUN: | FileCheck --check-prefix=CHECK-FSL-PPC64 %s
+// CHECK-FSL-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-FSL-PPC64: "-m" "elf64ppc"
+// CHECK-FSL-PPC64: "{{.*}}/crt1.o"
+// CHECK-FSL-PPC64: "{{.*}}/crtbegin.o"
+// CHECK-FSL-PPC64: "-L[[SYSROOT]]/usr/lib64/powerpc64-fsl-linux/4.6.2/../.."
+//
+// Check that crtfastmath.o is linked with -ffast-math.
+// RUN: %clang -target x86_64-unknown-linux -### %s \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
+// RUN: %clang -target x86_64-unknown-linux -### %s -ffast-math \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
+// RUN: %clang -target x86_64-unknown-linux -### %s -funsafe-math-optimizations\
+// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
+// RUN: %clang -target x86_64-unknown-linux -### %s -ffast-math -fno-fast-math \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
+// We don't have crtfastmath.o in the i386 tree, use it to check that file
+// detection works.
+// RUN: %clang -target i386-unknown-linux -### %s -ffast-math \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
+// CHECK-CRTFASTMATH: usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtfastmath.o
+// CHECK-NOCRTFASTMATH-NOT: crtfastmath.o
diff --git a/test/Driver/mips-as.c b/test/Driver/mips-as.c
index 0ace4dd51c74..fbaf62fdadd5 100644
--- a/test/Driver/mips-as.c
+++ b/test/Driver/mips-as.c
@@ -1,3 +1,5 @@
+// REQUIRES: mips-registered-target
+//
// Check passing options to the assembler for MIPS targets.
//
// RUN: %clang -target mips-linux-gnu -### \
@@ -36,3 +38,28 @@
// RUN: -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS-N32 %s
// MIPS-N32: as{{(.exe)?}}" "-march" "mips64" "-mabi" "n32" "-EB"
+//
+// RUN: %clang -target mips-linux-gnu -march=mips32r2 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-32R2 %s
+// MIPS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mips-linux-gnu -mips32 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-32 %s
+// MIPS-ALIAS-32: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mips-linux-gnu -mips32r2 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R2 %s
+// MIPS-ALIAS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB"
+//
+// RUN: %clang -target mips-linux-gnu -mips64 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-64 %s
+// MIPS-ALIAS-64: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB"
+//
+// RUN: %clang -target mips-linux-gnu -mips64r2 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R2 %s
+// MIPS-ALIAS-64R2: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EB"
diff --git a/test/Driver/mips-features.c b/test/Driver/mips-features.c
index 5be268318886..28048e7740f2 100644
--- a/test/Driver/mips-features.c
+++ b/test/Driver/mips-features.c
@@ -37,3 +37,9 @@
// RUN: -mdspr2 -mno-dspr2 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NOMDSPR2 %s
// CHECK-NOMDSPR2: "-target-feature" "-dspr2"
+//
+// -G
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN: -G 16 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-MIPS-G %s
+// CHECK-MIPS-G: "-mllvm" "-mips-ssection-threshold=16"
diff --git a/test/Driver/mips-float.c b/test/Driver/mips-float.c
index 95eb0025cc09..886c3355a963 100644
--- a/test/Driver/mips-float.c
+++ b/test/Driver/mips-float.c
@@ -3,19 +3,19 @@
// when build for MIPS platforms.
//
// Default
-// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target mips-linux-gnu \
// RUN: | FileCheck --check-prefix=CHECK-DEF %s
// CHECK-DEF: "-mfloat-abi" "hard"
//
// -mhard-float
-// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target mips-linux-gnu -mhard-float \
// RUN: | FileCheck --check-prefix=CHECK-HARD %s
// CHECK-HARD: "-mfloat-abi" "hard"
//
// -msoft-float
-// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target mips-linux-gnu -msoft-float \
// RUN: | FileCheck --check-prefix=CHECK-SOFT %s
// CHECK-SOFT: "-msoft-float"
@@ -23,13 +23,13 @@
// CHECK-SOFT: "-target-feature" "+soft-float"
//
// -mfloat-abi=hard
-// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target mips-linux-gnu -mfloat-abi=hard \
// RUN: | FileCheck --check-prefix=CHECK-ABI-HARD %s
// CHECK-ABI-HARD: "-mfloat-abi" "hard"
//
// -mfloat-abi=soft
-// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target mips-linux-gnu -mfloat-abi=soft \
// RUN: | FileCheck --check-prefix=CHECK-ABI-SOFT %s
// CHECK-ABI-SOFT: "-msoft-float"
@@ -37,7 +37,7 @@
// CHECK-ABI-SOFT: "-target-feature" "+soft-float"
//
// -mfloat-abi=single
-// RUN: %clang -ccc-clang-archs mips -c %s -### -o %t.o 2>&1 \
+// RUN: %clang -c %s -### -o %t.o 2>&1 \
// RUN: -target mips-linux-gnu -mfloat-abi=single \
// RUN: | FileCheck --check-prefix=CHECK-ABI-SINGLE %s
// CHECK-ABI-SINGLE: "-target-feature" "+single-float"
diff --git a/test/Driver/no-objc-arr.m b/test/Driver/no-objc-arr.m
index e44939337a6a..21246a37a6af 100644
--- a/test/Driver/no-objc-arr.m
+++ b/test/Driver/no-objc-arr.m
@@ -1,4 +1,5 @@
// RUN: %clang -Werror -fobjc-arc -fsyntax-only -fno-objc-arc -Xclang -verify %s
+// expected-no-diagnostics
// rdar://8949617
void * FOO() {
diff --git a/test/Driver/objc++-cpp-output.mm b/test/Driver/objc++-cpp-output.mm
index bb8814428ac4..9c4d55379ad1 100644
--- a/test/Driver/objc++-cpp-output.mm
+++ b/test/Driver/objc++-cpp-output.mm
@@ -1,5 +1,8 @@
// RUN: %clang -x objc++-cpp-output -c %s -o /dev/null
+// PR13820
+// REQUIRES: LP64
+
// Should compile without errors
@protocol P
- (void)m;
diff --git a/test/Driver/objc-cpp-output.m b/test/Driver/objc-cpp-output.m
index 6d974838c150..8c174f773205 100644
--- a/test/Driver/objc-cpp-output.m
+++ b/test/Driver/objc-cpp-output.m
@@ -1,5 +1,8 @@
// RUN: %clang -x objc-cpp-output -c %s -o /dev/null
+// PR13820
+// REQUIRES: LP64
+
// Should compile without errors
@protocol P
- (void)m;
diff --git a/test/Driver/openbsd.c b/test/Driver/openbsd.c
index 911c452c6c18..afd8b5ade921 100644
--- a/test/Driver/openbsd.c
+++ b/test/Driver/openbsd.c
@@ -1,5 +1,9 @@
-// RUN: %clang -no-canonical-prefixes -ccc-clang-archs "" -target i686-pc-openbsd %s -### 2> %t.log
-// RUN: FileCheck -input-file %t.log %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-LD %s
+// CHECK-LD: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
+// CHECK-LD: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
-// CHECK: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
-// CHECK: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o"
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg -pthread %s -### 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-PG %s
+// CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd"
+// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lpthread_p" "-lc_p" "-lgcc" "{{.*}}crtend.o"
diff --git a/test/Driver/pic.c b/test/Driver/pic.c
index 3952f85ceb29..54e5982c085f 100644
--- a/test/Driver/pic.c
+++ b/test/Driver/pic.c
@@ -5,24 +5,35 @@
// CHECK-NO-PIC-NOT: "-pic-level"
// CHECK-NO-PIC-NOT: "-pie-level"
//
-// CHECK-DYNAMIC-NO-PIC1: "-mrelocation-model" "dynamic-no-pic"
-// CHECK-DYNAMIC-NO-PIC1: "-pic-level" "1"
-//
-// CHECK-DYNAMIC-NO-PIC2: "-mrelocation-model" "dynamic-no-pic"
-// CHECK-DYNAMIC-NO-PIC2: "-pic-level" "2"
-//
-// CHECK-PIC1-NOT: "-mrelocation-model"
+// CHECK-PIC1: "-mrelocation-model" "pic"
// CHECK-PIC1: "-pic-level" "1"
//
-// CHECK-PIC2-NOT: "-mrelocation-model"
+// CHECK-PIC2: "-mrelocation-model" "pic"
// CHECK-PIC2: "-pic-level" "2"
//
-// CHECK-PIE1-NOT: "-mrelocation-model"
+// CHECK-PIE1: "-mrelocation-model" "pic"
+// CHECK-PIE1: "-pic-level" "1"
// CHECK-PIE1: "-pie-level" "1"
//
-// CHECK-PIE2-NOT: "-mrelocation-model"
+// CHECK-PIE2: "-mrelocation-model" "pic"
+// CHECK-PIE2: "-pic-level" "2"
// CHECK-PIE2: "-pie-level" "2"
//
+// CHECK-PIE-LD: "{{.*}}ld{{(.exe)?}}"
+// CHECK-PIE-LD: "-pie"
+// CHECK-PIE-LD: "Scrt1.o" "crti.o" "crtbeginS.o"
+// CHECK-PIE-LD: "crtendS.o" "crtn.o"
+//
+// CHECK-DYNAMIC-NO-PIC-32: "-mrelocation-model" "dynamic-no-pic"
+// CHECK-DYNAMIC-NO-PIC-32-NOT: "-pic-level"
+// CHECK-DYNAMIC-NO-PIC-32-NOT: "-pie-level"
+//
+// CHECK-DYNAMIC-NO-PIC-64: "-mrelocation-model" "dynamic-no-pic"
+// CHECK-DYNAMIC-NO-PIC-64: "-pic-level" "2"
+// CHECK-DYNAMIC-NO-PIC-64-NOT: "-pie-level"
+//
+// CHECK-NON-DARWIN-DYNAMIC-NO-PIC: error: unsupported option '-mdynamic-no-pic' for target 'i386-unknown-unknown'
+//
// RUN: %clang -c %s -target i386-unknown-unknown -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
// RUN: %clang -c %s -target i386-unknown-unknown -fpic -### 2>&1 \
@@ -33,26 +44,62 @@
// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+//
+// Check that PIC and PIE flags obey last-match-wins. If the last flag is
+// a no-* variant, regardless of which variant or which flags precede it, we
+// get no PIC.
// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-pic -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
-// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-PIC -### 2>&1 \
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-pic -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-PIC -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
-// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-pic -### 2>&1 \
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-PIC -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
-// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-pie -### 2>&1 \
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-PIC -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
-// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-PIE -### 2>&1 \
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-PIC -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
-// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-PIE -### 2>&1 \
+// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-pie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-pie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-pie -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-pie -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
-// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-pic -### 2>&1 \
+// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-PIE -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
-// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fno-pie -### 2>&1 \
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fno-PIE -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fno-PIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fno-PIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+//
+// Last-match-wins where both pic and pie are specified.
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fpic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC1
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fpic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC1
+// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIE -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fpie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fpie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE1
+// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fPIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fPIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
+//
+// Last-match-wins when selecting level 1 vs. level 2.
// RUN: %clang -c %s -target i386-unknown-unknown -fpic -fPIC -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
// RUN: %clang -c %s -target i386-unknown-unknown -fPIC -fpic -### 2>&1 \
@@ -62,20 +109,81 @@
// RUN: %clang -c %s -target i386-unknown-unknown -fpie -fPIC -fPIE -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
//
-// Defaults change for Darwin.
+// Make sure -pie is passed to along to ld and that the right *crt* files
+// are linked in.
+// RUN: %clang %s -target i386-unknown-freebsd -fPIE -pie -### \
+// RUN: --sysroot=%S/Inputs/basic_freebsd_tree 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE-LD
+// RUN: %clang %s -target i386-linux-gnu -fPIE -pie -### \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE-LD
+// RUN: %clang %s -target i386-linux-gnu -fPIC -pie -### \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIE-LD
+//
+// Disregard any of the PIC-specific flags if we have a trump-card flag.
+// RUN: %clang -c %s -target i386-unknown-unknown -mkernel -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-unknown-unknown -static -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+//
+// Darwin is a beautiful and unique snowflake when it comes to these flags.
+// When targetting a 32-bit darwin system, the -fno-* flag variants work and
+// disable PIC, but any other flag enables PIC (*not* PIE) even if the flag
+// specifies PIE. On 64-bit targets, there is simply nothing you can do, there
+// is no PIE, there is only PIC when it comes to compilation.
// RUN: %clang -c %s -target i386-apple-darwin -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
-// RUN: %clang -c %s -target i386-apple-darwin -fno-pic -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-apple-darwin -fpic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target i386-apple-darwin -fPIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target i386-apple-darwin -fpie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target i386-apple-darwin -fPIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
// RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-apple-darwin -fno-PIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
+// RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -fpic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target i386-apple-darwin -fno-PIC -fPIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target x86_64-apple-darwin -fno-PIC -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target x86_64-apple-darwin -fno-PIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target x86_64-apple-darwin -fpic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target x86_64-apple-darwin -fPIE -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
//
-// Disregard any of the PIC-specific flags if we have a trump-card flag.
-// RUN: %clang -c %s -target i386-unknown-unknown -mkernel -fPIC -### 2>&1 \
+// Darwin gets even more special with '-mdynamic-no-pic'. This flag is only
+// valid on Darwin, and it's behavior is very strange but needs to remain
+// consistent for compatibility.
+// RUN: %clang -c %s -target i386-unknown-unknown -mdynamic-no-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-NON-DARWIN-DYNAMIC-NO-PIC
+// RUN: %clang -c %s -target i386-apple-darwin -mdynamic-no-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-32
+// RUN: %clang -c %s -target i386-apple-darwin -mdynamic-no-pic -fno-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-32
+// RUN: %clang -c %s -target i386-apple-darwin -mdynamic-no-pic -fpie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-32
+// RUN: %clang -c %s -target x86_64-apple-darwin -mdynamic-no-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-64
+// RUN: %clang -c %s -target x86_64-apple-darwin -mdynamic-no-pic -fno-pic -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-64
+// RUN: %clang -c %s -target x86_64-apple-darwin -mdynamic-no-pic -fpie -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC-64
+//
+// Checks for ARM+Apple+IOS including -fapple-kext, -mkernel, and iphoneos
+// version boundaries.
+// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target armv7-apple-ios -mkernel -miphoneos-version-min=6.0.0 -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=5.0.0 -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
-// RUN: %clang -c %s -target i386-unknown-unknown -static -fPIC -### 2>&1 \
+// RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -static -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
-// RUN: %clang -c %s -target i386-unknown-unknown -mdynamic-no-pic -fPIC -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC1
-// RUN: %clang -c %s -target i386-apple-darwin -mdynamic-no-pic -fPIC -### 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2
diff --git a/test/Driver/retain-comments-from-system-headers.c b/test/Driver/retain-comments-from-system-headers.c
new file mode 100644
index 000000000000..4d3e2ffe06f4
--- /dev/null
+++ b/test/Driver/retain-comments-from-system-headers.c
@@ -0,0 +1,9 @@
+// Check that we pass -fretain-comments-from-system-headers to frontend.
+//
+// RUN: %clang -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RETAIN
+// RUN: %clang -c %s -fretain-comments-from-system-headers -### 2>&1 | FileCheck %s --check-prefix=CHECK-RETAIN
+//
+// CHECK-RETAIN: -fretain-comments-from-system-headers
+//
+// CHECK-NO-RETAIN-NOT: -fretain-comments-from-system-headers
+
diff --git a/test/Driver/rewrite-legacy-objc.m b/test/Driver/rewrite-legacy-objc.m
index d243c7a15b39..2e3f4218ef2d 100644
--- a/test/Driver/rewrite-legacy-objc.m
+++ b/test/Driver/rewrite-legacy-objc.m
@@ -3,13 +3,5 @@
// TEST0: clang{{.*}}" "-cc1"
// TEST0: "-rewrite-objc"
// FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
-// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-fragile" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
+// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-fragile" "-fobjc-default-synthesize-properties" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
// TEST0: rewrite-legacy-objc.m"
-
-// RUN: not %clang -ccc-no-clang -target unknown -rewrite-legacy-objc %s -o - -### 2>&1 | \
-// RUN: FileCheck -check-prefix=TEST1 %s
-// TEST1: invalid output type 'rewritten-legacy-objc' for use with gcc
-
-// RUN: not %clang -ccc-no-clang -target i386-apple-darwin10 -rewrite-legacy-objc %s -o - -### 2>&1 | \
-// RUN: FileCheck -check-prefix=TEST2 %s
-// TEST2: invalid output type 'rewritten-legacy-objc' for use with gcc
diff --git a/test/Driver/rewrite-objc.m b/test/Driver/rewrite-objc.m
index 669679772203..fa159a625824 100644
--- a/test/Driver/rewrite-objc.m
+++ b/test/Driver/rewrite-objc.m
@@ -3,13 +3,4 @@
// TEST0: clang{{.*}}" "-cc1"
// TEST0: "-rewrite-objc"
// FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
-// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
-// TEST0: rewrite-objc.m"
-
-// RUN: not %clang -ccc-no-clang -target unknown -rewrite-objc %s -o - -### 2>&1 | \
-// RUN: FileCheck -check-prefix=TEST1 %s
-// TEST1: invalid output type 'rewritten-objc' for use with gcc
-
-// RUN: not %clang -ccc-no-clang -target i386-apple-darwin10 -rewrite-objc %s -o - -### 2>&1 | \
-// RUN: FileCheck -check-prefix=TEST2 %s
-// TEST2: invalid output type 'rewritten-objc' for use with gcc
+// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c
new file mode 100644
index 000000000000..5f3d679c1ade
--- /dev/null
+++ b/test/Driver/stack-protector.c
@@ -0,0 +1,11 @@
+// RUN: %clang -fno-stack-protector -### %s 2>&1 | FileCheck %s -check-prefix=NOSSP
+// NOSSP-NOT: "-stack-protector" "1"
+// NOSSP-NOT: "-stack-protector-buffer-size"
+
+// RUN: %clang -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP
+// SSP: "-stack-protector" "1"
+// SSP-NOT: "-stack-protector-buffer-size"
+
+// RUN: %clang -fstack-protector --param ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-BUF
+// SSP-BUF: "-stack-protector" "1"
+// SSP-BUF: "-stack-protector-buffer-size" "16"
diff --git a/test/Driver/std.cpp b/test/Driver/std.cpp
index 7704c8dda1ea..822658c837dc 100644
--- a/test/Driver/std.cpp
+++ b/test/Driver/std.cpp
@@ -5,6 +5,8 @@
// RUN: %clang -std=gnu++0x %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s
// RUN: %clang -std=c++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX11 %s
// RUN: %clang -std=gnu++11 %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX11 %s
+// RUN: %clang -std=c++1y %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CXX1Y %s
+// RUN: %clang -std=gnu++1y %s -fsyntax-only 2>&1 | FileCheck -check-prefix=GNUXX1Y %s
void f(int n) {
typeof(n)();
@@ -22,3 +24,9 @@ void f(int n) {
// GNUXX11-NOT: undeclared identifier 'typeof'
// GNUXX11-NOT: undeclared identifier 'decltype'
+
+// CXX1Y: undeclared identifier 'typeof'
+// CXX1Y-NOT: undeclared identifier 'decltype'
+
+// GNUXX1Y-NOT: undeclared identifier 'typeof'
+// GNUXX1Y-NOT: undeclared identifier 'decltype'
diff --git a/test/Driver/tsan.c b/test/Driver/tsan.c
index 1dadb8ea265b..18b027fbceec 100644
--- a/test/Driver/tsan.c
+++ b/test/Driver/tsan.c
@@ -1,8 +1,9 @@
-// RUN: %clang -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
-// RUN: %clang -O1 -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
-// RUN: %clang -O2 -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
-// RUN: %clang -O3 -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
-// Verify that -fthread-sanitizer invokes tsan instrumentation.
+// RUN: %clang -target i386-unknown-unknown -fsanitize=thread %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -O1 -target i386-unknown-unknown -fsanitize=thread %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -O2 -target i386-unknown-unknown -fsanitize=thread %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -O3 -target i386-unknown-unknown -fsanitize=thread %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang -target i386-unknown-unknown -fsanitize=thread %s -S -emit-llvm -o - | FileCheck %s
+// Verify that -fsanitize=thread invokes tsan instrumentation.
int foo(int *a) { return *a; }
// CHECK: __tsan_init
diff --git a/test/Driver/ubsan-ld.c b/test/Driver/ubsan-ld.c
new file mode 100644
index 000000000000..775e6699443f
--- /dev/null
+++ b/test/Driver/ubsan-ld.c
@@ -0,0 +1,10 @@
+// Test UndefinedBehaviorSanitizer ld flags.
+
+// RUN: %clang -fcatch-undefined-behavior %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LINUX %s
+// CHECK-LINUX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LINUX-NOT: "-lc"
+// CHECK-LINUX: libclang_rt.ubsan-i386.a"
+// CHECK-LINUX: "-lpthread"
diff --git a/test/Driver/warning-options.cpp b/test/Driver/warning-options.cpp
index ab0da42e4bfc..cce88e65c259 100644
--- a/test/Driver/warning-options.cpp
+++ b/test/Driver/warning-options.cpp
@@ -8,3 +8,8 @@
// CHECK: unknown warning option '-Wmonkey'
// CHECK: unknown warning option '-Wno-monkey'
// CHECK: unknown warning option '-Wno-unused-command-line-arguments'; did you mean '-Wno-unused-command-line-argument'?
+
+// FIXME: Remove this together with -Warc-abi once an Xcode is released that doesn't pass this flag.
+// RUN: %clang -### -Warc-abi -Wno-arc-abi %s 2>&1 | FileCheck -check-prefix=ARCABI %s
+// ARCABI-NOT: unknown warning option '-Warc-abi'
+// ARCABI-NOT: unknown warning option '-Wno-arc-abi'
diff --git a/test/Driver/working-directory-and-abs.c b/test/Driver/working-directory-and-abs.c
new file mode 100644
index 000000000000..6738c776d40c
--- /dev/null
+++ b/test/Driver/working-directory-and-abs.c
@@ -0,0 +1 @@
+// RUN: %clang -working-directory=%S %S/working-directory-and-abs.c -fsyntax-only
diff --git a/test/Driver/x86_64-nacl-defines.cpp b/test/Driver/x86_64-nacl-defines.cpp
new file mode 100644
index 000000000000..caa9a74d2db6
--- /dev/null
+++ b/test/Driver/x86_64-nacl-defines.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang -target x86_64-unknown-nacl -ccc-echo %s -emit-llvm-only -c 2>&1 | FileCheck %s -check-prefix=ECHO
+// RUN: %clang -target x86_64-unknown-nacl %s -emit-llvm -S -c -o - | FileCheck %s
+// RUN: %clang -target x86_64-unknown-nacl %s -emit-llvm -S -c -pthread -o - | FileCheck %s -check-prefix=THREADS
+
+// ECHO: {{.*}} -cc1 {{.*}}x86_64-nacl-defines.c
+
+// Check platform defines
+
+// CHECK: __LITTLE_ENDIAN__defined
+#ifdef __LITTLE_ENDIAN__
+void __LITTLE_ENDIAN__defined() {}
+#endif
+
+// CHECK: __native_client__defined
+#ifdef __native_client__
+void __native_client__defined() {}
+#endif
+
+// CHECK: __x86_64__defined
+#ifdef __x86_64__
+void __x86_64__defined() {}
+#endif
+
+// CHECK: unixdefined
+#ifdef unix
+void unixdefined() {}
+#endif
+
+// CHECK: __ELF__defined
+#ifdef __ELF__
+void __ELF__defined() {}
+#endif
+
+// CHECK: _GNU_SOURCEdefined
+#ifdef _GNU_SOURCE
+void _GNU_SOURCEdefined() {}
+#endif
+
+// THREADS: _REENTRANTdefined
+// CHECK: _REENTRANTundefined
+#ifdef _REENTRANT
+void _REENTRANTdefined() {}
+#else
+void _REENTRANTundefined() {}
+#endif
diff --git a/test/Driver/x86_64-nacl-types.cpp b/test/Driver/x86_64-nacl-types.cpp
new file mode 100644
index 000000000000..a994cb75ef66
--- /dev/null
+++ b/test/Driver/x86_64-nacl-types.cpp
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-nacl -std=c++11 -verify %s
+// expected-no-diagnostics
+
+#include <stddef.h>
+#include <stdarg.h>
+
+static_assert(alignof(char) == 1, "alignof char is wrong");
+
+static_assert(alignof(short) == 2, "sizeof short is wrong");
+static_assert(alignof(short) == 2, "alignof short is wrong");
+
+static_assert(alignof(int) == 4, "sizeof int is wrong");
+static_assert(alignof(int) == 4, "alignof int is wrong");
+
+static_assert(sizeof(long) == 4, "sizeof long is wrong");
+static_assert(sizeof(long) == 4, "alignof long is wrong");
+
+static_assert(sizeof(long long) == 8, "sizeof long long is wrong wrong");
+static_assert(alignof(long long) == 8, "alignof long long is wrong wrong");
+
+static_assert(sizeof(void*) == 4, "sizeof void * is wrong");
+static_assert(alignof(void*) == 4, "alignof void * is wrong");
+
+static_assert(sizeof(float) == 4, "sizeof float is wrong");
+static_assert(alignof(float) == 4, "alignof float is wrong");
+
+static_assert(sizeof(double) == 8, "sizeof double is wrong");
+static_assert(alignof(double) == 8, "alignof double is wrong");
+
+static_assert(sizeof(long double) == 8, "sizeof long double is wrong");
+static_assert(alignof(long double) == 8, "alignof long double is wrong");
+
+static_assert(sizeof(va_list) == 16, "sizeof va_list is wrong");
+static_assert(alignof(va_list) == 4, "alignof va_list is wrong");
+
+static_assert(sizeof(size_t) == 4, "sizeof size_t is wrong");
+static_assert(alignof(size_t) == 4, "alignof size_t is wrong");