diff options
Diffstat (limited to 'test/Driver')
172 files changed, 2926 insertions, 1412 deletions
diff --git a/test/Driver/Inputs/CUDA/usr/local/cuda/include/.keep b/test/Driver/Inputs/CUDA/usr/local/cuda/include/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/CUDA/usr/local/cuda/include/.keep diff --git a/test/Driver/Inputs/CUDA/usr/local/cuda/lib/.keep b/test/Driver/Inputs/CUDA/usr/local/cuda/lib/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/CUDA/usr/local/cuda/lib/.keep diff --git a/test/Driver/Inputs/CUDA/usr/local/cuda/lib64/.keep b/test/Driver/Inputs/CUDA/usr/local/cuda/lib64/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/CUDA/usr/local/cuda/lib64/.keep diff --git a/test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_20.10.bc b/test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_20.10.bc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_20.10.bc diff --git a/test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_35.10.bc b/test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_35.10.bc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/CUDA/usr/local/cuda/nvvm/libdevice/libdevice.compute_35.10.bc diff --git a/test/Driver/Inputs/Windows/ARM/8.1/usr/bin/ld.lld-link2 b/test/Driver/Inputs/Windows/ARM/8.1/usr/bin/ld.lld-link2 new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/Windows/ARM/8.1/usr/bin/ld.lld-link2 diff --git a/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/bin/.keep b/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/bin/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/bin/.keep diff --git a/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/include/c++/v1/.keep b/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/include/c++/v1/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/include/c++/v1/.keep diff --git a/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/include/c++/v2/.keep b/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/include/c++/v2/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/include/c++/v2/.keep diff --git a/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/lib/.keep b/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/lib/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_libcxxv2_tree/usr/lib/.keep diff --git a/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/bin/.keep b/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/bin/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/bin/.keep diff --git a/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/c++/4.8/backward/.keep b/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/c++/4.8/backward/.keep new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/c++/4.8/backward/.keep diff --git a/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/c++/v1/.keep b/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/c++/v1/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/c++/v1/.keep diff --git a/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/c++/v2/.keep b/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/c++/v2/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/include/c++/v2/.keep diff --git a/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/lib/.keep b/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/lib/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_linux_libstdcxx_libcxxv2_tree/usr/lib/.keep diff --git a/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtbegin.o b/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtbegin.o diff --git a/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtend.o b/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtend.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtend.o diff --git a/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crti.o b/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crti.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crti.o diff --git a/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtn.o b/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtn.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/crtn.o diff --git a/test/Driver/Inputs/basic_myriad_tree/sparc-myriad-elf/include/c++/4.8.2/.keep b/test/Driver/Inputs/basic_myriad_tree/sparc-myriad-elf/include/c++/4.8.2/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_myriad_tree/sparc-myriad-elf/include/c++/4.8.2/.keep diff --git a/test/Driver/Inputs/basic_myriad_tree/sparc-myriad-elf/lib/crt0.o b/test/Driver/Inputs/basic_myriad_tree/sparc-myriad-elf/lib/crt0.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_myriad_tree/sparc-myriad-elf/lib/crt0.o diff --git a/test/Driver/Inputs/hexagon_tree/gnu/bin/hexagon-as b/test/Driver/Inputs/hexagon_tree/gnu/bin/hexagon-as deleted file mode 100755 index 331ef4a..0000000 --- a/test/Driver/Inputs/hexagon_tree/gnu/bin/hexagon-as +++ /dev/null @@ -1 +0,0 @@ -# placeholder for testing purposes
\ No newline at end of file diff --git a/test/Driver/Inputs/hexagon_tree/gnu/bin/hexagon-gcc b/test/Driver/Inputs/hexagon_tree/gnu/bin/hexagon-gcc deleted file mode 100755 index 331ef4a..0000000 --- a/test/Driver/Inputs/hexagon_tree/gnu/bin/hexagon-gcc +++ /dev/null @@ -1 +0,0 @@ -# placeholder for testing purposes
\ No newline at end of file diff --git a/test/Driver/Inputs/hexagon_tree/gnu/bin/hexagon-ld b/test/Driver/Inputs/hexagon_tree/gnu/bin/hexagon-ld deleted file mode 100755 index 331ef4a..0000000 --- a/test/Driver/Inputs/hexagon_tree/gnu/bin/hexagon-ld +++ /dev/null @@ -1 +0,0 @@ -# placeholder for testing purposes
\ No newline at end of file diff --git a/test/Driver/Inputs/hexagon_tree/gnu/hexagon/include/c++/4.4.0/ios b/test/Driver/Inputs/hexagon_tree/gnu/hexagon/include/c++/4.4.0/ios deleted file mode 100644 index 777a4ec..0000000 --- a/test/Driver/Inputs/hexagon_tree/gnu/hexagon/include/c++/4.4.0/ios +++ /dev/null @@ -1 +0,0 @@ -// placeholder for testing purposes diff --git a/test/Driver/Inputs/hexagon_tree/gnu/hexagon/include/stdio.h b/test/Driver/Inputs/hexagon_tree/gnu/hexagon/include/stdio.h deleted file mode 100644 index 777a4ec..0000000 --- a/test/Driver/Inputs/hexagon_tree/gnu/hexagon/include/stdio.h +++ /dev/null @@ -1 +0,0 @@ -// placeholder for testing purposes diff --git a/test/Driver/Inputs/hexagon_tree/gnu/lib/gcc/hexagon/4.4.0/include-fixed/limits.h b/test/Driver/Inputs/hexagon_tree/gnu/lib/gcc/hexagon/4.4.0/include-fixed/limits.h deleted file mode 100644 index 777a4ec..0000000 --- a/test/Driver/Inputs/hexagon_tree/gnu/lib/gcc/hexagon/4.4.0/include-fixed/limits.h +++ /dev/null @@ -1 +0,0 @@ -// placeholder for testing purposes diff --git a/test/Driver/Inputs/hexagon_tree/gnu/lib/gcc/hexagon/4.4.0/include/stddef.h b/test/Driver/Inputs/hexagon_tree/gnu/lib/gcc/hexagon/4.4.0/include/stddef.h deleted file mode 100644 index 777a4ec..0000000 --- a/test/Driver/Inputs/hexagon_tree/gnu/lib/gcc/hexagon/4.4.0/include/stddef.h +++ /dev/null @@ -1 +0,0 @@ -// placeholder for testing purposes diff --git a/test/Driver/Inputs/hexagon_tree/qc/bin/placeholder b/test/Driver/Inputs/hexagon_tree/qc/bin/placeholder deleted file mode 100644 index 777a4ec..0000000 --- a/test/Driver/Inputs/hexagon_tree/qc/bin/placeholder +++ /dev/null @@ -1 +0,0 @@ -// placeholder for testing purposes diff --git a/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a b/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a diff --git a/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so b/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so diff --git a/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a b/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a diff --git a/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so b/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so diff --git a/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o b/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o diff --git a/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o b/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o diff --git a/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o b/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o diff --git a/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o b/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o diff --git a/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o b/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o diff --git a/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o b/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o diff --git a/test/Driver/Inputs/multilib_arm_linux_tree/usr/include/arm-linux-gnueabi/.keep b/test/Driver/Inputs/multilib_arm_linux_tree/usr/include/arm-linux-gnueabi/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/multilib_arm_linux_tree/usr/include/arm-linux-gnueabi/.keep diff --git a/test/Driver/Inputs/multilib_armeb_linux_tree/usr/include/armeb-linux-gnueabi/.keep b/test/Driver/Inputs/multilib_armeb_linux_tree/usr/include/armeb-linux-gnueabi/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/multilib_armeb_linux_tree/usr/include/armeb-linux-gnueabi/.keep diff --git a/test/Driver/Inputs/multilib_armebhf_linux_tree/usr/include/armeb-linux-gnueabihf/.keep b/test/Driver/Inputs/multilib_armebhf_linux_tree/usr/include/armeb-linux-gnueabihf/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/multilib_armebhf_linux_tree/usr/include/armeb-linux-gnueabihf/.keep diff --git a/test/Driver/Inputs/multilib_armhf_linux_tree/usr/include/arm-linux-gnueabihf/.keep b/test/Driver/Inputs/multilib_armhf_linux_tree/usr/include/arm-linux-gnueabihf/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/multilib_armhf_linux_tree/usr/include/arm-linux-gnueabihf/.keep diff --git a/test/Driver/Inputs/resource_dir/asan_blacklist.txt b/test/Driver/Inputs/resource_dir/asan_blacklist.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/resource_dir/asan_blacklist.txt diff --git a/test/Driver/Inputs/scei-ps4_tree/target/include/.keep b/test/Driver/Inputs/scei-ps4_tree/target/include/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/scei-ps4_tree/target/include/.keep diff --git a/test/Driver/Inputs/scei-ps4_tree/target/include_common/.keep b/test/Driver/Inputs/scei-ps4_tree/target/include_common/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/scei-ps4_tree/target/include_common/.keep diff --git a/test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crt1.o b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crt1.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crt1.o diff --git a/test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtbegin.o b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtbegin.o diff --git a/test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtend.o b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtend.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtend.o diff --git a/test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/crti.o b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/crti.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/crti.o diff --git a/test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/crtn.o b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/crtn.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/crtn.o diff --git a/test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/ld.so.1 b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/ld.so.1 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/ld.so.1 diff --git a/test/Driver/Xlinker-args.c b/test/Driver/Xlinker-args.c index 87b238b..a828f15 100644 --- a/test/Driver/Xlinker-args.c +++ b/test/Driver/Xlinker-args.c @@ -3,17 +3,17 @@ // RUN: %clang -target i386-apple-darwin9 -### \ // RUN: -Xlinker one -Xlinker --no-demangle \ -// RUN: -Wl,two,--no-demangle,three -Xlinker four -z five %s 2> %t +// RUN: -Wl,two,--no-demangle,three -Xlinker four -z five -r %s 2> %t // RUN: FileCheck -check-prefix=DARWIN < %t %s // // RUN: %clang -target x86_64-pc-linux-gnu -### \ // RUN: -Xlinker one -Xlinker --no-demangle \ -// RUN: -Wl,two,--no-demangle,three -Xlinker four -z five %s 2> %t +// RUN: -Wl,two,--no-demangle,three -Xlinker four -z five -r %s 2> %t // RUN: FileCheck -check-prefix=LINUX < %t %s // // DARWIN-NOT: --no-demangle -// DARWIN: "one" "two" "three" "four" "-z" "five" -// LINUX: "--no-demangle" "one" "two" "three" "four" "-z" "five" +// DARWIN: "one" "two" "three" "four" "-z" "five" "-r" +// LINUX: "--no-demangle" "one" "two" "three" "four" "-z" "five" "-r" // Check that we forward '-Xlinker' and '-Wl,' on Windows. // RUN: %clang -target i686-pc-win32 -### \ diff --git a/test/Driver/aarch64-cpus.c b/test/Driver/aarch64-cpus.c index 4d4e1bc..6355c24 100644 --- a/test/Driver/aarch64-cpus.c +++ b/test/Driver/aarch64-cpus.c @@ -1,18 +1,38 @@ // Check target CPUs are correctly passed. // RUN: %clang -target aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s +// RUN: %clang -target aarch64 -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s // RUN: %clang -target aarch64 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s +// RUN: %clang -target aarch64 -mlittle-endian -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s // RUN: %clang -target aarch64_be -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s +// RUN: %clang -target aarch64_be -mlittle-endian -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s // GENERIC: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" // RUN: %clang -target arm64 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s +// RUN: %clang -target arm64 -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s // RUN: %clang -target arm64 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s +// RUN: %clang -target arm64 -mlittle-endian -mcpu-generic -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s // ARM64-GENERIC: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic" // RUN: %clang -target arm64-apple-darwin -arch arm64 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-DARWIN %s // ARM64-DARWIN: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cyclone" +// RUN: %clang -target aarch64 -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// RUN: %clang -target aarch64 -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s +// CA35: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a35" + +// RUN: %clang -target arm64 -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s +// RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s +// RUN: %clang -target arm64 -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s +// RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s +// ARM64-CA35: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a35" + + // RUN: %clang -target aarch64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s @@ -59,6 +79,14 @@ // RUN: %clang -target aarch64_be -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s // GENERIC-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" +// RUN: %clang -target aarch64_be -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s +// RUN: %clang -target aarch64 -mbig-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s +// RUN: %clang -target aarch64_be -mbig-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s +// RUN: %clang -target aarch64_be -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s +// RUN: %clang -target aarch64 -mbig-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s +// RUN: %clang -target aarch64_be -mbig-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s +// CA35-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a35" + // RUN: %clang -target aarch64_be -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s @@ -109,6 +137,24 @@ // RUN: %clang -target aarch64 -mbig-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s + +// RUN: %clang -target aarch64 -march=armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s +// RUN: %clang -target aarch64 -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s +// RUN: %clang -target aarch64 -mlittle-endian -march=armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s +// RUN: %clang -target aarch64 -mlittle-endian -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s +// RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s +// RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s +// GENERICV82A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" + +// RUN: %clang -target aarch64 -march=armv8.2-a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-FP16 %s +// GENERICV82A-FP16: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" "-target-feature" "+fullfp16" + +// RUN: %clang -target aarch64 -march=armv8.2-a+profile -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-SPE %s +// GENERICV82A-SPE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" "-target-feature" "+spe" +// +// RUN: %clang -target aarch64 -march=armv8.2-a+fp16+profile -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-FP16-SPE %s +// GENERICV82A-FP16-SPE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" "-target-feature" "+fullfp16" "-target-feature" "+spe" + // ================== Check whether -march accepts mixed-case values. // RUN: %clang -target aarch64_be -march=ARMV8.1A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -march=ARMV8.1-A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s @@ -118,15 +164,19 @@ // RUN: %clang -target aarch64_be -mbig-endian -march=ARMV8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // GENERICV81A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.1a" -// ================== Check whether -mcpu accepts mixed-case values. +// ================== Check whether -mcpu and -mtune accept mixed-case values. // RUN: %clang -target aarch64 -mcpu=Cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-CA53 %s +// RUN: %clang -target aarch64 -mtune=Cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-CA53 %s // CASE-INSENSITIVE-CA53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a53" // RUN: %clang -target arm64 -mcpu=cortex-A53 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-ARM64-CA53 %s +// RUN: %clang -target arm64 -mtune=cortex-A53 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-ARM64-CA53 %s // CASE-INSENSITIVE-ARM64-CA53: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a53" // RUN: %clang -target aarch64 -mcpu=CORTEX-A57 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-CA57 %s +// RUN: %clang -target aarch64 -mtune=CORTEX-A57 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-CA57 %s // CASE-INSENSITIVE-CA57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a57" // RUN: %clang -target arm64 -mcpu=Cortex-A57 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-ARM64-CA57 %s +// RUN: %clang -target arm64 -mtune=Cortex-A57 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-ARM64-CA57 %s // CASE-INSENSITIVE-ARM64-CA57: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a57" diff --git a/test/Driver/aarch64-fixed-x18.c b/test/Driver/aarch64-fixed-x18.c index 35d0caf..631865f 100644 --- a/test/Driver/aarch64-fixed-x18.c +++ b/test/Driver/aarch64-fixed-x18.c @@ -1,4 +1,4 @@ // RUN: %clang -target aarch64-none-gnu -ffixed-x18 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s -// CHECK-FIXED-X18: "-backend-option" "-aarch64-reserve-x18" +// CHECK-FIXED-X18: "-target-feature" "+reserve-x18" diff --git a/test/Driver/amdgpu-toolchain.c b/test/Driver/amdgpu-toolchain.c new file mode 100644 index 0000000..41cef7f --- /dev/null +++ b/test/Driver/amdgpu-toolchain.c @@ -0,0 +1,3 @@ +// RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s +// AS_LINK: clang{{.*}} "-cc1as" +// AS_LINK: lld{{.*}} "-flavor" "old-gnu" "-target" "amdgcn--amdhsa" diff --git a/test/Driver/apple-kext-mkernel.c b/test/Driver/apple-kext-mkernel.c index 5f4f522..db3fbb3 100644 --- a/test/Driver/apple-kext-mkernel.c +++ b/test/Driver/apple-kext-mkernel.c @@ -1,19 +1,24 @@ -// RUN: %clang -target x86_64-apple-darwin10 \ -// RUN: -mkernel -### -fsyntax-only %s 2> %t -// RUN: FileCheck --check-prefix=CHECK-X86 < %t %s +// RUN: %clang -target x86_64-apple-darwin10 -mkernel -### -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-X86 %s +// RUN: %clang -target x86_64-apple-darwin10 -mkernel -### -fsyntax-only -fbuiltin -fno-builtin -fcommon -fno-common %s 2>&1 | FileCheck --check-prefix=CHECK-X86 %s // CHECK-X86: "-disable-red-zone" // CHECK-X86: "-fno-builtin" // CHECK-X86: "-fno-rtti" // CHECK-X86: "-fno-common" -// RUN: %clang -target x86_64-apple-darwin10 \ -// RUN: -arch armv7 -mkernel -mstrict-align -### -fsyntax-only %s 2> %t -// RUN: FileCheck --check-prefix=CHECK-ARM < %t %s +// RUN: %clang -target x86_64-apple-darwin10 -mkernel -### -fsyntax-only -fbuiltin -fcommon %s 2>&1 | FileCheck --check-prefix=CHECK-X86-2 %s + +// CHECK-X86-2: "-disable-red-zone" +// CHECK-X86-2-NOT: "-fno-builtin" +// CHECK-X86-2: "-fno-rtti" +// CHECK-X86-2-NOT: "-fno-common" + +// RUN: %clang -target x86_64-apple-darwin10 -arch armv7 -mkernel -mstrict-align -### -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-ARM %s +// RUN: %clang -target x86_64-apple-darwin10 -arch armv7 -mkernel -mstrict-align -### -fsyntax-only -fbuiltin -fno-builtin -fcommon -fno-common %s 2>&1 | FileCheck --check-prefix=CHECK-ARM %s // CHECK-ARM: "-target-feature" "+long-calls" -// CHECK-ARM: "-backend-option" "-arm-strict-align" -// CHECK-ARM-NOT: "-backend-option" "-arm-strict-align" +// CHECK-ARM: "-target-feature" "+strict-align" +// CHECK-ARM-NOT: "-target-feature" "+strict-align" // CHECK-ARM: "-fno-builtin" // CHECK-ARM: "-fno-rtti" // CHECK-ARM: "-fno-common" @@ -21,3 +26,7 @@ // RUN: %clang -target x86_64-apple-darwin10 \ // RUN: -Werror -fno-builtin -fno-exceptions -fno-common -fno-rtti \ // RUN: -mkernel -fsyntax-only %s + +// RUN: %clang -c %s -target armv7k-apple-watchos -fapple-kext -mwatchos-version-min=1.0.0 -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-WATCH +// CHECK-WATCH-NOT: "-backend-option" "-arm-long-calls" diff --git a/test/Driver/appletvos-version-min.c b/test/Driver/appletvos-version-min.c new file mode 100644 index 0000000..9ff8297 --- /dev/null +++ b/test/Driver/appletvos-version-min.c @@ -0,0 +1,7 @@ +// REQUIRES: x86-registered-target +// REQUIRES: aarch64-registered-target +// RUN: %clang -target i386-apple-darwin10 -mappletvsimulator-version-min=9.0 -arch x86_64 -S -o - %s | FileCheck %s +// RUN: %clang -target armv7s-apple-darwin10 -mappletvos-version-min=9.0 -arch arm64 -S -o - %s | FileCheck %s + +int main() { return 0; } +// CHECK: .tvos_version_min 9, 0 diff --git a/test/Driver/arch-armv7k.c b/test/Driver/arch-armv7k.c new file mode 100644 index 0000000..f5c33cf --- /dev/null +++ b/test/Driver/arch-armv7k.c @@ -0,0 +1,13 @@ +// Tests that make sure armv7k is mapped to the correct CPU and ABI choices + +// RUN: %clang -target x86_64-apple-macosx10.9 -arch armv7k -c %s -### 2>&1 | FileCheck %s +// CHECK: "-cc1"{{.*}} "-target-cpu" "cortex-a7" +// CHECK-NOT: "-fsjlj-exceptions" + +// "thumbv7k-apple-ios" is a bit of a weird triple, but since the backend is +// going to choose to use sjlj-based exceptions for it, the front-end needs to +// match. + +// RUN: %clang -target x86_64-apple-macosx10.9 -arch armv7k -miphoneos-version-min=9.0 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SJLJ +// CHECK-SJLJ: "-cc1"{{.*}} "-target-cpu" "cortex-a7" +// CHECK-SJLJ: "-fsjlj-exceptions" diff --git a/test/Driver/arm-alignment.c b/test/Driver/arm-alignment.c index 3fe5951..3e21652 100644 --- a/test/Driver/arm-alignment.c +++ b/test/Driver/arm-alignment.c @@ -7,6 +7,18 @@ // RUN: %clang -target arm-none-gnueabi -mno-unaligned-access -munaligned-access -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s +// RUN: %clang -target armv6-apple-darwin -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s + +// RUN: %clang -target armv6-netbsd-eabi -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s + +// RUN: %clang -target armv7-unknown-linux -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s + +// RUN: %clang -target armv7-unknown-nacl-gnueabihf -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s + // RUN: %clang -target aarch64-none-gnueabi -munaligned-access -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s @@ -16,8 +28,8 @@ // RUN: %clang -target aarch64-none-gnueabi -mno-unaligned-access -munaligned-access -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s -// CHECK-UNALIGNED-ARM: "-backend-option" "-arm-no-strict-align" -// CHECK-UNALIGNED-AARCH64: "-backend-option" "-aarch64-no-strict-align" +// CHECK-UNALIGNED-ARM-NOT: "-target-feature" "+strict-align" +// CHECK-UNALIGNED-AARCH64-NOT: "-target-feature" "+strict-align" // RUN: %clang -target arm-none-gnueabi -mno-unaligned-access -### %s 2> %t @@ -32,6 +44,27 @@ // RUN: %clang -target arm-none-gnueabi -munaligned-access -mstrict-align -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s +// RUN: %clang -target arm-none-gnueabi -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s + +// RUN: %clang -target armv5-apple-darwin -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s + +// RUN: %clang -target armv5t-netbsd-eabi -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s + +// RUN: %clang -target armv6-unknown-linux -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s + +// RUN: %clang -target armv6-unknown-nacl-gnueabihf -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s + +// RUN: %clang -target armv6m-apple-darwin -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s + +// RUN: %clang -target armv6m-netbsd-eabi -### %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s + // RUN: %clang -target aarch64-none-gnueabi -mno-unaligned-access -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s @@ -47,8 +80,8 @@ // RUN: %clang -target aarch64-none-gnueabi -mkernel -mno-unaligned-access -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s -// CHECK-ALIGNED-ARM: "-backend-option" "-arm-strict-align" -// CHECK-ALIGNED-AARCH64: "-backend-option" "-aarch64-strict-align" +// CHECK-ALIGNED-ARM: "-target-feature" "+strict-align" +// CHECK-ALIGNED-AARCH64: "-target-feature" "+strict-align" // Make sure that v6M cores always trigger the unsupported aligned accesses error // for all supported architecture triples. diff --git a/test/Driver/arm-compiler-rt.c b/test/Driver/arm-compiler-rt.c new file mode 100644 index 0000000..a7e947c --- /dev/null +++ b/test/Driver/arm-compiler-rt.c @@ -0,0 +1,21 @@ +// RUN: %clang -target arm-linux-gnueabi -rtlib=compiler-rt -### %s 2>&1 | FileCheck %s -check-prefix ARM-GNUEABI +// ARM-GNUEABI: "{{.*[/\\]}}libclang_rt.builtins-arm.a" + +// RUN: %clang -target arm-linux-gnueabi -rtlib=compiler-rt -mfloat-abi=hard -### %s 2>&1 | FileCheck %s -check-prefix ARM-GNUEABI-ABI +// ARM-GNUEABI-ABI: "{{.*[/\\]}}libclang_rt.builtins-armhf.a" + +// RUN: %clang -target arm-linux-gnueabihf -rtlib=compiler-rt -### %s 2>&1 | FileCheck %s -check-prefix ARM-GNUEABIHF +// ARM-GNUEABIHF: "{{.*[/\\]}}libclang_rt.builtins-armhf.a" + +// RUN: %clang -target arm-linux-gnueabihf -rtlib=compiler-rt -mfloat-abi=soft -### %s 2>&1 | FileCheck %s -check-prefix ARM-GNUEABIHF-ABI +// ARM-GNUEABIHF-ABI: "{{.*[/\\]}}libclang_rt.builtins-arm.a" + +// RUN: %clang -target arm-windows-itanium -rtlib=compiler-rt -### %s 2>&1 | FileCheck %s -check-prefix ARM-WINDOWS +// ARM-WINDOWS: "{{.*[/\\]}}clang_rt.builtins-arm.lib" + +// RUN: %clang -target arm-linux-androideabi -rtlib=compiler-rt -### %s 2>&1 | FileCheck %s -check-prefix ARM-ANDROID +// ARM-ANDROID: "{{.*[/\\]}}libclang_rt.builtins-arm-android.a" + +// RUN: %clang -target arm-linux-androideabi -rtlib=compiler-rt -mfloat-abi=hard -### %s 2>&1 | FileCheck %s -check-prefix ARM-ANDROIDHF +// ARM-ANDROIDHF: "{{.*[/\\]}}libclang_rt.builtins-armhf-android.a" + diff --git a/test/Driver/arm-cortex-cpus.c b/test/Driver/arm-cortex-cpus.c index ef3056d..c0492ef 100644 --- a/test/Driver/arm-cortex-cpus.c +++ b/test/Driver/arm-cortex-cpus.c @@ -1,4 +1,16 @@ // ================== Check default CPU on each major architecture +// RUN: %clang -target arm -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-GENERIC %s +// CHECK-GENERIC: "-cc1"{{.*}} "-triple" "armv4t-{{.*}} "-target-cpu" "generic" + +// RUN: %clang -target armeb -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-GENERIC %s +// CHECK-BE-GENERIC: "-cc1"{{.*}} "-triple" "armebv4t-{{.*}} "-target-cpu" "generic" + +// RUN: %clang -target arm -mthumb -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-GENERIC-THUMB %s +// CHECK-GENERIC-THUMB: "-cc1"{{.*}} "-triple" "thumbv4t-{{.*}} "-target-cpu" "generic" + +// RUN: %clang -target armeb -mthumb -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-GENERIC-THUMB %s +// CHECK-BE-GENERIC-THUMB: "-cc1"{{.*}} "-triple" "thumbebv4t-{{.*}} "-target-cpu" "generic" + // RUN: %clang -target armv4t -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V4T %s // RUN: %clang -target arm -march=armv4t -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V4T %s // CHECK-V4T: "-cc1"{{.*}} "-triple" "armv4t-{{.*}} "-target-cpu" "arm7tdmi" @@ -45,11 +57,11 @@ // FIXME %clang -target armv6j -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6J %s // RUN: %clang -target arm -march=armv6j -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6J %s -// CHECK-V6J: "-cc1"{{.*}} "-triple" "armv6-{{.*}} "-target-cpu" "arm1136j-s" +// CHECK-V6J: "-cc1"{{.*}} "-triple" "armv6-{{.*}} "-target-cpu" "arm1136jf-s" // FIXME %clang -target armv6j -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6J-THUMB %s // RUN: %clang -target arm -march=armv6j -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6J-THUMB %s -// CHECK-V6J-THUMB: "-cc1"{{.*}} "-triple" "thumbv6-{{.*}} "-target-cpu" "arm1136j-s" +// CHECK-V6J-THUMB: "-cc1"{{.*}} "-triple" "thumbv6-{{.*}} "-target-cpu" "arm1136jf-s" // FIXME %clang -target armv6z -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6Z %s // FIXME %clang -target arm -march=armv6z -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6Z %s @@ -61,11 +73,11 @@ // RUN: %clang -target armv6k -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K %s // RUN: %clang -target arm -march=armv6k -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K %s -// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176jzf-s" +// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176j-s" // RUN: %clang -target armv6k -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K-THUMB %s // RUN: %clang -target arm -march=armv6k -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K-THUMB %s -// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" "arm1176jzf-s" +// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" "arm1176j-s" // RUN: %clang -target armv6t2 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6T2 %s // RUN: %clang -target arm -march=armv6t2 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6T2 %s @@ -134,6 +146,18 @@ // RUN: %clang -target arm -mlittle-endian -march=armv8-a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A %s // CHECK-V8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}}" "-target-cpu" "cortex-a53" +// RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s +// RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s +// RUN: %clang -mcpu=generic -target armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s +// RUN: %clang -mcpu=generic -target arm -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s +// RUN: %clang -mcpu=generic -target arm -march=armv8-a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s +// RUN: %clang -mcpu=generic -target armv8 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s +// RUN: %clang -mcpu=generic -target arm -march=armv8 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s +// RUN: %clang -mcpu=generic -target armv8a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s +// RUN: %clang -mcpu=generic -target arm -march=armv8a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s +// RUN: %clang -mcpu=generic -target arm -mlittle-endian -march=armv8-a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s +// CHECK-V8A-GENERIC: "-cc1"{{.*}} "-triple" "armv8-{{.*}}" "-target-cpu" "generic" + // RUN: %clang -target armebv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A %s // RUN: %clang -target armeb -march=armebv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A %s // RUN: %clang -target armebv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A %s @@ -173,6 +197,13 @@ // RUN: %clang -target armv8.1a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s // RUN: %clang -target arm -march=armv8.1a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s // RUN: %clang -target arm -mlittle-endian -march=armv8.1-a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -mcpu=generic -target arm -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -mcpu=generic -target armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -mcpu=generic -target arm -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -mcpu=generic -target arm -march=armv8.1a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -mcpu=generic -target armv8.1a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -mcpu=generic -target arm -march=armv8.1a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -mcpu=generic -target arm -mlittle-endian -march=armv8.1-a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s // CHECK-V81A: "-cc1"{{.*}} "-triple" "armv8.1a-{{.*}}" "-target-cpu" "generic" "-target-feature" "+v8.1a" // RUN: %clang -target armebv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s @@ -218,12 +249,14 @@ // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136jf-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6 %s // CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-{{.*}} -// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6K %s -// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6K %s // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcore -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6K %s // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcorenovfp -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6K %s // CHECK-CPUV6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} +// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6KZ %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6KZ %s +// CHECK-CPUV6KZ: "-cc1"{{.*}} "-triple" "armv6kz-{{.*}} + // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6T2 %s // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2f-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6T2 %s // CHECK-CPUV6T2: "-cc1"{{.*}} "-triple" "armv6t2-{{.*}} @@ -361,33 +394,41 @@ // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s // CHECK-BE-CPUV7R-THUMB: "-cc1"{{.*}} "-triple" "thumbebv7r-{{.*}} +// RUN: %clang -target arm -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s +// RUN: %clang -target arm -mcpu=cortex-a35 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a53 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a57 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a72 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // CHECK-CPUV8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}} +// RUN: %clang -target armeb -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target armeb -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target armeb -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target armeb -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s +// RUN: %clang -target arm -mcpu=cortex-a35 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a53 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a57 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a72 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // CHECK-BE-CPUV8A: "-cc1"{{.*}} "-triple" "armebv8-{{.*}} +// RUN: %clang -target arm -mcpu=cortex-a35 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a53 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a57 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a72 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s +// RUN: %clang -target arm -mcpu=cortex-a35 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a53 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a57 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a72 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // CHECK-CPUV8A-THUMB: "-cc1"{{.*}} "-triple" "thumbv8-{{.*}} +// RUN: %clang -target armeb -mcpu=cortex-a35 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target armeb -mcpu=cortex-a53 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target armeb -mcpu=cortex-a57 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target armeb -mcpu=cortex-a72 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s +// RUN: %clang -target arm -mcpu=cortex-a35 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a53 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a57 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a72 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s diff --git a/test/Driver/arm-features.c b/test/Driver/arm-features.c new file mode 100644 index 0000000..eb197da --- /dev/null +++ b/test/Driver/arm-features.c @@ -0,0 +1,13 @@ +// RUN: %clang -target arm-none-none-eabi -mcpu=generic+crc -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRC %s +// RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+crc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRC %s +// CHECK-CRC: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+crc" +// RUN: %clang -target arm-none-none-eabi -mcpu=generic+crypto -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO %s +// RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO %s +// CHECK-CRYPTO: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+crypto" + +// RUN: %clang -target arm-none-none-eabi -mcpu=generic+nocrc -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRC %s +// RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+nocrc -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRC %s +// CHECK-NOCRC: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-crc" +// RUN: %clang -target arm-none-none-eabi -mcpu=generic+nocrypto -march=armv8a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO %s +// RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8a+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO %s +// CHECK-NOCRYPTO: "-cc1"{{.*}} "-triple" "armv8-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-crypto" diff --git a/test/Driver/arm-fixed-r9.c b/test/Driver/arm-fixed-r9.c index 2cec8b4..74ac336 100644 --- a/test/Driver/arm-fixed-r9.c +++ b/test/Driver/arm-fixed-r9.c @@ -1,4 +1,4 @@ // RUN: %clang -target arm-none-gnueabi -ffixed-r9 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-R9 < %t %s -// CHECK-FIXED-R9: "-backend-option" "-arm-reserve-r9" +// CHECK-FIXED-R9: "-target-feature" "+reserve-r9" diff --git a/test/Driver/arm-float-abi.c b/test/Driver/arm-float-abi.c new file mode 100644 index 0000000..e5b42c9 --- /dev/null +++ b/test/Driver/arm-float-abi.c @@ -0,0 +1,6 @@ +// RUN: not %clang %s -target armv7-apple-ios -mfloat-abi=hard 2>&1 | FileCheck -check-prefix=ARMV7-ERROR %s +// RUN: %clang %s -target armv7-apple-ios -mfloat-abi=softfp -### 2>&1 | FileCheck -check-prefix=NOERROR %s +// RUN: %clang %s -arch armv7 -target thumbv7-apple-darwin-eabi -mfloat-abi=hard -### 2>&1 | FileCheck -check-prefix=NOERROR %s + +// ARMV7-ERROR: unsupported option '-mfloat-abi=hard' for target 'thumbv7' +// NOERROR-NOT: unsupported option diff --git a/test/Driver/arm-ias-Wa.s b/test/Driver/arm-ias-Wa.s index 6eadd3b..1483f90 100644 --- a/test/Driver/arm-ias-Wa.s +++ b/test/Driver/arm-ias-Wa.s @@ -62,3 +62,20 @@ // RUN: | FileCheck --check-prefix=CHECK-DUP-HDIV %s // CHECK-DUP-HDIV: "-target-feature" "-hwdiv-arm" // CHECK-DUP-HDIV: "-target-feature" "+hwdiv" + +// ========================================================== Triple +// RUN: %clang -target armv7a-none-eabi -c %s -### 2>&1 \ +// RUN: %clang -target x86_64-apple-darwin -arch armv7 -c %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-A-PROFILE %s +// CHECK-A-PROFILE: "-triple" "armv7-{{.*}}" + +// RUN: %clang -target armv7r-none-eabi -c %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-R-PROFILE %s +// CHECK-R-PROFILE: "-triple" "armv7r-none--eabi" + +// RUN: %clang -target armv7m-none-eabi -c %s -### 2>&1 \ +// RUN: %clang -target thumbv7m-none-eabi -c %s -### 2>&1 \ +// RUN: %clang -target x86_64-apple-darwin -arch armv7m -c %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-M-PROFILE %s +// CHECK-M-PROFILE: "-triple" "thumbv7m-{{.*}}" + diff --git a/test/Driver/arm-multilibs.c b/test/Driver/arm-multilibs.c new file mode 100644 index 0000000..bd9c80e --- /dev/null +++ b/test/Driver/arm-multilibs.c @@ -0,0 +1,17 @@ +// RUN: %clang -target armv7-linux-gnueabi --sysroot=%S/Inputs/multilib_arm_linux_tree -### -c %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ARM %s +// RUN: %clang -target thumbv7-linux-gnueabi --sysroot=%S/Inputs/multilib_arm_linux_tree -### -c %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ARM %s + +// RUN: %clang -target armv7-linux-gnueabihf --sysroot=%S/Inputs/multilib_armhf_linux_tree -### -c %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ARMHF %s +// RUN: %clang -target thumbv7-linux-gnueabihf --sysroot=%S/Inputs/multilib_armhf_linux_tree -### -c %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ARMHF %s + +// RUN: %clang -target armv7eb-linux-gnueabi --sysroot=%S/Inputs/multilib_armeb_linux_tree -### -c %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ARMEB %s +// RUN: %clang -target thumbv7eb-linux-gnueabi --sysroot=%S/Inputs/multilib_armeb_linux_tree -### -c %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ARMEB %s + +// RUN: %clang -target armv7eb-linux-gnueabihf --sysroot=%S/Inputs/multilib_armebhf_linux_tree -### -c %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ARMEBHF %s +// RUN: %clang -target thumbv7eb-linux-gnueabihf --sysroot=%S/Inputs/multilib_armebhf_linux_tree -### -c %s -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-ARMEBHF %s + +// CHECK-ARM: "-internal-externc-isystem" "{{.*}}/usr/include/arm-linux-gnueabi" +// CHECK-ARMHF: "-internal-externc-isystem" "{{.*}}/usr/include/arm-linux-gnueabihf" +// CHECK-ARMEB: "-internal-externc-isystem" "{{.*}}/usr/include/armeb-linux-gnueabi" +// CHECK-ARMEBHF: "-internal-externc-isystem" "{{.*}}/usr/include/armeb-linux-gnueabihf" + diff --git a/test/Driver/arm-no-movt.c b/test/Driver/arm-no-movt.c new file mode 100644 index 0000000..9684d0e --- /dev/null +++ b/test/Driver/arm-no-movt.c @@ -0,0 +1,9 @@ +// RUN: %clang -target armv7-apple-darwin -### %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix CHECK-DEFAULT + +// RUN: %clang -target armv7-apple-darwin -mkernel -### %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix CHECK-KERNEL + +// CHECK-DEFAULT-NOT: "-target-feature" "+no-movt" + +// CHECK-KERNEL: "-target-feature" "+no-movt" diff --git a/test/Driver/as-default-dwarf.s b/test/Driver/as-default-dwarf.s new file mode 100644 index 0000000..9988203 --- /dev/null +++ b/test/Driver/as-default-dwarf.s @@ -0,0 +1,15 @@ +@ REQUIRES: arm-registered-target +@ RUN: %clang --target=armv8a--linux-gnueabi -c %s -o %t +@ RUN: llvm-objdump -t %t | FileCheck %s + .text + .type foo,%function +foo: + .fnstart + .cfi_startproc + +.Ltmp2: + .size foo, .Ltmp2-foo + .cfi_endproc + .fnend + .cfi_sections .debug_frame +@ CHECK: foo diff --git a/test/Driver/as-options.s b/test/Driver/as-options.s new file mode 100644 index 0000000..405030f --- /dev/null +++ b/test/Driver/as-options.s @@ -0,0 +1,37 @@ +// PR21000: Test that -I is passed to both external and integrated assemblers. + +// RUN: %clang -target x86_64-linux-gnu -c -no-integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target x86_64-linux-gnu -c -no-integrated-as %s \ +// RUN: -I foo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target x86_64-linux-gnu -c -integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target x86_64-linux-gnu -c -integrated-as %s \ +// RUN: -I foo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// Other GNU targets + +// RUN: %clang -target aarch64-linux-gnu -c -no-integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target aarch64-linux-gnu -c -integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target armv7-linux-gnueabihf -c -no-integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// RUN: %clang -target armv7-linux-gnueabihf -c -integrated-as %s \ +// RUN: -Ifoo_dir -### 2>&1 \ +// RUN: | FileCheck %s + +// CHECK: "-I" "foo_dir" diff --git a/test/Driver/biarch.c b/test/Driver/biarch.c index 80c42fe..c2b2e4e 100644 --- a/test/Driver/biarch.c +++ b/test/Driver/biarch.c @@ -1,41 +1,33 @@ -// RUN: %clang -target i386--netbsd -m32 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "i386--netbsd"' %t +// RUN: %clang -target i386--netbsd -m32 %s -### 2>&1 | FileCheck -check-prefix=I386 %s +// RUN: %clang -target x86_64--netbsd -m32 %s -### 2>&1 | FileCheck -check-prefix=I386 %s +// I386: "-cc1" "-triple" "i386--netbsd" -// RUN: %clang -target i386--netbsd -m64 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "x86_64--netbsd"' %t +// RUN: %clang -target i386--netbsd -m64 %s -### 2>&1 | FileCheck -check-prefix=X86_64 %s +// RUN: %clang -target x86_64--netbsd -m64 %s -### 2>&1 | FileCheck -check-prefix=X86_64 %s +// X86_64: "-cc1" "-triple" "x86_64--netbsd" -// RUN: %clang -target x86_64--netbsd -m32 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "i386--netbsd"' %t +// r196538 set arm1176jzf-s as default CPU for ARMv6 on NetBSD +// RUN: %clang -target armv6--netbsd-eabihf -m32 %s -### 2>&1 | FileCheck -check-prefix=ARMV6 %s +// ARMV6: "-cc1" "-triple" "armv6kz--netbsd-eabihf" -// RUN: %clang -target x86_64--netbsd -m64 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "x86_64--netbsd"' %t +// RUN: %clang -target sparcv9--netbsd -m32 %s -### 2>&1 | FileCheck -check-prefix=SPARC %s +// RUN: %clang -target sparc--netbsd -m32 %s -### 2>&1 | FileCheck -check-prefix=SPARC %s +// SPARC: "-cc1" "-triple" "sparc--netbsd" -// RUN: %clang -target armv6--netbsd-eabihf -m32 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "armv6k--netbsd-eabihf"' %t +// RUN: %clang -target sparcv9--netbsd -m64 %s -### 2>&1 | FileCheck -check-prefix=SPARCV9 %s +// RUN: %clang -target sparc--netbsd -m64 %s -### 2>&1 | FileCheck -check-prefix=SPARCV9 %s +// SPARCV9: "-cc1" "-triple" "sparcv9--netbsd" -// RUN: %clang -target sparcv9--netbsd -m32 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "sparc--netbsd"' %t +// RUN: %clang -target sparc64--netbsd -m64 %s -### 2>&1 | FileCheck -check-prefix=SPARC64 %s +// SPARC64: "-cc1" "-triple" "sparc64--netbsd" -// RUN: %clang -target sparcv9--netbsd -m64 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t +// RUN: %clang -target sparcel -o foo %s -### 2>&1 | FileCheck -check-prefix=SPARCEL %s +// SPARCEL: gcc{{(\.exe)?}}" "-EL" "-o" "foo" -// RUN: %clang -target sparc64--netbsd -m64 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "sparc64--netbsd"' %t +// RUN: %clang -target mips64--netbsd -m32 %s -### 2>&1 | FileCheck -check-prefix=MIPS %s +// RUN: %clang -target mips--netbsd -m32 %s -### 2>&1 | FileCheck -check-prefix=MIPS %s +// MIPS: "-cc1" "-triple" "mips--netbsd" -// RUN: %clang -target sparc--netbsd -m32 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "sparc--netbsd"' %t - -// RUN: %clang -target sparc--netbsd -m64 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "sparcv9--netbsd"' %t - -// RUN: %clang -target mips64--netbsd -m32 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t - -// RUN: %clang -target mips64--netbsd -m64 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "mips64--netbsd"' %t - -// RUN: %clang -target mips--netbsd -m32 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "mips--netbsd"' %t - -// RUN: %clang -target mips--netbsd -m64 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "mips64--netbsd"' %t +// RUN: %clang -target mips64--netbsd -m64 %s -### 2>&1 | FileCheck -check-prefix=MIPS64 %s +// RUN: %clang -target mips--netbsd -m64 %s -### 2>&1 | FileCheck -check-prefix=MIPS64 %s +// MIPS64: "-cc1" "-triple" "mips64--netbsd" diff --git a/test/Driver/cl-eh.cpp b/test/Driver/cl-eh.cpp index b43f31f..1745616 100644 --- a/test/Driver/cl-eh.cpp +++ b/test/Driver/cl-eh.cpp @@ -1,14 +1,9 @@ -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root - // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. -// FIXME: When C++ EH works, we can make this flag turn things back on. - // RUN: %clang_cl /c /EHsc -### -- %s 2>&1 | FileCheck -check-prefix=EHsc %s -// EHsc-NOT: "-fcxx-exceptions" -// EHsc-NOT: "-fexceptions" +// EHsc: "-fcxx-exceptions" +// EHsc: "-fexceptions" // RUN: %clang_cl /c /EHs-c- -### -- %s 2>&1 | FileCheck -check-prefix=EHs_c_ %s // EHs_c_-NOT: "-fcxx-exceptions" @@ -19,12 +14,12 @@ // EHs_EHc_-NOT: "-fexceptions" // RUN: %clang_cl /c /EHs- /EHs -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHs %s -// EHs_EHs-NOT: "-fcxx-exceptions" -// EHs_EHs-NOT: "-fexceptions" +// EHs_EHs: "-fcxx-exceptions" +// EHs_EHs: "-fexceptions" // RUN: %clang_cl /c /EHs- /EHsa -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHa %s -// EHs_EHa-NOT: "-fcxx-exceptions" -// EHs_EHa-NOT: "-fexceptions" +// EHs_EHa: "-fcxx-exceptions" +// EHs_EHa: "-fexceptions" // RUN: %clang_cl /c /EHinvalid -### -- %s 2>&1 | FileCheck -check-prefix=EHinvalid %s // EHinvalid: error: invalid value 'invalid' in '/EH' diff --git a/test/Driver/cl-fallback.c b/test/Driver/cl-fallback.c index bbc9ad8..e5ebde5 100644 --- a/test/Driver/cl-fallback.c +++ b/test/Driver/cl-fallback.c @@ -1,11 +1,8 @@ -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root - // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. -// RUN: %clang_cl /fallback /Dfoo=bar /Ubaz /Ifoo /O0 /Ox /GR /GR- /Gy /Gy- \ -// RUN: /Gw /Gw- /LD /LDd /EHs /EHs- /MD /MDd /MTd /MT /FImyheader.h /Zi \ +// RUN: %clang_cl --target=i686-pc-win32 /fallback /Dfoo=bar /Ubaz /Ifoo /O0 /Ox /GR /GR- /Gy /Gy- \ +// RUN: /Gw /Gw- /LD /LDd /EHs /EHs- /Zl /MD /MDd /MTd /MT /FImyheader.h /Zi \ // RUN: -### -- %s 2>&1 \ // RUN: | FileCheck %s // CHECK: "-fdiagnostics-format" "msvc-fallback" @@ -17,7 +14,12 @@ // CHECK: "-D" "foo=bar" // CHECK: "-U" "baz" // CHECK: "-I" "foo" -// CHECK: "/Ox" +// CHECK: "/Oi" +// CHECK: "/Og" +// CHECK: "/Ot" +// CHECK: "/Ob2" +// CHECK: "/Oy" +// CHECK: "/GF" // CHECK: "/GR-" // CHECK: "/Gy-" // CHECK: "/Gw-" @@ -27,6 +29,7 @@ // CHECK: "/LDd" // CHECK: "/EHs" // CHECK: "/EHs-" +// CHECK: "/Zl" // CHECK: "/MT" // CHECK: "/Tc" "{{.*cl-fallback.c}}" // CHECK: "/Fo{{.*cl-fallback.*.obj}}" @@ -38,18 +41,18 @@ // RUN: %clang_cl /fallback /Od -### -- %s 2>&1 | FileCheck -check-prefix=O0 %s // O0: cl.exe // O0: "/Od" -// RUN: %clang_cl /fallback /O1 -### -- %s 2>&1 | FileCheck -check-prefix=O1 %s +// RUN: %clang_cl --target=i686-pc-win32 /fallback /O1 -### -- %s 2>&1 | FileCheck -check-prefix=O1 %s // O1: cl.exe -// O1: "-O1" -// RUN: %clang_cl /fallback /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2 %s +// O1: "/Og" "/Os" "/Ob2" "/Oy" "/GF" "/Gy" +// RUN: %clang_cl --target=i686-pc-win32 /fallback /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2 %s // O2: cl.exe -// O2: "-O2" -// RUN: %clang_cl /fallback /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s +// O2: "/Oi" "/Og" "/Ot" "/Ob2" "/Oy" "/GF" "/Gy" +// RUN: %clang_cl --target=i686-pc-win32 /fallback /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s // Os: cl.exe -// Os: "-Os" -// RUN: %clang_cl /fallback /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s +// Os: "/Os" +// RUN: %clang_cl --target=i686-pc-win32 /fallback /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s // Ox: cl.exe -// Ox: "/Ox" +// Ox: "/Oi" "/Og" "/Ot" "/Ob2" "/Oy" "/GF" // Only fall back when actually compiling, not for e.g. /P (preprocess). // RUN: %clang_cl /fallback /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s diff --git a/test/Driver/cl-inputs.c b/test/Driver/cl-inputs.c index 6320009..c67fc24 100644 --- a/test/Driver/cl-inputs.c +++ b/test/Driver/cl-inputs.c @@ -1,6 +1,3 @@ -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root - // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. @@ -34,12 +31,13 @@ // WARN: note: The last /TC or /TP option takes precedence over earlier instances // WARN-NOT: note -// RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TP cl-test.lib -### 2>&1 | FileCheck -check-prefix=TPlib %s +// MSYS2_ARG_CONV_EXCL tells MSYS2 to skip conversion of the specified argument. +// RUN: env LIB=%S/Inputs/cl-libs MSYS2_ARG_CONV_EXCL="/TP;/c" %clang_cl /c /TP cl-test.lib -### 2>&1 | FileCheck -check-prefix=TPlib %s // TPlib: warning: cl-test.lib: 'linker' input unused // TPlib: warning: argument unused during compilation: '/TP' // TPlib-NOT: cl-test.lib -// RUN: env LIB=%S/Inputs/cl-libs %clang_cl /c /TC cl-test.lib -### 2>&1 | FileCheck -check-prefix=TClib %s +// RUN: env LIB=%S/Inputs/cl-libs MSYS2_ARG_CONV_EXCL="/TC;/c" %clang_cl /c /TC cl-test.lib -### 2>&1 | FileCheck -check-prefix=TClib %s // TClib: warning: cl-test.lib: 'linker' input unused // TClib: warning: argument unused during compilation: '/TC' // TClib-NOT: cl-test.lib diff --git a/test/Driver/cl-link-at-file.c b/test/Driver/cl-link-at-file.c index f817ce5..3a37e2f 100644 --- a/test/Driver/cl-link-at-file.c +++ b/test/Driver/cl-link-at-file.c @@ -1,9 +1,6 @@ // PR17239 - The /link option, when inside a response file, should only extend // until the end of the response file (and not the entire command line) -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root - // Note: %s must be preceded by -- or bound to another option, otherwise it may // be interpreted as a command-line option, e.g. on Mac where %s is commonly // under /Users. diff --git a/test/Driver/cl-link.c b/test/Driver/cl-link.c index 8572b77..9813c51 100644 --- a/test/Driver/cl-link.c +++ b/test/Driver/cl-link.c @@ -1,6 +1,3 @@ -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root - // Note: %s must be preceded by -- or bound to another option, otherwise it may // be interpreted as a command-line option, e.g. on Mac where %s is commonly // under /Users. diff --git a/test/Driver/cl-options.c b/test/Driver/cl-options.c index a1145f1..c23aefe 100644 --- a/test/Driver/cl-options.c +++ b/test/Driver/cl-options.c @@ -1,6 +1,3 @@ -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root - // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. @@ -84,7 +81,7 @@ // J: -fno-signed-char // RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s -// O: -Ofoo +// O: /Ofoo // RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s // Ob0: -fno-inline @@ -98,18 +95,32 @@ // RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s // Oi_: -fno-builtin -// RUN: %clang_cl /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s +// RUN: %clang_cl /Os --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s +// RUN: %clang_cl /Os --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s +// Os-NOT: -mdisable-fp-elim +// Os: -momit-leaf-frame-pointer // Os: -Os -// RUN: %clang_cl /Ot -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s +// RUN: %clang_cl /Ot --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s +// RUN: %clang_cl /Ot --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s +// Ot-NOT: -mdisable-fp-elim +// Ot: -momit-leaf-frame-pointer // Ot: -O2 -// RUN: %clang_cl /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s -// Ox: -O3 +// RUN: %clang_cl /Ox --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s +// RUN: %clang_cl /Ox --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s +// Ox-NOT: -mdisable-fp-elim +// Ox: -momit-leaf-frame-pointer +// Ox: -O2 + +// RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s +// PR24003: -mdisable-fp-elim +// PR24003: -momit-leaf-frame-pointer +// PR24003: -Os // RUN: %clang_cl /Zs /Oy -- %s 2>&1 -// RUN: %clang_cl /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s +// RUN: %clang_cl --target=i686-pc-win32 /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s // Oy_: -mdisable-fp-elim // RUN: %clang_cl /Qvec -### -- %s 2>&1 | FileCheck -check-prefix=Qvec %s @@ -162,9 +173,10 @@ // RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s // RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s // RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s -// RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s -// RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s +// RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s +// RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s // W1: -Wall +// W4: -WCL4 // RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s // WX: -Werror @@ -204,15 +216,17 @@ // NOSTRICT: "-relaxed-aliasing" // For some warning ids, we can map from MSVC warning to Clang warning. -// RUN: %clang_cl -wd4005 -wd4996 -wd4910 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s +// RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s // Wno: "-cc1" // Wno: "-Wno-macro-redefined" -// Wno: "-Wno-deprecated-declarations" +// Wno: "-Wno-unused-parameter" // Wno: "-Wno-dllexport-explicit-instantiation-decl" +// Wno: "-Wno-deprecated-declarations" // Ignored options. Check that we don't get "unused during compilation" errors. // RUN: %clang_cl /c \ // RUN: /analyze- \ +// RUN: /bigobj \ // RUN: /cgthreads4 \ // RUN: /cgthreads8 \ // RUN: /d2Zi+ \ @@ -289,6 +303,8 @@ // RUN: /Gr \ // RUN: /GS \ // RUN: /GT \ +// RUN: /guard:cf \ +// RUN: /guard:cf- \ // RUN: /GX \ // RUN: /Gv \ // RUN: /Gz \ @@ -352,12 +368,48 @@ // RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s // ThreadSafeStatics-NOT: "-fno-threadsafe-statics" +// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s +// Zi: "-gcodeview" +// Zi: "-debug-info-kind=line-tables-only" + +// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s +// Z7: "-gcodeview" +// Z7: "-debug-info-kind=line-tables-only" + +// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s +// BreproDefault: "-mincremental-linker-compatible" + +// RUN: %clang_cl /Brepro- /Brepro /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro %s +// Brepro: "-mincremental-linker-compatible" + +// RUN: %clang_cl /Brepro /Brepro- /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro_ %s +// Brepro_-NOT: "-mincremental-linker-compatible" + +// This test was super sneaky: "/Z7" means "line-tables", but "-gdwarf" occurs +// later on the command line, so it should win. Interestingly the cc1 arguments +// came out right, but had wrong semantics, because an invariant assumed by +// CompilerInvocation was violated: it expects that at most one of {gdwarfN, +// line-tables-only} appear. If you assume that, then you can safely use +// Args.hasArg to test whether a boolean flag is present without caring +// where it appeared. And for this test, it appeared to the left of -gdwarf +// which made it "win". This test could not detect that bug. +// RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s +// Z7_gdwarf: "-gcodeview" +// Z7_gdwarf: "-debug-info-kind=limited" +// Z7_gdwarf: "-dwarf-version=4" + // RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s // CXX11: -std=c++11 // RUN: %clang_cl -fmsc-version=1900 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX14 %s // CXX14: -std=c++14 +// RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s +// ENV-CL: "-ffunction-sections" + +// RUN: env CL="/Gy" _CL_="/Gy- -- %s" %clang_cl -### 2>&1 | FileCheck -check-prefix=ENV-_CL_ %s +// ENV-_CL_-NOT: "-ffunction-sections" + // Accept "core" clang options. // (/Zs is for syntax-only, -Werror makes it fail hard on unknown options) // RUN: %clang_cl \ @@ -372,6 +424,10 @@ // RUN: -fno-strict-aliasing \ // RUN: -fstrict-aliasing \ // RUN: -fsyntax-only \ +// RUN: -fms-compatibility \ +// RUN: -fno-ms-compatibility \ +// RUN: -fms-extensions \ +// RUN: -fno-ms-extensions \ // RUN: -mllvm -disable-llvm-optzns \ // RUN: -Wunused-variable \ // RUN: -fmacro-backtrace-limit=0 \ diff --git a/test/Driver/cl-outputs.c b/test/Driver/cl-outputs.c index 3d986db..bf6b431 100644 --- a/test/Driver/cl-outputs.c +++ b/test/Driver/cl-outputs.c @@ -1,6 +1,3 @@ -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root - // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. diff --git a/test/Driver/cl-response-file.c b/test/Driver/cl-response-file.c new file mode 100644 index 0000000..51ee00b --- /dev/null +++ b/test/Driver/cl-response-file.c @@ -0,0 +1,10 @@ +// Test that we use the Windows tokenizer for clang-cl response files. The +// trailing backslash before the space should be interpreted as a literal +// backslash. PR23709 + + + +// RUN: echo '/I%S\Inputs\cl-response-file\ /DFOO=2' > %t.rsp +// RUN: %clang_cl /c -### @%t.rsp -- %s 2>&1 | FileCheck %s + +// CHECK: "-I" "{{.*}}\\Inputs\\cl-response-file\\" "-D" "FOO=2" diff --git a/test/Driver/cl-runtime-flags.c b/test/Driver/cl-runtime-flags.c index 8367531..a54aa1a 100644 --- a/test/Driver/cl-runtime-flags.c +++ b/test/Driver/cl-runtime-flags.c @@ -1,6 +1,3 @@ -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root - // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. @@ -87,3 +84,12 @@ // RUN: %clang_cl /MD /MT -### -- %s 2>&1 | FileCheck -check-prefix=MTOVERRIDE %s // MTOVERRIDE: "--dependent-lib=libcmt" + +// RUN: %clang_cl -### /Zl -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTZl %s +// RUN: %clang_cl -### /MT /Zl -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTZl %s +// CHECK-MTZl-NOT: "-D_DEBUG" +// CHECK-MTZl: "-D_MT" +// CHECK-MTZl-NOT: "-D_DLL" +// CHECK-MTZl-SAME: "-D_VC_NODEFAULTLIB" +// CHECK-MTZl-NOT: "--dependent-lib=libcmt" +// CHECK-MTZl-NOT: "--dependent-lib=oldnames" diff --git a/test/Driver/cl-x86-flags.c b/test/Driver/cl-x86-flags.c index d4f7fb5..32cd072 100644 --- a/test/Driver/cl-x86-flags.c +++ b/test/Driver/cl-x86-flags.c @@ -1,5 +1,3 @@ -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root // REQUIRES: x86-registered-target // We support -m32 and -m64. We support all x86 CPU feature flags in gcc's -m diff --git a/test/Driver/cl-zc.cpp b/test/Driver/cl-zc.cpp index 85eacff..2649629 100644 --- a/test/Driver/cl-zc.cpp +++ b/test/Driver/cl-zc.cpp @@ -1,6 +1,3 @@ -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root - // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. diff --git a/test/Driver/cl.c b/test/Driver/cl.c index 855cdc8..34b4821 100644 --- a/test/Driver/cl.c +++ b/test/Driver/cl.c @@ -1,6 +1,3 @@ -// Don't attempt slash switches on msys bash. -// REQUIRES: shell-preserves-root - // Note: we have to quote the /? option, otherwise some shells will try to // expand the ? into a one-letter filename in the root directory, and make // the test fail is such a file or directory exists. diff --git a/test/Driver/clang-g-opts.c b/test/Driver/clang-g-opts.c index 4a1e719..32b8d42 100644 --- a/test/Driver/clang-g-opts.c +++ b/test/Driver/clang-g-opts.c @@ -1,14 +1,24 @@ // RUN: %clang -### -S %s 2>&1 | FileCheck --check-prefix=CHECK-WITHOUT-G %s // RUN: %clang -### -S %s -g -target x86_64-linux-gnu 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-WITH-G %s + +// Assert that the toolchains which should default to a lower Dwarf version do so. // RUN: %clang -### -S %s -g -target x86_64-apple-darwin 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s // RUN: %clang -### -S %s -g -target i686-pc-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s // RUN: %clang -### -S %s -g -target x86_64-pc-freebsd10.0 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s + +// 'g0' is the default. Just sanity-test that it does nothing // RUN: %clang -### -S %s -g0 2>&1 | FileCheck --check-prefix=CHECK-WITHOUT-G %s + +// And check that the last of -g or -g0 wins. // RUN: %clang -### -S %s -g -g0 2>&1 | FileCheck --check-prefix=CHECK-WITHOUT-G %s + +// These should be semantically the same as not having given 'g0' at all, +// as the last 'g' option wins. +// // RUN: %clang -### -S %s -g0 -g -target x86_64-linux-gnu 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-WITH-G %s // RUN: %clang -### -S %s -g0 -g -target x86_64-apple-darwin 2>&1 \ @@ -20,7 +30,7 @@ // RUN: %clang -### -S %s -g0 -g -target i386-pc-solaris 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s -// CHECK-WITHOUT-G-NOT: "-g" -// CHECK-WITH-G: "-g" -// CHECK-WITH-G-DWARF2: "-gdwarf-2" - +// CHECK-WITHOUT-G-NOT: -debug-info-kind +// CHECK-WITH-G: "-debug-info-kind=limited" +// CHECK-WITH-G: "-dwarf-version=4" +// CHECK-WITH-G-DWARF2: "-dwarf-version=2" diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index 9db23a0..422aa13 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -266,5 +266,5 @@ // RUN: FileCheck -check-prefix=MIPS64EL-ANDROID %s // MIPS64EL-ANDROID: clang // MIPS64EL-ANDROID: "-cc1" -// MIPS64EL-ANDROID: "-target-cpu" "mips64r2" +// MIPS64EL-ANDROID: "-target-cpu" "mips64r6" // MIPS64EL-ANDROID: "-mfloat-abi" "hard" diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c index 0034301..25a1930 100644 --- a/test/Driver/clang_f_opts.c +++ b/test/Driver/clang_f_opts.c @@ -86,10 +86,25 @@ // RUN: %clang -### -S -fprofile-generate=dir -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s // RUN: %clang -### -S -fprofile-generate=dir -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s // RUN: %clang -### -S -fprofile-generate=dir -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-instr-generate=file -fno-profile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-GEN %s +// RUN: %clang -### -S -fprofile-instr-generate=file -fno-profile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-GEN %s +// RUN: %clang -### -S -fprofile-generate=dir -fno-profile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-GEN %s +// RUN: %clang -### -S -fprofile-generate=dir -fno-profile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-GEN %s +// RUN: %clang -### -S -fprofile-instr-use=file -fno-profile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s +// RUN: %clang -### -S -fprofile-instr-use=file -fno-profile-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s +// RUN: %clang -### -S -fprofile-use=file -fno-profile-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s +// RUN: %clang -### -S -fprofile-use=file -fno-profile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-USE %s +// RUN: %clang -### -S -fcoverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-COVERAGE-AND-GEN %s +// RUN: %clang -### -S -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s +// RUN: %clang -### -S -fprofile-instr-generate -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s // CHECK-PROFILE-GENERATE: "-fprofile-instr-generate" // CHECK-PROFILE-GENERATE-DIR: "-fprofile-instr-generate=/some/dir{{/|\\\\}}default.profraw" // CHECK-PROFILE-GENERATE-FILE: "-fprofile-instr-generate=/tmp/somefile.profraw" // CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}' +// CHECK-DISABLE-GEN-NOT: "-fprofile-instr-generate" +// CHECK-DISABLE-USE-NOT: "-fprofile-instr-use" +// CHECK-COVERAGE-AND-GEN: '-fcoverage-mapping' only allowed with '-fprofile-instr-generate' +// CHECK-DISABLE-COVERAGE-NOT: "-fcoverage-mapping" // RUN: %clang -### -S -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s // RUN: %clang -### -S -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s @@ -358,7 +373,7 @@ // CHECK-WARNING-DAG: optimization flag '-ftracer' is not supported // CHECK-WARNING-DAG: optimization flag '-funroll-all-loops' is not supported // CHECK-WARNING-DAG: optimization flag '-funswitch-loops' is not supported -// CHECK-WARNING-DAG: optimization flag '-flto=1' is not supported +// CHECK-WARNING-DAG: unsupported argument '1' to option 'flto=' // CHECK-WARNING-DAG: optimization flag '-falign-labels' is not supported // CHECK-WARNING-DAG: optimization flag '-falign-labels=100' is not supported // CHECK-WARNING-DAG: optimization flag '-falign-loops' is not supported @@ -412,6 +427,19 @@ // CHECK-NO-WARNING1-NOT: optimization flag '-finline-limit=1000' is not supported // CHECK-NO-WARNING2-NOT: optimization flag '-finline-limit' is not supported +// Test that an ignored optimization argument only prints 1 warning, +// not both a warning about not claiming the arg, *and* about not supporting +// the arg; and that adding -Wno-ignored-optimization silences the warning. +// +// RUN: %clang -### -fprofile-correction %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-WARNING3 %s +// CHECK-NO-WARNING3: optimization flag '-fprofile-correction' is not supported +// CHECK-NO-WARNING3-NOT: argument unused +// RUN: %clang -### -fprofile-correction -Wno-ignored-optimization-argument %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-WARNING4 %s +// CHECK-NO-WARNING4-NOT: not supported +// CHECK-NO-WARNING4-NOT: argument unused + // RUN: %clang -### -S -fsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN1 %s // CHAR-SIGN1-NOT: -fno-signed-char diff --git a/test/Driver/coverage_no_integrated_as.c b/test/Driver/coverage_no_integrated_as.c index 6f85b42..9a0a0c2 100644 --- a/test/Driver/coverage_no_integrated_as.c +++ b/test/Driver/coverage_no_integrated_as.c @@ -17,7 +17,7 @@ // RUN: %clang -### -c -fprofile-arcs -no-integrated-as %s -o foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION-REL-PATH %s -// CHECK-GCNO-DEFAULT-LOCATION: "-coverage-file" "{{.*}}/coverage_no_integrated_as.c" +// CHECK-GCNO-DEFAULT-LOCATION: "-coverage-file" "{{.*}}{{/|\\\\}}coverage_no_integrated_as.c" // CHECK-GCNO-DEFAULT-LOCATION-NOT: "-coverage-file" "/tmp/{{.*}}/coverage_no_integrated_as.c" -// CHECK-GCNO-LOCATION: "-coverage-file" "/foo/bar.o" -// CHECK-GCNO-LOCATION-REL-PATH: "-coverage-file" "{{.*}}/foo/bar.o" +// CHECK-GCNO-LOCATION: "-coverage-file" "{{.*}}/foo/bar.o" +// CHECK-GCNO-LOCATION-REL-PATH: "-coverage-file" "{{.*}}{{/|\\\\}}foo/bar.o" diff --git a/test/Driver/crash-report-modules.m b/test/Driver/crash-report-modules.m index 0e1d81a..16af75c 100644 --- a/test/Driver/crash-report-modules.m +++ b/test/Driver/crash-report-modules.m @@ -1,9 +1,9 @@ // RUN: rm -rf %t -// RUN: mkdir %t +// RUN: mkdir -p %t/i %t/m %t // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \ -// RUN: %clang -fsyntax-only %s -I %S/Inputs/module -isysroot /tmp/ \ -// RUN: -fmodules -fmodules-cache-path=/tmp/ -DFOO=BAR 2>&1 | FileCheck %s +// RUN: %clang -fsyntax-only %s -I %S/Inputs/module -isysroot %/t/i/ \ +// RUN: -fmodules -fmodules-cache-path=%t/m/ -DFOO=BAR 2>&1 | FileCheck %s // RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-report-*.m // RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-report-*.sh @@ -30,8 +30,8 @@ const int x = MODULE_MACRO; // CHECKSH-SAME: "-D" "FOO=BAR" // CHECKSH-NEXT: # Original command: {{.*$}} // CHECKSH-NEXT: "-cc1" -// CHECKSH: "-isysroot" "/tmp/" +// CHECKSH: "-isysroot" "{{[^"]*}}/i/" // CHECKSH: "-D" "FOO=BAR" -// CHECKSH-NOT: "-fmodules-cache-path=/tmp/" +// CHECKSH-NOT: "-fmodules-cache-path=" // CHECKSH: "crash-report-modules-{{[^ ]*}}.m" // CHECKSH: "-ivfsoverlay" "crash-report-modules-{{[^ ]*}}.cache/vfs/vfs.yaml" diff --git a/test/Driver/crash-report.c b/test/Driver/crash-report.c index 2ff5b44..a3f1f9e 100644 --- a/test/Driver/crash-report.c +++ b/test/Driver/crash-report.c @@ -1,10 +1,13 @@ // RUN: rm -rf %t // RUN: mkdir %t -// RUN: not 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: not env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1 \ +// RUN: CC_PRINT_HEADERS=1 CC_LOG_DIAGNOSTICS=1 \ +// RUN: %clang -fsyntax-only %s \ +// RUN: -F/tmp/ -I /tmp/ -idirafter /tmp/ -iquote /tmp/ -isystem /tmp/ \ // RUN: -iprefix /the/prefix -iwithprefix /tmp -iwithprefixbefore /tmp/ \ // RUN: -Xclang -internal-isystem -Xclang /tmp/ \ // RUN: -Xclang -internal-externc-isystem -Xclang /tmp/ \ +// RUN: -Xclang -main-file-name -Xclang foo.c \ // RUN: -DFOO=BAR -DBAR="BAZ QUX" 2>&1 | FileCheck %s // RUN: cat %t/crash-report-*.c | FileCheck --check-prefix=CHECKSRC %s // RUN: cat %t/crash-report-*.sh | FileCheck --check-prefix=CHECKSH %s @@ -25,6 +28,8 @@ FOO // CHECKSH-NEXT: # Original command: {{.*$}} // CHECKSH-NEXT: "-cc1" // CHECKSH: "-main-file-name" "crash-report.c" +// CHECKSH-NOT: "-header-include-file" +// CHECKSH-NOT: "-diagnostic-log-file" // CHECKSH: "-D" "FOO=BAR" // CHECKSH: "-D" "BAR=BAZ QUX" // CHECKSH-NOT: "-F/tmp/" diff --git a/test/Driver/cuda-detect.cu b/test/Driver/cuda-detect.cu new file mode 100644 index 0000000..d8fba06 --- /dev/null +++ b/test/Driver/cuda-detect.cu @@ -0,0 +1,64 @@ +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target +// +// # Check that we properly detect CUDA installation. +// RUN: %clang -v --target=i386-unknown-linux \ +// RUN: --sysroot=%S/no-cuda-there 2>&1 | FileCheck %s -check-prefix NOCUDA +// RUN: %clang -v --target=i386-unknown-linux \ +// RUN: --sysroot=%S/Inputs/CUDA 2>&1 | FileCheck %s +// RUN: %clang -v --target=i386-unknown-linux \ +// RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 | FileCheck %s + +// Make sure we map libdevice bitcode files to proper GPUs. +// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_21 \ +// RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix COMMON \ +// RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE21 +// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ +// RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix COMMON -check-prefix CUDAINC \ +// RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE35 +// Verify that -nocudainc prevents adding include path to CUDA headers. +// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ +// RUN: -nocudainc --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix COMMON -check-prefix NOCUDAINC \ +// RUN: -check-prefix LIBDEVICE -check-prefix LIBDEVICE35 +// We should not add any CUDA include paths if there's no valid CUDA installation +// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ +// RUN: --cuda-path=%S/no-cuda-there %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix COMMON -check-prefix NOCUDAINC + +// Verify that no options related to bitcode linking are passes if +// there's no bitcode file. +// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_30 \ +// RUN: --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix COMMON -check-prefix NOLIBDEVICE +// .. or if we explicitly passed -nocudalib +// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ +// RUN: -nocudalib --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix COMMON -check-prefix NOLIBDEVICE +// Verify that we don't add include paths, link with libdevice or +// -include __clang_cuda_runtime_wrapper.h without valid CUDA installation. +// RUN: %clang -### -v --target=i386-unknown-linux --cuda-gpu-arch=sm_35 \ +// RUN: --cuda-path=%S/no-cuda-there %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix COMMON \ +// RUN: -check-prefix NOCUDAINC -check-prefix NOLIBDEVICE + +// CHECK: Found CUDA installation: {{.*}}/Inputs/CUDA/usr/local/cuda +// NOCUDA-NOT: Found CUDA installation: + +// COMMON: "-triple" "nvptx-nvidia-cuda" +// COMMON-SAME: "-fcuda-is-device" +// LIBDEVICE-SAME: "-mlink-cuda-bitcode" +// NOLIBDEVICE-NOT: "-mlink-cuda-bitcode" +// LIBDEVICE21-SAME: libdevice.compute_20.10.bc +// LIBDEVICE35-SAME: libdevice.compute_35.10.bc +// NOLIBDEVICE-NOT: libdevice.compute_{{.*}}.bc +// LIBDEVICE-SAME: "-target-feature" "+ptx42" +// NOLIBDEVICE-NOT: "-target-feature" "+ptx42" +// CUDAINC-SAME: "-internal-isystem" "{{.*}}/Inputs/CUDA/usr/local/cuda/include" +// NOCUDAINC-NOT: "-internal-isystem" "{{.*}}/cuda/include" +// CUDAINC-SAME: "-include" "__clang_cuda_runtime_wrapper.h" +// NOCUDAINC-NOT: "-include" "__clang_cuda_runtime_wrapper.h" +// COMMON-SAME: "-x" "cuda" diff --git a/test/Driver/cuda-options.cu b/test/Driver/cuda-options.cu index 65d4913..2162525 100644 --- a/test/Driver/cuda-options.cu +++ b/test/Driver/cuda-options.cu @@ -6,7 +6,7 @@ // Simple compilation case: // RUN: %clang -### -target x86_64-linux-gnu -c %s 2>&1 \ // Compile device-side to PTX assembly and make sure we use it on the host side. -// RUN: | FileCheck -check-prefix CUDA-D1 \ +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS\ // Then compile host side and incorporate device code. // RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ // Make sure we don't link anything. @@ -15,25 +15,43 @@ // Typical compilation + link case: // RUN: %clang -### -target x86_64-linux-gnu %s 2>&1 \ // Compile device-side to PTX assembly and make sure we use it on the host side -// RUN: | FileCheck -check-prefix CUDA-D1 \ +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS\ // Then compile host side and incorporate device code. // RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ // Then link things. // RUN: -check-prefix CUDA-L %s -// Verify that -cuda-no-device disables device-side compilation and linking +// Verify that --cuda-host-only disables device-side compilation and linking // RUN: %clang -### -target x86_64-linux-gnu --cuda-host-only %s 2>&1 \ // Make sure we didn't run device-side compilation. // RUN: | FileCheck -check-prefix CUDA-ND \ // Then compile host side and make sure we don't attempt to incorporate GPU code. // RUN: -check-prefix CUDA-H -check-prefix CUDA-H-NI \ -// Make sure we don't link anything. -// RUN: -check-prefix CUDA-NL %s +// Linking is allowed to happen, even if we're missing GPU code. +// RUN: -check-prefix CUDA-L %s -// Verify that -cuda-no-host disables host-side compilation and linking +// Same test as above, but with preceeding --cuda-device-only to make +// sure only last option has effect. +// RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only --cuda-host-only %s 2>&1 \ +// Make sure we didn't run device-side compilation. +// RUN: | FileCheck -check-prefix CUDA-ND \ +// Then compile host side and make sure we don't attempt to incorporate GPU code. +// RUN: -check-prefix CUDA-H -check-prefix CUDA-H-NI \ +// Linking is allowed to happen, even if we're missing GPU code. +// RUN: -check-prefix CUDA-L %s + +// Verify that --cuda-device-only disables host-side compilation and linking // RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only %s 2>&1 \ // Compile device-side to PTX assembly -// RUN: | FileCheck -check-prefix CUDA-D1 \ +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS\ +// Make sure there are no host cmpilation or linking. +// RUN: -check-prefix CUDA-NH -check-prefix CUDA-NL %s + +// Same test as above, but with preceeding --cuda-host-only to make +// sure only last option has effect. +// RUN: %clang -### -target x86_64-linux-gnu --cuda-host-only --cuda-device-only %s 2>&1 \ +// Compile device-side to PTX assembly +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS\ // Make sure there are no host cmpilation or linking. // RUN: -check-prefix CUDA-NH -check-prefix CUDA-NL %s @@ -41,7 +59,7 @@ // and incorporate device code on the host side. // RUN: %clang -### -target x86_64-linux-gnu -S -c %s 2>&1 \ // Compile device-side to PTX assembly -// RUN: | FileCheck -check-prefix CUDA-D1 \ +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS\ // Then compile host side and incorporate GPU code. // RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ // Make sure we don't link anything. @@ -51,7 +69,8 @@ // archtecture info to device compilation. // RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_35 -c %s 2>&1 \ // Compile device-side to PTX assembly. -// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1-SM35 \ +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS \ +// RUN: -check-prefix CUDA-D1-SM35 \ // Then compile host side and incorporate GPU code. // RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ // Make sure we don't link anything. @@ -59,43 +78,104 @@ // Verify that there is device-side compilation per --cuda-gpu-arch args // and that all results are included on the host side. -// RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_30 -c %s 2>&1 \ +// RUN: %clang -### -target x86_64-linux-gnu \ +// RUN: --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_30 -c %s 2>&1 \ // Compile both device-sides to PTX assembly // RUN: | FileCheck \ -// RUN: -check-prefix CUDA-D1 -check-prefix CUDA-D1-SM35 \ +// RUN: -check-prefix CUDA-D1 -check-prefix CUDA-D1NS -check-prefix CUDA-D1-SM35 \ // RUN: -check-prefix CUDA-D2 -check-prefix CUDA-D2-SM30 \ // Then compile host side and incorporate both device-side outputs -// RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 -check-prefix CUDA-H-I2 \ +// RUN: -check-prefix CUDA-H -check-prefix CUDA-HNS \ +// RUN: -check-prefix CUDA-H-I1 -check-prefix CUDA-H-I2 \ +// Make sure we don't link anything. +// RUN: -check-prefix CUDA-NL %s + +// Verify that device-side results are passed to correct tool when +// -save-temps is used +// RUN: %clang -### -target x86_64-linux-gnu -save-temps -c %s 2>&1 \ +// Compile device-side to PTX assembly and make sure we use it on the host side. +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1S \ +// Then compile host side and incorporate device code. +// RUN: -check-prefix CUDA-H -check-prefix CUDA-HS -check-prefix CUDA-HS-I1 \ // Make sure we don't link anything. // RUN: -check-prefix CUDA-NL %s -// Match device-side compilation -// CUDA-D1: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda" +// Verify that device-side results are passed to correct tool when +// -fno-integrated-as is used +// RUN: %clang -### -target x86_64-linux-gnu -fno-integrated-as -c %s 2>&1 \ +// Compile device-side to PTX assembly and make sure we use it on the host side. +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1NS \ +// Then compile host side and incorporate device code. +// RUN: -check-prefix CUDA-H -check-prefix CUDA-HNS -check-prefix CUDA-HS-I1 \ +// RUN: -check-prefix CUDA-H-AS \ +// Make sure we don't link anything. +// RUN: -check-prefix CUDA-NL %s + +// --cuda-host-only should never trigger unused arg warning. +// RUN: %clang -### -target x86_64-linux-gnu --cuda-host-only -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix CUDA-NO-UNUSED-CHO %s +// RUN: %clang -### -target x86_64-linux-gnu --cuda-host-only -x c -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix CUDA-NO-UNUSED-CHO %s + +// --cuda-device-only should not produce warning compiling CUDA files +// RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix CUDA-NO-UNUSED-CDO %s + +// --cuda-device-only should warn during non-CUDA compilation. +// RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only -x c -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix CUDA-UNUSED-CDO %s + +// Match device-side preprocessor, and compiler phases with -save-temps +// CUDA-D1S: "-cc1" "-triple" "nvptx64-nvidia-cuda" +// CUDA-D1S-SAME: "-aux-triple" "x86_64--linux-gnu" +// CUDA-D1S-SAME: "-fcuda-is-device" +// CUDA-D1S-SAME: "-x" "cuda" + +// CUDA-D1S: "-cc1" "-triple" "nvptx64-nvidia-cuda" +// CUDA-D1S-SAME: "-aux-triple" "x86_64--linux-gnu" +// CUDA-D1S-SAME: "-fcuda-is-device" +// CUDA-D1S-SAME: "-x" "cuda-cpp-output" + +// Match the job that produces PTX assembly +// CUDA-D1: "-cc1" "-triple" "nvptx64-nvidia-cuda" +// CUDA-D1NS-SAME: "-aux-triple" "x86_64--linux-gnu" // CUDA-D1-SAME: "-fcuda-is-device" // CUDA-D1-SM35-SAME: "-target-cpu" "sm_35" // CUDA-D1-SAME: "-o" "[[GPUBINARY1:[^"]*]]" -// CUDA-D1-SAME: "-x" "cuda" +// CUDA-D1NS-SAME: "-x" "cuda" +// CUDA-D1S-SAME: "-x" "ir" -// Match anothe device-side compilation -// CUDA-D2: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda" +// Match another device-side compilation +// CUDA-D2: "-cc1" "-triple" "nvptx64-nvidia-cuda" +// CUDA-D2-SAME: "-aux-triple" "x86_64--linux-gnu" // CUDA-D2-SAME: "-fcuda-is-device" // CUDA-D2-SM30-SAME: "-target-cpu" "sm_30" // CUDA-D2-SAME: "-o" "[[GPUBINARY2:[^"]*]]" // CUDA-D2-SAME: "-x" "cuda" // Match no device-side compilation -// CUDA-ND-NOT: "-cc1" "-triple" "nvptx{{64?}}-nvidia-cuda" +// CUDA-ND-NOT: "-cc1" "-triple" "nvptx64-nvidia-cuda" // CUDA-ND-SAME-NOT: "-fcuda-is-device" +// Match host-side preprocessor job with -save-temps +// CUDA-HS: "-cc1" "-triple" "x86_64--linux-gnu" +// CUDA-HS-SAME: "-aux-triple" "nvptx64-nvidia-cuda" +// CUDA-HS-SAME-NOT: "-fcuda-is-device" +// CUDA-HS-SAME: "-x" "cuda" + // Match host-side compilation -// CUDA-H: "-cc1" "-triple" -// CUDA-H-SAME-NOT: "nvptx{{64?}}-nvidia-cuda" +// CUDA-H: "-cc1" "-triple" "x86_64--linux-gnu" +// CUDA-H-SAME: "-aux-triple" "nvptx64-nvidia-cuda" // CUDA-H-SAME-NOT: "-fcuda-is-device" -// CUDA-H-SAME: "-o" "[[HOSTOBJ:[^"]*]]" -// CUDA-H-SAME: "-x" "cuda" +// CUDA-H-SAME: "-o" "[[HOSTOUTPUT:[^"]*]]" +// CUDA-HNS-SAME: "-x" "cuda" +// CUDA-HS-SAME: "-x" "cuda-cpp-output" // CUDA-H-I1-SAME: "-fcuda-include-gpubinary" "[[GPUBINARY1]]" // CUDA-H-I2-SAME: "-fcuda-include-gpubinary" "[[GPUBINARY2]]" +// Match external assembler that uses compilation output +// CUDA-H-AS: "-o" "{{.*}}.o" "[[HOSTOUTPUT]]" + // Match no GPU code inclusion. // CUDA-H-NI-NOT: "-fcuda-include-gpubinary" @@ -105,7 +185,11 @@ // Match linker // CUDA-L: "{{.*}}{{ld|link}}{{(.exe)?}}" -// CUDA-L-SAME: "[[HOSTOBJ]]" +// CUDA-L-SAME: "[[HOSTOUTPUT]]" // Match no linker // CUDA-NL-NOT: "{{.*}}{{ld|link}}{{(.exe)?}}" + +// CUDA-NO-UNUSED-CHO-NOT: warning: argument unused during compilation: '--cuda-host-only' +// CUDA-UNUSED-CDO: warning: argument unused during compilation: '--cuda-device-only' +// CUDA-NO-UNUSED-CDO-NOT: warning: argument unused during compilation: '--cuda-device-only' diff --git a/test/Driver/cuda-simple.cu b/test/Driver/cuda-simple.cu index 99d4bfd..3dc0bab 100644 --- a/test/Driver/cuda-simple.cu +++ b/test/Driver/cuda-simple.cu @@ -1,6 +1,6 @@ // Verify that we can parse a simple CUDA file with or without -save-temps // http://llvm.org/PR22936 -// RUN: %clang -Werror -fsyntax-only -c %s +// RUN: %clang -nocudainc -Werror -fsyntax-only -c %s // // Verify that we pass -x cuda-cpp-output to compiler after // preprocessing a CUDA file diff --git a/test/Driver/darwin-debug-flags.c b/test/Driver/darwin-debug-flags.c index 5080a59e..6ba3745 100644 --- a/test/Driver/darwin-debug-flags.c +++ b/test/Driver/darwin-debug-flags.c @@ -16,6 +16,3 @@ int x; // S: "-dwarf-debug-flags" // P: "-dwarf-debug-producer" - -// This depends on shell quoting. -// REQUIRES: shell diff --git a/test/Driver/darwin-ld-lto.c b/test/Driver/darwin-ld-lto.c new file mode 100644 index 0000000..23e006a --- /dev/null +++ b/test/Driver/darwin-ld-lto.c @@ -0,0 +1,25 @@ +// REQUIRES: system-darwin + +// Check that ld gets "-lto_library" and warnings about libLTO.dylib path. + +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -mlinker-version=133 -flto 2> %t.log +// RUN: cat %t.log +// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s < %t.log +// +// LINK_LTOLIB_PATH: {{ld(.exe)?"}} +// LINK_LTOLIB_PATH: "-lto_library" + +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -ccc-install-dir %S/dummytestdir -mlinker-version=133 -flto 2> %t.log +// RUN: cat %t.log +// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_WRN %s < %t.log +// +// LINK_LTOLIB_PATH_WRN: warning: libLTO.dylib relative to clang installed dir not found; using 'ld' default search path instead + +// RUN: %clang -target x86_64-apple-darwin10 -### %s \ +// RUN: -ccc-install-dir %S/dummytestdir -mlinker-version=133 -Wno-liblto -flto 2> %t.log +// RUN: cat %t.log +// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_NOWRN %s < %t.log +// +// LINK_LTOLIB_PATH_NOWRN-NOT: warning: libLTO.dylib relative to clang installed dir not found; using 'ld' default search path instead diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c index a5f9608..ffef3b1 100644 --- a/test/Driver/darwin-ld.c +++ b/test/Driver/darwin-ld.c @@ -152,6 +152,70 @@ // RUN: FileCheck -check-prefix=LINK_NO_IOS_ARM64_CRT1 %s < %t.log // LINK_NO_IOS_ARM64_CRT1-NOT: crt +// RUN: %clang -target arm64-apple-tvos8.3 -mtvos-version-min=8.3 -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK_TVOS_ARM64 %s < %t.log +// LINK_TVOS_ARM64: {{ld(.exe)?"}} +// LINK_TVOS_ARM64: -tvos_version_min +// LINK_TVOS_ARM64-NOT: crt +// LINK_TVOS_ARM64-NOT: lgcc_s.1 +// FIXME: This library does not get built unless the tvOS SDK is +// installed, and the driver will not try to link it if it does not exist. +// This should be reenabled when the tvOS SDK becomes a standard part +// of Xcode. +// FIXME_LINK_TVOS_ARM64: libclang_rt.tvos.a + +// RUN: %clang -target arm64-apple-tvos8.3 -mtvos-version-min=8.3 -fprofile-instr-generate -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK_TVOS_PROFILE %s < %t.log +// LINK_TVOS_PROFILE: {{ld(.exe)?"}} +// FIXME: These libraries do not get built unless the tvOS SDK is +// installed, and the driver will not try to link them if they do not exist. +// This should be reenabled when the tvOS SDK becomes a standard part +// of Xcode. +// FIXME_LINK_TVOS_PROFILE: libclang_rt.profile_tvos.a +// FIXME_LINK_TVOS_PROFILE: libclang_rt.tvos.a + +// RUN: %clang -target arm64-apple-tvos8.3 -mtvos-version-min=8.3 -### %t.o -lcc_kext 2> %t.log +// RUN: FileCheck -check-prefix=LINK_TVOS_KEXT %s < %t.log +// LINK_TVOS_KEXT: {{ld(.exe)?"}} +// FIXME: These libraries do not get built unless the tvOS SDK is +// installed, and the driver will not try to link them if they do not exist. +// This should be reenabled when the tvOS SDK becomes a standard part +// of Xcode. +// FIXME_LINK_TVOS_KEXT: libclang_rt.cc_kext_tvos.a +// FIXME_LINK_TVOS_KEXT: libclang_rt.tvos.a + +// RUN: %clang -target armv7k-apple-watchos2.0 -mwatchos-version-min=2.0 -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK_WATCHOS_ARM %s < %t.log +// LINK_WATCHOS_ARM: {{ld(.exe)?"}} +// LINK_WATCHOS_ARM: -watchos_version_min +// LINK_WATCHOS_ARM-NOT: crt +// LINK_WATCHOS_ARM-NOT: lgcc_s.1 +// FIXME: This library does not get built unless the watchOS SDK is +// installed, and the driver will not try to link it if it does not exist. +// This should be reenabled when the watchOS SDK becomes a standard part +// of Xcode. +// FIXME_LINK_WATCHOS_ARM: libclang_rt.watchos.a + +// RUN: %clang -target armv7k-apple-watchos2.0 -mwatchos-version-min=2.0 -fprofile-instr-generate -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK_WATCHOS_PROFILE %s < %t.log +// LINK_WATCHOS_PROFILE: {{ld(.exe)?"}} +// FIXME: These libraries do not get built unless the watchOS SDK is +// installed, and the driver will not try to link them if they do not exist. +// This should be reenabled when the watchOS SDK becomes a standard part +// of Xcode. +// FIXME_LINK_WATCHOS_PROFILE: libclang_rt.profile_watchos.a +// FIXME_LINK_WATCHOS_PROFILE: libclang_rt.watchos.a + +// RUN: %clang -target armv7k-apple-watchos2.0 -mwatchos-version-min=2.0 -### %t.o -lcc_kext 2> %t.log +// RUN: FileCheck -check-prefix=LINK_WATCHOS_KEXT %s < %t.log +// LINK_WATCHOS_KEXT: {{ld(.exe)?"}} +// FIXME: These libraries do not get built unless the watchOS SDK is +// installed, and the driver will not try to link them if they do not exist. +// This should be reenabled when the watchOS SDK becomes a standard part +// of Xcode. +// FIXME_LINK_WATCHOS_KEXT: libclang_rt.cc_kext_watchos.a +// FIXME_LINK_WATCHOS_KEXT: libclang_rt.watchos.a + // 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 @@ -205,6 +269,26 @@ // LINK_IPHONEOS_VERSION_MIN: -iphoneos_version_min // LINK_IOS_SIMULATOR_VERSION_MIN: -ios_simulator_version_min +// Ditto for tvOS.... +// RUN: env TVOS_DEPLOYMENT_TARGET=7.0 \ +// RUN: %clang -target armv7-apple-darwin -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK_TVOS_VERSION_MIN %s < %t.log +// RUN: env TVOS_DEPLOYMENT_TARGET=7.0 \ +// RUN: %clang -target x86_64-apple-darwin -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK_TVOS_SIMULATOR_VERSION_MIN %s < %t.log +// LINK_TVOS_VERSION_MIN: -tvos_version_min +// LINK_TVOS_SIMULATOR_VERSION_MIN: -tvos_simulator_version_min + +// ...and for watchOS. +// RUN: env WATCHOS_DEPLOYMENT_TARGET=2.0 \ +// RUN: %clang -target armv7k-apple-darwin -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK_WATCHOS_VERSION_MIN %s < %t.log +// RUN: env WATCHOS_DEPLOYMENT_TARGET=2.0 \ +// RUN: %clang -target i386-apple-darwin -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK_WATCHOS_SIMULATOR_VERSION_MIN %s < %t.log +// LINK_WATCHOS_VERSION_MIN: -watchos_version_min +// LINK_WATCHOS_SIMULATOR_VERSION_MIN: -watchos_simulator_version_min + // Check -iframework gets forward to ld as -F // RUN: %clang -target x86_64-apple-darwin %s -iframework Bar -framework Foo -### 2>&1 | \ // RUN: FileCheck --check-prefix=LINK-IFRAMEWORK %s diff --git a/test/Driver/darwin-sdkroot.c b/test/Driver/darwin-sdkroot.c index 3d2a413..4f1fca2 100644 --- a/test/Driver/darwin-sdkroot.c +++ b/test/Driver/darwin-sdkroot.c @@ -31,15 +31,13 @@ // CHECK-NONROOT: "-cc1" // CHECK-NONROOT-NOT: "-isysroot" // -// It doesn't make sense on msys bash. -// REQUIRES: shell-preserves-root -// -// This test will fail with MSYS env.exe, since it does not preserve root, -// expanding / into C:/MINGW/MSYS/1.0. To see the problem, from cmd.exe run: +// This test fails with MSYS or MSYS2 env.exe, since it does not preserve +// root, expanding / into C:/MINGW/MSYS/1.0 or c:/msys64. To reproduce the +// problem, run: // // env SDKROOT=/ cmd //c echo %SDKROOT% // -// This test passes using env.exe from GnuWin32. +// This test do pass using GnuWin32 env.exe. // Check if clang set the correct deployment target from -sysroot // diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c index 3e7496b..009f848 100644 --- a/test/Driver/darwin-version.c +++ b/test/Driver/darwin-version.c @@ -33,12 +33,26 @@ // RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min= -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-MISSING %s // CHECK-VERSION-MISSING: invalid version number +// RUN: %clang -target armv7k-apple-darwin -mwatchos-version-min=2.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOS20 %s +// RUN: %clang -target armv7-apple-darwin -mtvos-version-min=8.3 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-TVOS83 %s +// CHECK-VERSION-TVOS83: "thumbv7-apple-tvos8.3.0" +// RUN: %clang -target i386-apple-darwin -mtvos-simulator-version-min=8.3 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-TVSIM83 %s +// CHECK-VERSION-TVSIM83: "i386-apple-tvos8.3.0" +// RUN: %clang -target armv7k-apple-darwin -mwatchos-version-min=2.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOS20 %s +// CHECK-VERSION-WATCHOS20: "thumbv7k-apple-watchos2.0.0" +// RUN: %clang -target i386-apple-darwin -mwatchos-simulator-version-min=2.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHSIM20 %s +// CHECK-VERSION-WATCHSIM20: "i386-apple-watchos2.0.0" // Check environment variable gets interpreted correctly -// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 \ +// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 IPHONEOS_DEPLOYMENT_TARGET=2.0 \ // RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s -// RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.0 \ +// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 IPHONEOS_DEPLOYMENT_TARGET=2.0 \ // RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS2 %s @@ -50,3 +64,21 @@ // RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \ // RUN: FileCheck --check-prefix=CHECK-VERSION-IOS231 %s // CHECK-VERSION-IOS231: "armv6k-apple-ios2.3.1" + +// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 TVOS_DEPLOYMENT_TARGET=8.3.1 \ +// RUN: %clang -target armv7-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-TVOS %s +// CHECK-VERSION-TVOS: "thumbv7-apple-tvos8.3.1" +// RUN: env TVOS_DEPLOYMENT_TARGET=8.3.1 \ +// RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-TVOSSIM %s +// CHECK-VERSION-TVOSSIM: "i386-apple-tvos8.3.1" + +// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 WATCHOS_DEPLOYMENT_TARGET=2.0 \ +// RUN: %clang -target armv7-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOS %s +// CHECK-VERSION-WATCHOS: "thumbv7-apple-watchos2.0.0" +// RUN: env WATCHOS_DEPLOYMENT_TARGET=2.0 \ +// RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-WATCHOSSIM %s +// CHECK-VERSION-WATCHOSSIM: "i386-apple-watchos2.0.0" diff --git a/test/Driver/debug-options-as.c b/test/Driver/debug-options-as.c index 74a544c..5147568 100644 --- a/test/Driver/debug-options-as.c +++ b/test/Driver/debug-options-as.c @@ -4,22 +4,30 @@ // RUN: %clang -### -c -save-temps -integrated-as -g %s 2>&1 \ // RUN: | FileCheck -check-prefix=SAVE %s // +// SAVE: "-cc1"{{.*}}"-E"{{.*}}"-debug-info-kind= +// SAVE: "-cc1"{{.*}}"-emit-llvm-bc"{{.*}}"-debug-info-kind= +// SAVE: "-cc1"{{.*}}"-S"{{.*}}"-debug-info-kind= // SAVE: "-cc1as" -// SAVE-NOT: "-g" +// SAVE-NOT: -debug-info-kind= + +// Make sure that '-ggdb0' is not accidentally mistaken for '-g' +// RUN: %clang -### -ggdb0 -c -integrated-as -x assembler %s 2>&1 \ +// RUN: | FileCheck -check-prefix=GGDB0 %s +// +// GGDB0: "-cc1as" +// GGDB0-NOT: -debug-info-kind= // Check to make sure clang with -g on a .s file gets passed. // rdar://9275556 -// RUN: touch %t.s -// RUN: %clang -### -c -integrated-as -g %t.s 2>&1 \ +// RUN: %clang -### -c -integrated-as -g -x assembler %s 2>&1 \ // RUN: | FileCheck %s // // CHECK: "-cc1as" -// CHECK: "-g" +// CHECK: "-debug-info-kind=limited" // Check to make sure clang with -g on a .s file gets passed -dwarf-debug-producer. // rdar://12955296 -// RUN: touch %t.s -// RUN: %clang -### -c -integrated-as -g %t.s 2>&1 \ +// RUN: %clang -### -c -integrated-as -g -x assembler %s 2>&1 \ // RUN: | FileCheck -check-prefix=P %s // // P: "-cc1as" diff --git a/test/Driver/debug-options.c b/test/Driver/debug-options.c index 5046179..e160b7f 100644 --- a/test/Driver/debug-options.c +++ b/test/Driver/debug-options.c @@ -2,36 +2,64 @@ // rdar://10383444 // RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \ - | FileCheck -check-prefix=G %s +// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s // RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \ - | FileCheck -check-prefix=G %s +// RUN: | FileCheck -check-prefix=G %s // RUN: %clang -### -c -g3 %s -target x86_64-linux-gnu 2>&1 \ - | FileCheck -check-prefix=G %s +// RUN: | FileCheck -check-prefix=G %s // RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \ - | FileCheck -check-prefix=G %s +// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s // RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \ - | FileCheck -check-prefix=G %s +// RUN: | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_GDB %s // RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \ - | FileCheck -check-prefix=G %s +// RUN: | FileCheck -check-prefix=G %s +// RUN: %clang -### -c -glldb %s -target x86_64-linux-gnu 2>&1 \ +// RUN: | FileCheck -check-prefix=G -check-prefix=G_LLDB %s +// RUN: %clang -### -c -gsce %s -target x86_64-linux-gnu 2>&1 \ +// RUN: | FileCheck -check-prefix=G -check-prefix=G_SCE %s // RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \ - | FileCheck -check-prefix=G_DARWIN %s +// RUN: | FileCheck -check-prefix=G_DARWIN -check-prefix=G_LLDB %s // RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin 2>&1 \ - | FileCheck -check-prefix=G_DARWIN %s +// RUN: | FileCheck -check-prefix=G_DARWIN %s // RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin 2>&1 \ - | FileCheck -check-prefix=G_DARWIN %s +// RUN: | FileCheck -check-prefix=G_DARWIN %s // RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin 2>&1 \ - | FileCheck -check-prefix=G_DARWIN %s +// RUN: | FileCheck -check-prefix=G_DARWIN -check-prefix=G_GDB %s // RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin 2>&1 \ - | FileCheck -check-prefix=G_DARWIN %s +// RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s // RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin 2>&1 \ - | FileCheck -check-prefix=G_DARWIN %s +// RUN: | FileCheck -check-prefix=G_DARWIN %s + +// RUN: %clang -### -c -g %s -target x86_64-pc-freebsd10.0 2>&1 \ +// RUN: | FileCheck -check-prefix=G_LLDB %s + +// On the PS4, -g defaults to -gno-column-info, and we always generate the +// arange section. +// RUN: %clang -### -c %s -target x86_64-scei-ps4 2>&1 \ +// RUN: | FileCheck -check-prefix=NOG_PS4 %s +// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \ +// RUN: | FileCheck -check-prefix=G_PS4 %s +// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \ +// RUN: | FileCheck -check-prefix=G_SCE %s +// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \ +// RUN: | FileCheck -check-prefix=NOCI %s +// RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \ +// RUN: | FileCheck -check-prefix=CI %s // RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G_D2 %s // // RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO %s // RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s // RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s +// RUN: %clang -### -c -glldb -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s +// RUN: %clang -### -c -glldb -g1 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_LLDB %s +// +// PS4 defaults to sce; -ggdb0 changes tuning but turns off debug info, +// then -g turns it back on without affecting tuning. +// RUN: %clang -### -c -ggdb0 -g -target x86_64-scei-ps4 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s // // RUN: %clang -### -c -g1 %s 2>&1 \ // RUN: | FileCheck -check-prefix=GLTO_ONLY %s @@ -75,43 +103,56 @@ // RUN: %clang -### -g -gno-column-info %s 2>&1 \ // RUN: | FileCheck -check-prefix=NOCI %s // -// RUN: %clang -### -g %s 2>&1 | FileCheck -check-prefix=CI %s +// RUN: %clang -### -g -target x86_64-unknown-unknown %s 2>&1 \ +// | FileCheck -check-prefix=CI %s +// +// RUN: %clang -### -gmodules %s 2>&1 \ +// RUN: | FileCheck -check-prefix=GEXTREFS %s // // G: "-cc1" -// G: "-g" +// G: "-debug-info-kind=limited" // // G_DARWIN: "-cc1" -// G_DARWIN: "-gdwarf-2" +// G_DARWIN: "-dwarf-version=2" +// +// NOG_PS4: "-cc1" +// NOG_PS4-NOT "-dwarf-version= +// NOG_PS4: "-generate-arange-section" +// NOG_PS4-NOT: "-dwarf-version= +// +// G_PS4: "-cc1" +// G_PS4: "-dwarf-version= +// G_PS4: "-generate-arange-section" // // G_D2: "-cc1" -// G_D2: "-gdwarf-2" +// G_D2: "-dwarf-version=2" // // G_NO: "-cc1" -// G_NO-NOT: "-g" +// G_NO-NOT: -debug-info-kind= // // GLTO_ONLY: "-cc1" -// GLTO_ONLY-NOT: "-g" -// GLTO_ONLY: "-gline-tables-only" -// GLTO_ONLY-NOT: "-g" +// GLTO_ONLY: "-debug-info-kind=line-tables-only" // // GLTO_ONLY_DWARF2: "-cc1" -// GLTO_ONLY_DWARF2-NOT: "-g" -// GLTO_ONLY_DWARF2: "-gline-tables-only" -// GLTO_ONLY_DWARF2: "-gdwarf-2" -// GLTO_ONLY_DWARF2-NOT: "-g" +// GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only" +// GLTO_ONLY_DWARF2: "-dwarf-version=2" // // G_ONLY: "-cc1" -// G_ONLY-NOT: "-gline-tables-only" -// G_ONLY: "-g" -// G_ONLY-NOT: "-gline-tables-only" +// G_ONLY: "-debug-info-kind=limited" // +// G_GDB: "-debugger-tuning=gdb" +// G_LLDB: "-debugger-tuning=lldb" +// G_SCE: "-debugger-tuning=sce" +// +// These tests assert that "-gline-tables-only" "-g" uses the latter, +// but otherwise not caring about the DebugInfoKind. // G_ONLY_DWARF2: "-cc1" -// G_ONLY_DWARF2-NOT: "-gline-tables-only" -// G_ONLY_DWARF2: "-gdwarf-2" -// G_ONLY_DWARF2-NOT: "-gline-tables-only" +// G_ONLY_DWARF2: "-debug-info-kind={{standalone|limited}}" +// G_ONLY_DWARF2: "-dwarf-version=2" // +// This tests asserts that "-gline-tables-only" "-g0" disables debug info. // GLTO_NO: "-cc1" -// GLTO_NO-NOT: "-gline-tables-only" +// GLTO_NO-NOT: -debug-info-kind= // // GIGNORE-NOT: "argument unused during compilation" // @@ -126,3 +167,5 @@ // CI: "-dwarf-column-info" // // NOCI-NOT: "-dwarf-column-info" +// +// GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj" "-debug-info-kind={{standalone|limited}}" diff --git a/test/Driver/debug-prefix-map.c b/test/Driver/debug-prefix-map.c new file mode 100644 index 0000000..b4f3859 --- /dev/null +++ b/test/Driver/debug-prefix-map.c @@ -0,0 +1,9 @@ +// RUN: %clang -### -fdebug-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-INVALID +// RUN: %clang -### -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-SIMPLE +// RUN: %clang -### -fdebug-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-COMPLEX +// RUN: %clang -### -fdebug-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-EMPTY + +// CHECK-INVALID: error: invalid argument 'old' to -fdebug-prefix-map +// CHECK-SIMPLE: fdebug-prefix-map=old=new +// CHECK-COMPLEX: fdebug-prefix-map=old=n=ew +// CHECK-EMPTY: fdebug-prefix-map=old= diff --git a/test/Driver/dragonfly.c b/test/Driver/dragonfly.c index 4be2aad..20921bb 100644 --- a/test/Driver/dragonfly.c +++ b/test/Driver/dragonfly.c @@ -2,6 +2,6 @@ // RUN: FileCheck -input-file %t.log %s // CHECK: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-dragonfly" -// CHECK: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/usr/libexec/ld-elf.so.{{.*}}" "--hash-style=both" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-L{{.*}}gcc4{{.*}}" "-rpath" "{{.*}}gcc4{{.*}}" "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o" +// CHECK: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/usr/libexec/ld-elf.so.{{.*}}" "--hash-style=gnu" "--enable-new-dtags" "-o" "a.out" "{{.*}}crt1.o" "{{.*}}crti.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-L{{.*}}gcc{{.*}}" "-rpath" "{{.*}}gcc{{.*}}" "-lc" "-lgcc" "{{.*}}crtend.o" "{{.*}}crtn.o" diff --git a/test/Driver/dyld-prefix.c b/test/Driver/dyld-prefix.c index 5336a11..2c2bc4f 100644 --- a/test/Driver/dyld-prefix.c +++ b/test/Driver/dyld-prefix.c @@ -1,5 +1,3 @@ -// REQUIRES: shell-preserves-root - // RUN: touch %t.o // RUN: %clang -target i386-unknown-linux --dyld-prefix /foo -### %t.o 2>&1 | FileCheck --check-prefix=CHECK-32 %s diff --git a/test/Driver/eabi.c b/test/Driver/eabi.c new file mode 100644 index 0000000..4fd8ee8 --- /dev/null +++ b/test/Driver/eabi.c @@ -0,0 +1,13 @@ +// RUN: %clang %s -meabi 4 -### 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-EABI4 %s +// RUN: %clang %s -meabi 5 -### 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-EABI5 %s +// RUN: %clang %s -meabi gnu -### 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-GNUEABI %s +// RUN: not %clang %s -meabi unknown 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-UNKNOWN %s + +// CHECK-EABI4: "-meabi" "4" +// CHECK-EABI5: "-meabi" "5" +// CHECK-GNUEABI: "-meabi" "gnu" +// CHECK-UNKNOWN: error: invalid value 'unknown' in '-meabi unknown' diff --git a/test/Driver/elfiamcu-header-search.c b/test/Driver/elfiamcu-header-search.c new file mode 100644 index 0000000..d0f147a --- /dev/null +++ b/test/Driver/elfiamcu-header-search.c @@ -0,0 +1,6 @@ +// REQUIRES: x86-registered-target + +// RUN: %clang -target i386-pc-elfiamcu -c -v -fsyntax-only %s 2>&1 | FileCheck %s +// CHECK-NOT: /usr/include +// CHECK-NOT: /usr/local/include + diff --git a/test/Driver/env.c b/test/Driver/env.c index f243fa6..0371bc9 100644 --- a/test/Driver/env.c +++ b/test/Driver/env.c @@ -1,6 +1,6 @@ // These tests try to ensure that the driver operates reasonably when run with // a strange environment. Unfortunately, it requires a normal shell and the -// 'env' command. +// 'env' command that understands arguments, unlike the LIT built-in env. // // REQUIRES: shell // The PATH variable is heavily used when trying to find a linker. diff --git a/test/Driver/fplugin.c b/test/Driver/fplugin.c new file mode 100644 index 0000000..d0aaa9e --- /dev/null +++ b/test/Driver/fplugin.c @@ -0,0 +1,7 @@ +// Check that all -fplugin arguments are converted to -load + +// RUN: %clang -c %s -fplugin=foo.so -### 2>&1 | FileCheck %s --check-prefix=CHECK1 +// RUN: %clang -c %s -fplugin=foo.so -fplugin=bar.so -### 2>&1 | FileCheck %s --check-prefix=CHECK2 + +// CHECK1: "-load" "foo.so" +// CHECK2: "-load" "foo.so" "-load" "bar.so" diff --git a/test/Driver/freebsd-mips-as.c b/test/Driver/freebsd-mips-as.c index da2d120..7555888 100644 --- a/test/Driver/freebsd-mips-as.c +++ b/test/Driver/freebsd-mips-as.c @@ -89,3 +89,9 @@ // 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" +// +// RUN: %clang -target mips-unknown-freebsd -### \ +// RUN: -no-integrated-as -G0 -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS32-EB-AS-G0 %s +// MIPS32-EB-AS-G0: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB" "-G0" +// MIPS32-EB-AS-G0-NOT: "-KPIC" diff --git a/test/Driver/freebsd.c b/test/Driver/freebsd.c index a7448c1..45e9204 100644 --- a/test/Driver/freebsd.c +++ b/test/Driver/freebsd.c @@ -135,4 +135,9 @@ // RUN: %clang -mcpu=ultrasparc -target sparc64-unknown-freebsd8 %s -### -no-integrated-as 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-SPARC-CPU %s // CHECK-SPARC-CPU: cc1{{.*}}" "-target-cpu" "ultrasparc" -// CHECK-SPARC-CPU: as{{.*}}" "-Av9a +// CHECK-SPARC-CPU: as{{.*}}" "-Av9 + +// Check that -G flags are passed to the linker for mips +// RUN: %clang -target mips-unknown-freebsd %s -### -G0 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPS-G %s +// CHECK-MIPS-G: ld{{.*}}" "-G0" diff --git a/test/Driver/fsanitize-blacklist.c b/test/Driver/fsanitize-blacklist.c index c7180ded..9edbbaf 100644 --- a/test/Driver/fsanitize-blacklist.c +++ b/test/Driver/fsanitize-blacklist.c @@ -12,28 +12,40 @@ // RUN: echo "fun:bar" > %t.second // RUN: echo "badline" > %t.bad -// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST -// CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.good -// CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.second +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST +// CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.good" "-fsanitize-blacklist={{.*}}.second + +// Now, check for -fdepfile-entry flags. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST2 +// CHECK-BLACKLIST2: -fdepfile-entry={{.*}}.good" "-fdepfile-entry={{.*}}.second + +// Check that the default blacklist is not added as an extra dependency. +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLACKLIST --implicit-check-not=fdepfile-entry +// CHECK-DEFAULT-BLACKLIST: -fsanitize-blacklist={{.*}}asan_blacklist.txt // Ignore -fsanitize-blacklist flag if there is no -fsanitize flag. -// RUN: %clang -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS +// RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS // CHECK-NO-SANITIZE-NOT: -fsanitize-blacklist +// Ignore -fsanitize-blacklist flag if there is no -fsanitize flag. +// Now, check for the absense of -fdepfile-entry flags. +// RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE2 --check-prefix=DELIMITERS +// CHECK-NO-SANITIZE2-NOT: -fdepfile-entry + // Flag -fno-sanitize-blacklist wins if it is specified later. -// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-BLACKLIST --check-prefix=DELIMITERS +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-BLACKLIST --check-prefix=DELIMITERS // CHECK-NO-BLACKLIST-NOT: -fsanitize-blacklist // Driver barks on unexisting blacklist files. -// RUN: %clang -fno-sanitize-blacklist -fsanitize-blacklist=unexisting.txt %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SUCH-FILE +// RUN: %clang -target x86_64-linux-gnu -fno-sanitize-blacklist -fsanitize-blacklist=unexisting.txt %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SUCH-FILE // CHECK-NO-SUCH-FILE: error: no such file or directory: 'unexisting.txt' // Driver properly reports malformed blacklist files. -// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.second -fsanitize-blacklist=%t.bad -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-BLACKLIST +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.second -fsanitize-blacklist=%t.bad -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-BLACKLIST // CHECK-BAD-BLACKLIST: error: malformed sanitizer blacklist: 'error parsing file '{{.*}}.bad': malformed line 1: 'badline'' // -fno-sanitize-blacklist disables all blacklists specified earlier. -// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED // CHECK-ONLY_FIRST-DISABLED-NOT: good // CHECK-ONLY-FIRST-DISABLED: -fsanitize-blacklist={{.*}}.second // CHECK-ONLY_FIRST-DISABLED-NOT: good diff --git a/test/Driver/fsanitize-coverage.c b/test/Driver/fsanitize-coverage.c index 51ab97a..fdaa9fa 100644 --- a/test/Driver/fsanitize-coverage.c +++ b/test/Driver/fsanitize-coverage.c @@ -61,7 +61,7 @@ // CHECK-EXTEND-LEGACY: -fsanitize-coverage-type=1 // CHECK-EXTEND-LEGACY: -fsanitize-coverage-trace-cmp -// RUN: %clang_cl -fsanitize=address -fsanitize-coverage=1 -c -### -- %s 2>&1 | FileCheck %s -check-prefix=CLANG-CL-COVERAGE +// RUN: %clang_cl --target=i386-pc-win32 -fsanitize=address -fsanitize-coverage=1 -c -### -- %s 2>&1 | FileCheck %s -check-prefix=CLANG-CL-COVERAGE // CLANG-CL-COVERAGE-NOT: error: // CLANG-CL-COVERAGE-NOT: warning: // CLANG-CL-COVERAGE-NOT: argument unused diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c index 15b4383..3d7713d 100644 --- a/test/Driver/fsanitize.c +++ b/test/Driver/fsanitize.c @@ -142,36 +142,43 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1 // OK -// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-NO-PIE -// CHECK-TSAN-NO-PIE: "-mrelocation-model" "static" +// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE +// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE +// RUN: %clang -target x86_64-unknown-freebsd -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE +// RUN: %clang -target aarch64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE +// RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE +// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-NO-PIE -// CHECK-MSAN-NO-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pie-level" "2" -// CHECK-MSAN-NO-PIE: "-pie" +// CHECK-NO-PIE-NOT: "-pie" +// CHECK-NO-PIE: "-mrelocation-model" "static" +// CHECK-NO-PIE-NOT: "-pie" -// RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ANDROID-ASAN-NO-PIE -// CHECK-ANDROID-ASAN-NO-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pie-level" "2" -// CHECK-ANDROID-ASAN-NO-PIE: "-pie" +// CHECK-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pie-level" "2" +// CHECK-PIE: "-pie" // RUN: %clang -target arm-linux-androideabi %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ANDROID-NO-ASAN // CHECK-ANDROID-NO-ASAN: "-mrelocation-model" "pic" -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover=all -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover=all -fsanitize-recover=thread -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover -fsanitize-recover=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover=all -fno-sanitize-recover=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover=all -fsanitize-recover=object-size,shift-base -### 2>&1 | FileCheck %s --check-prefix=CHECK-PARTIAL-RECOVER +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER-UBSAN +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER-UBSAN +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover=all -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER-UBSAN +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover -fsanitize-recover=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER-UBSAN +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER-UBSAN +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover=all -fsanitize-recover=thread -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER-UBSAN +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover=all -fno-sanitize-recover=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER-UBSAN +// CHECK-RECOVER-UBSAN: "-fsanitize-recover={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift-base|shift-exponent|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}} +// CHECK-NO-RECOVER-UBSAN-NOT: sanitize-recover -// CHECK-RECOVER: "-fsanitize-recover={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift-base|shift-exponent|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}} -// CHECK-NO-RECOVER-NOT: sanitize-recover +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover=all -fsanitize-recover=object-size,shift-base -### 2>&1 | FileCheck %s --check-prefix=CHECK-PARTIAL-RECOVER // CHECK-PARTIAL-RECOVER: "-fsanitize-recover={{((object-size|shift-base),?){2}"}} -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover=address,foobar,object-size,unreachable -### 2>&1 | FileCheck %s --check-prefix=CHECK-DIAG-RECOVER +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=address -fsanitize-recover=all -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER-ASAN +// CHECK-RECOVER-ASAN: "-fsanitize-recover=address" + +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover=foobar,object-size,unreachable -### 2>&1 | FileCheck %s --check-prefix=CHECK-DIAG-RECOVER // CHECK-DIAG-RECOVER: unsupported argument 'foobar' to option 'fsanitize-recover=' -// CHECK-DIAG-RECOVER: unsupported argument 'address,unreachable' to option 'fsanitize-recover=' +// CHECK-DIAG-RECOVER: unsupported argument 'unreachable' to option 'fsanitize-recover=' // RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEPRECATED-RECOVER // CHECK-DEPRECATED-RECOVER: argument '-fsanitize-recover' is deprecated, use '-fsanitize-recover=undefined,integer' instead @@ -203,12 +210,11 @@ // CHECK-MSAN-NOMSAN-DARWIN-NOT: unsupported option // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=memory -fsanitize=thread,memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-TSAN-MSAN-DARWIN -// CHECK-MSAN-TSAN-MSAN-DARWIN: unsupported option '-fsanitize=thread,memory' for target 'x86_64-apple-darwin10' +// CHECK-MSAN-TSAN-MSAN-DARWIN: unsupported option '-fsanitize=memory' for target 'x86_64-apple-darwin10' // CHECK-MSAN-TSAN-MSAN-DARWIN-NOT: unsupported option // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=thread,memory -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-MSAN-MSAN-DARWIN // CHECK-TSAN-MSAN-MSAN-DARWIN: unsupported option '-fsanitize=memory' for target 'x86_64-apple-darwin10' -// CHECK-TSAN-MSAN-MSAN-DARWIN: unsupported option '-fsanitize=thread' for target 'x86_64-apple-darwin10' // CHECK-TSAN-MSAN-MSAN-DARWIN-NOT: unsupported option // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=function %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-DARWIN @@ -230,11 +236,12 @@ // CHECK-ASAN-OPENBSD: unsupported option '-fsanitize=address' for target 'i386-pc-openbsd' // RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI +// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=cfi -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI // RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-derived-cast -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-DCAST // RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-unrelated-cast -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-UCAST // RUN: %clang -target x86_64-linux-gnu -flto -fsanitize=cfi-nvcall -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NVCALL // RUN: %clang -target x86_64-linux-gnu -flto -fsanitize=cfi-vcall -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-VCALL -// CHECK-CFI: -emit-llvm-bc{{.*}}-fsanitize=cfi-derived-cast,cfi-unrelated-cast,cfi-nvcall,cfi-vcall +// CHECK-CFI: -emit-llvm-bc{{.*}}-fsanitize=cfi-derived-cast,cfi-icall,cfi-unrelated-cast,cfi-nvcall,cfi-vcall // CHECK-CFI-DCAST: -emit-llvm-bc{{.*}}-fsanitize=cfi-derived-cast // CHECK-CFI-UCAST: -emit-llvm-bc{{.*}}-fsanitize=cfi-unrelated-cast // CHECK-CFI-NVCALL: -emit-llvm-bc{{.*}}-fsanitize=cfi-nvcall @@ -243,6 +250,9 @@ // RUN: %clang -target x86_64-linux-gnu -flto -fsanitize=cfi-derived-cast -fno-lto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOLTO // CHECK-CFI-NOLTO: '-fsanitize=cfi-derived-cast' only allowed with '-flto' +// RUN: %clang -target mips-unknown-linux -fsanitize=cfi-icall %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-ICALL-MIPS +// CHECK-CFI-ICALL-MIPS: unsupported option '-fsanitize=cfi-icall' for target 'mips-unknown-linux' + // RUN: %clang -target x86_64-linux-gnu -fsanitize-trap=address -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-TRAP // CHECK-ASAN-TRAP: error: unsupported argument 'address' to option '-fsanitize-trap' @@ -253,6 +263,15 @@ // CHECK-CFI-NOTRAP-WIN: -emit-llvm-bc // CHECK-CFI-NOTRAP-WIN-NOT: -fsanitize-trap=cfi +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -fsanitize-cfi-cross-dso -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-CROSS-DSO +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NO-CROSS-DSO +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -fsanitize-cfi-cross-dso -fno-sanitize-cfi-cross-dso -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NO-CROSS-DSO +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -fno-sanitize-cfi-cross-dso -fsanitize-cfi-cross-dso -flto -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-CROSS-DSO +// CHECK-CFI-CROSS-DSO: -emit-llvm-bc +// CHECK-CFI-CROSS-DSO: -fsanitize-cfi-cross-dso +// CHECK-CFI-NO-CROSS-DSO: -emit-llvm-bc +// CHECK-CFI-NO-CROSS-DSO-NOT: -fsanitize-cfi-cross-dso + // RUN: %clang_cl -fsanitize=address -c -MDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL // RUN: %clang_cl -fsanitize=address -c -MTd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL // RUN: %clang_cl -fsanitize=address -c -LDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL @@ -278,6 +297,8 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN // RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP +// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP +// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP // SP-NOT: stack-protector // SP: "-fsanitize=safe-stack" // SP-ASAN-NOT: stack-protector @@ -286,3 +307,20 @@ // RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM // RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM // CHECK-SANM: "-fsanitize=memory" + +// RUN: %clang -target x86_64-scei-ps4 -fsanitize=function -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-UBSAN-PS4 +// CHECK-FSAN-UBSAN-PS4: unsupported option '-fsanitize=function' for target 'x86_64-scei-ps4' +// RUN: %clang -target x86_64-scei-ps4 -fsanitize=function %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-PS4 +// CHECK-FSAN-PS4: unsupported option '-fsanitize=function' for target 'x86_64-scei-ps4' +// RUN: %clang -target x86_64-scei-ps4 -fsanitize=dataflow %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DFSAN-PS4 +// CHECK-DFSAN-PS4: unsupported option '-fsanitize=dataflow' for target 'x86_64-scei-ps4' +// RUN: %clang -target x86_64-scei-ps4 -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-PS4 +// CHECK-LSAN-PS4: unsupported option '-fsanitize=leak' for target 'x86_64-scei-ps4' +// RUN: %clang -target x86_64-scei-ps4 -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-PS4 +// CHECK-MSAN-PS4: unsupported option '-fsanitize=memory' for target 'x86_64-scei-ps4' +// RUN: %clang -target x86_64-scei-ps4 -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-PS4 +// CHECK-TSAN-PS4: unsupported option '-fsanitize=thread' for target 'x86_64-scei-ps4' +// RUN: %clang -target x86_64-scei-ps4 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-PS4 +// Make sure there are no *.{o,bc} or -l passed before the ASan library. +// CHECK-ASAN-PS4-NOT: {{(\.(o|bc)"? |-l).*-lSceDbgAddressSanitizer_stub_weak}} +// CHECK-ASAN-PS4: -lSceDbgAddressSanitizer_stub_weak diff --git a/test/Driver/gold-lto.c b/test/Driver/gold-lto.c index db6786f..050b1ef 100644 --- a/test/Driver/gold-lto.c +++ b/test/Driver/gold-lto.c @@ -1,23 +1,26 @@ // RUN: touch %t.o // // RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \ -// RUN: -Wl,-plugin-opt=foo \ +// RUN: -Wl,-plugin-opt=foo -O3 \ // RUN: | FileCheck %s --check-prefix=CHECK-X86-64-BASIC // CHECK-X86-64-BASIC: "-plugin" "{{.*}}/LLVMgold.so" +// CHECK-X86-64-BASIC: "-plugin-opt=O3" // CHECK-X86-64-BASIC: "-plugin-opt=foo" // // RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \ -// RUN: -march=corei7 -Wl,-plugin-opt=foo \ +// RUN: -march=corei7 -Wl,-plugin-opt=foo -Ofast \ // RUN: | FileCheck %s --check-prefix=CHECK-X86-64-COREI7 // CHECK-X86-64-COREI7: "-plugin" "{{.*}}/LLVMgold.so" // CHECK-X86-64-COREI7: "-plugin-opt=mcpu=corei7" +// CHECK-X86-64-COREI7: "-plugin-opt=O3" // CHECK-X86-64-COREI7: "-plugin-opt=foo" // // RUN: %clang -target arm-unknown-linux -### %t.o -flto 2>&1 \ -// RUN: -march=armv7a -Wl,-plugin-opt=foo \ +// RUN: -march=armv7a -Wl,-plugin-opt=foo -O0 \ // RUN: | FileCheck %s --check-prefix=CHECK-ARM-V7A // CHECK-ARM-V7A: "-plugin" "{{.*}}/LLVMgold.so" // CHECK-ARM-V7A: "-plugin-opt=mcpu=cortex-a8" +// CHECK-ARM-V7A: "-plugin-opt=O0" // CHECK-ARM-V7A: "-plugin-opt=foo" // // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \ diff --git a/test/Driver/hexagon-toolchain-elf.c b/test/Driver/hexagon-toolchain-elf.c index b9e53ab..e3a54dd 100644 --- a/test/Driver/hexagon-toolchain-elf.c +++ b/test/Driver/hexagon-toolchain-elf.c @@ -2,135 +2,92 @@ // Test standard include paths // ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK001 %s -// CHECK001: "-cc1" {{.*}} "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include" -// CHECK001: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include-fixed" -// CHECK001: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include" -// CHECK001-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" +// RUN: | FileCheck -check-prefix=CHECK000 %s +// CHECK000: "-cc1" {{.*}} "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include" -// RUN: %clangxx -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clangxx -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK002 %s -// CHECK002: "-cc1" {{.*}} "-internal-isystem" "[[INSTALL_DIR:.*]]/Inputs/hexagon_tree/qc/bin/../../gnu{{/|\\\\}}hexagon/include/c++/4.4.0" -// CHECK002: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include" -// CHECK002: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include-fixed" -// CHECK002: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include" -// CHECK002-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" +// RUN: | FileCheck -check-prefix=CHECK001 %s +// CHECK001: "-cc1" {{.*}} "-internal-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include/c++" +// CHECK001: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include" // ----------------------------------------------------------------------------- // Test -nostdinc, -nostdlibinc, -nostdinc++ // ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ // RUN: -nostdinc \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK003 %s -// CHECK003: "-cc1" -// CHECK003-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include" -// CHECK003-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include-fixed" -// CHECK003-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include" -// CHECK003-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" +// RUN: | FileCheck -check-prefix=CHECK010 %s +// CHECK010: "-cc1" +// CHECK010-NOT: "-internal-externc-isystem" -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ // RUN: -nostdlibinc \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK004 %s -// CHECK004: "-cc1" -// CHECK004-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include" -// CHECK004-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include-fixed" -// CHECK004-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include" -// CHECK004-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" +// RUN: | FileCheck -check-prefix=CHECK011 %s +// CHECK011: "-cc1" +// CHECK011-NOT: "-internal-externc-isystem" -// RUN: %clangxx -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -nostdlibinc \ +// RUN: %clangxx -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -nostdinc++ \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK005 %s -// CHECK005: "-cc1" -// CHECK005-NOT: "-internal-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include/c++/4.4.0" -// CHECK005-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include" -// CHECK005-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include-fixed" -// CHECK005-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include" -// CHECK005-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" +// RUN: | FileCheck -check-prefix=CHECK012 %s +// CHECK012: "-cc1" +// CHECK012-DAG-NOT: "-internal-isystem" +// CHECK012-DAG: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include" -// RUN: %clangxx -### -target hexagon-unknown-elf \ +// RUN: %clangxx -### -target hexagon-unknown-elf -fno-integrated-as \ // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ // RUN: --gcc-toolchain="" \ -// RUN: -nostdinc++ \ +// RUN: -nostdlibinc \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK006 %s -// CHECK006: "-cc1" -// CHECK006-NOT: "-internal-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include/c++/4.4.0" -// CHECK006-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" +// RUN: | FileCheck -check-prefix=CHECK013 %s +// CHECK013: "-cc1" +// CHECK013-DAG-NOT: "-internal-isystem" +// CHECK013-DAG-NOT: "-internal-externc-isystem" // ----------------------------------------------------------------------------- -// Test -march=<archname> -mcpu=<archname> -mv<number> +// Test -mcpu=<cpuname> -mv<number> // ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -march=hexagonv3 \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv4 \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK007 %s -// CHECK007: "-cc1" {{.*}} "-target-cpu" "hexagonv3" -// CHECK007-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as"{{.*}} "-march=v3" -// CHECK007-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-ld"{{.*}} "-mv3" +// RUN: | FileCheck -check-prefix=CHECK020 %s +// CHECK020: "-cc1" {{.*}} "-target-cpu" "hexagonv4" +// CHECK020: "hexagon-link" {{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v4/crt0 -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ // RUN: -mcpu=hexagonv5 \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK008 %s -// CHECK008: "-cc1" {{.*}} "-target-cpu" "hexagonv5" -// CHECK008-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as"{{.*}} "-march=v5" -// CHECK008-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-ld"{{.*}} "-mv5" +// RUN: | FileCheck -check-prefix=CHECK021 %s +// CHECK021: "-cc1" {{.*}} "-target-cpu" "hexagonv5" +// CHECK021: "hexagon-link" {{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v5/crt0 -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -mv2 \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv55 \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK009 %s -// CHECK009: "-cc1" {{.*}} "-target-cpu" "hexagonv2" -// CHECK009-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as"{{.*}} "-march=v2" -// CHECK009-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-ld"{{.*}} "-mv2" +// RUN: | FileCheck -check-prefix=CHECK022 %s +// CHECK022: "-cc1" {{.*}} "-target-cpu" "hexagonv55" +// CHECK022: "hexagon-link" {{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v55/crt0 -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK010 %s -// CHECK010: "-cc1" {{.*}} "-target-cpu" "hexagonv4" -// CHECK010-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as"{{.*}} "-march=v4" -// CHECK010-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-ld"{{.*}} "-mv4" - -// RUN: not %clang -march=hexagonv2 -target hexagon-unknown-elf \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V2 %s -// RUN: not %clang -mcpu=hexagonv2 -target hexagon-unknown-elf \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V2 %s -// RUN: not %clang -mv2 -target hexagon-unknown-elf \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V2 %s -// CHECK-UNKNOWN-V2: error: unknown target CPU 'hexagonv2' - -// RUN: not %clang -march=hexagonv3 -target hexagon-unknown-elf \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V3 %s -// RUN: not %clang -mcpu=hexagonv3 -target hexagon-unknown-elf \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V3 %s -// RUN: not %clang -mv3 -target hexagon-unknown-elf \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V3 %s -// CHECK-UNKNOWN-V3: error: unknown target CPU 'hexagonv3' +// RUN: | FileCheck -check-prefix=CHECK023 %s +// CHECK023: "-cc1" {{.*}} "-target-cpu" "hexagonv60" +// CHECK023: "hexagon-link" {{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0 // ----------------------------------------------------------------------------- // Test Linker related args @@ -139,450 +96,388 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Defaults for C // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK011 %s -// CHECK011: "-cc1" -// CHECK011-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK011-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK011-NOT: "-static" -// CHECK011-NOT: "-shared" -// CHECK011: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK011: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK011: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK011: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK011: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK011: "-L{{.*}}/lib/gcc" -// CHECK011: "-L{{.*}}/hexagon/lib/v4" -// CHECK011: "-L{{.*}}/hexagon/lib" -// CHECK011: "{{[^"]+}}.o" -// CHECK011: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" -// CHECK011: "{{.*}}/hexagon/lib/v4/fini.o" +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ +// RUN: %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK030 %s +// CHECK030: "-cc1" +// CHECK030-NEXT: hexagon-link +// CHECK030-NOT: "-static" +// CHECK030-NOT: "-shared" +// CHECK030: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" +// CHECK030: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o" +// CHECK030: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o" +// CHECK030: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK030: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK030: "{{[^"]+}}.o" +// CHECK030: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" +// CHECK030: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Defaults for C++ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clangxx -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK012 %s -// CHECK012: "-cc1" -// CHECK012-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK012-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK012-NOT: "-static" -// CHECK012-NOT: "-shared" -// CHECK012: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK012: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK012: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK012: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK012: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK012: "-L{{.*}}/lib/gcc" -// CHECK012: "-L{{.*}}/hexagon/lib/v4" -// CHECK012: "-L{{.*}}/hexagon/lib" -// CHECK012: "{{[^"]+}}.o" -// CHECK012: "-lstdc++" "-lm" -// CHECK012: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" -// CHECK012: "{{.*}}/hexagon/lib/v4/fini.o" +// RUN: %clangxx -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ +// RUN: %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK031 %s +// CHECK031: "-cc1" +// CHECK031-NEXT: hexagon-link +// CHECK031-NOT: "-static" +// CHECK031-NOT: "-shared" +// CHECK031: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" +// CHECK031: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o" +// CHECK031: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o" +// CHECK031: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK031: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK031: "{{[^"]+}}.o" +// CHECK031: "-lstdc++" "-lm" +// CHECK031: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" +// CHECK031: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Additional Libraries (-L) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -Lone -L two -L three \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK013 %s -// CHECK013: "-cc1" -// CHECK013-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK013-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK013: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK013: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK013: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK013: "-Lone" "-Ltwo" "-Lthree" -// CHECK013: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK013: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK013: "-L{{.*}}/lib/gcc" -// CHECK013: "-L{{.*}}/hexagon/lib/v4" -// CHECK013: "-L{{.*}}/hexagon/lib" -// CHECK013: "{{[^"]+}}.o" -// CHECK013: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" -// CHECK013: "{{.*}}/hexagon/lib/v4/fini.o" +// RUN: | FileCheck -check-prefix=CHECK032 %s +// CHECK032: "-cc1" +// CHECK032-NEXT: hexagon-link +// CHECK032-NOT: "-static" +// CHECK032-NOT: "-shared" +// CHECK032: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" +// CHECK032: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o" +// CHECK032: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o" +// CHECK032: "-Lone" "-Ltwo" "-Lthree" +// CHECK032: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK032: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK032: "{{[^"]+}}.o" +// CHECK032: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" +// CHECK032: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // -static, -shared // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -static \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK014 %s -// CHECK014: "-cc1" -// CHECK014-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK014-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK014: "-static" -// CHECK014: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK014: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK014: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK014: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK014: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK014: "-L{{.*}}/lib/gcc" -// CHECK014: "-L{{.*}}/hexagon/lib/v4" -// CHECK014: "-L{{.*}}/hexagon/lib" -// CHECK014: "{{[^"]+}}.o" -// CHECK014: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" -// CHECK014: "{{.*}}/hexagon/lib/v4/fini.o" - -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck -check-prefix=CHECK033 %s +// CHECK033: "-cc1" +// CHECK033-NEXT: hexagon-link +// CHECK033: "-static" +// CHECK033: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" +// CHECK033: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o" +// CHECK033: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o" +// CHECK033: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK033: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK033: "{{[^"]+}}.o" +// CHECK033: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" +// CHECK033: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o" + +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -shared \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK015 %s -// CHECK015: "-cc1" -// CHECK015-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK015-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK015: "-shared" "-call_shared" -// CHECK015-NOT: crt0_standalone.o -// CHECK015-NOT: crt0.o -// CHECK015: "{{.*}}/hexagon/lib/v4/G0/initS.o" -// CHECK015: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4/G0" -// CHECK015: "-L{{.*}}/lib/gcc/hexagon/4.4.0/G0" -// CHECK015: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK015: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK015: "-L{{.*}}/lib/gcc" -// CHECK015: "-L{{.*}}/hexagon/lib/v4/G0" -// CHECK015: "-L{{.*}}/hexagon/lib/G0" -// CHECK015: "-L{{.*}}/hexagon/lib/v4" -// CHECK015: "-L{{.*}}/hexagon/lib" -// CHECK015: "{{[^"]+}}.o" -// CHECK015: "--start-group" -// CHECK015-NOT: "-lstandalone" -// CHECK015-NOT: "-lc" -// CHECK015: "-lgcc" -// CHECK015: "--end-group" -// CHECK015: "{{.*}}/hexagon/lib/v4/G0/finiS.o" - -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck -check-prefix=CHECK034 %s +// CHECK034: "-cc1" +// CHECK034-NEXT: hexagon-link +// CHECK034: "-shared" "-call_shared" +// CHECK034-NOT: crt0_standalone.o +// CHECK034-NOT: crt0.o +// CHECK034: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/pic/initS.o" +// CHECK034: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0" +// CHECK034: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK034: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK034: "{{[^"]+}}.o" +// CHECK034: "--start-group" +// CHECK034-NOT: "-lstandalone" +// CHECK034-NOT: "-lc" +// CHECK034: "-lgcc" +// CHECK034: "--end-group" +// CHECK034: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/pic/finiS.o" + +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -shared \ // RUN: -static \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK016 %s -// CHECK016: "-cc1" -// CHECK016-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK016-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK016: "-shared" "-call_shared" "-static" -// CHECK016-NOT: crt0_standalone.o -// CHECK016-NOT: crt0.o -// CHECK016: "{{.*}}/hexagon/lib/v4/G0/init.o" -// CHECK016: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4/G0" -// CHECK016: "-L{{.*}}/lib/gcc/hexagon/4.4.0/G0" -// CHECK016: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK016: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK016: "-L{{.*}}/lib/gcc" -// CHECK016: "-L{{.*}}/hexagon/lib/v4/G0" -// CHECK016: "-L{{.*}}/hexagon/lib/G0" -// CHECK016: "-L{{.*}}/hexagon/lib/v4" -// CHECK016: "-L{{.*}}/hexagon/lib" -// CHECK016: "{{[^"]+}}.o" -// CHECK016: "--start-group" -// CHECK016-NOT: "-lstandalone" -// CHECK016-NOT: "-lc" -// CHECK016: "-lgcc" -// CHECK016: "--end-group" -// CHECK016: "{{.*}}/hexagon/lib/v4/G0/fini.o" +// RUN: | FileCheck -check-prefix=CHECK035 %s +// CHECK035: "-cc1" +// CHECK035-NEXT: hexagon-link +// CHECK035: "-shared" "-call_shared" "-static" +// CHECK035-NOT: crt0_standalone.o +// CHECK035-NOT: crt0.o +// CHECK035: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/init.o" +// CHECK035: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0" +// CHECK035: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK035: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK035: "{{[^"]+}}.o" +// CHECK035: "--start-group" +// CHECK035-NOT: "-lstandalone" +// CHECK035-NOT: "-lc" +// CHECK035: "-lgcc" +// CHECK035: "--end-group" +// CHECK035: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/G0/fini.o" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // -nostdlib, -nostartfiles, -nodefaultlibs // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clangxx -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clangxx -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -nostdlib \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK017 %s -// CHECK017: "-cc1" -// CHECK017-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK017-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK017-NOT: crt0_standalone.o -// CHECK017-NOT: crt0.o -// CHECK017-NOT: init.o -// CHECK017: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK017: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK017: "-L{{.*}}/lib/gcc" -// CHECK017: "-L{{.*}}/hexagon/lib/v4" -// CHECK017: "-L{{.*}}/hexagon/lib" -// CHECK017: "{{[^"]+}}.o" -// CHECK017-NOT: "-lstdc++" -// CHECK017-NOT: "-lm" -// CHECK017-NOT: "--start-group" -// CHECK017-NOT: "-lstandalone" -// CHECK017-NOT: "-lc" -// CHECK017-NOT: "-lgcc" -// CHECK017-NOT: "--end-group" -// CHECK017-NOT: fini.o - -// RUN: %clangxx -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck -check-prefix=CHECK036 %s +// CHECK036: "-cc1" +// CHECK036-NEXT: hexagon-link +// CHECK036-NOT: crt0_standalone.o +// CHECK036-NOT: crt0.o +// CHECK036-NOT: init.o +// CHECK036: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK036: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK036: "{{[^"]+}}.o" +// CHECK036-NOT: "-lstdc++" +// CHECK036-NOT: "-lm" +// CHECK036-NOT: "--start-group" +// CHECK036-NOT: "-lstandalone" +// CHECK036-NOT: "-lc" +// CHECK036-NOT: "-lgcc" +// CHECK036-NOT: "--end-group" +// CHECK036-NOT: fini.o + +// RUN: %clangxx -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -nostartfiles \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK018 %s -// CHECK018: "-cc1" -// CHECK018-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK018-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK018-NOT: crt0_standalone.o -// CHECK018-NOT: crt0.o -// CHECK018-NOT: init.o -// CHECK018: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK018: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK018: "-L{{.*}}/lib/gcc" -// CHECK018: "-L{{.*}}/hexagon/lib/v4" -// CHECK018: "-L{{.*}}/hexagon/lib" -// CHECK018: "{{[^"]+}}.o" -// CHECK018: "-lstdc++" -// CHECK018: "-lm" -// CHECK018: "--start-group" -// CHECK018: "-lstandalone" -// CHECK018: "-lc" -// CHECK018: "-lgcc" -// CHECK018: "--end-group" -// CHECK018-NOT: fini.o - -// RUN: %clangxx -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck -check-prefix=CHECK037 %s +// CHECK037: "-cc1" +// CHECK037-NEXT: hexagon-link +// CHECK037-NOT: crt0_standalone.o +// CHECK037-NOT: crt0.o +// CHECK037-NOT: init.o +// CHECK037: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK037: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK037: "{{[^"]+}}.o" +// CHECK037: "-lstdc++" +// CHECK037: "-lm" +// CHECK037: "--start-group" +// CHECK037: "-lstandalone" +// CHECK037: "-lc" +// CHECK037: "-lgcc" +// CHECK037: "--end-group" +// CHECK037-NOT: fini.o + +// RUN: %clangxx -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -nodefaultlibs \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK019 %s -// CHECK019: "-cc1" -// CHECK019-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK019-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK019: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK019: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK019: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK019: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK019: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK019: "-L{{.*}}/lib/gcc" -// CHECK019: "-L{{.*}}/hexagon/lib/v4" -// CHECK019: "-L{{.*}}/hexagon/lib" -// CHECK019: "{{[^"]+}}.o" -// CHECK019-NOT: "-lstdc++" -// CHECK019-NOT: "-lm" -// CHECK019-NOT: "--start-group" -// CHECK019-NOT: "-lstandalone" -// CHECK019-NOT: "-lc" -// CHECK019-NOT: "-lgcc" -// CHECK019-NOT: "--end-group" -// CHECK019: "{{.*}}/hexagon/lib/v4/fini.o" +// RUN: | FileCheck -check-prefix=CHECK038 %s +// CHECK038: "-cc1" +// CHECK038-NEXT: hexagon-link +// CHECK038: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" +// CHECK038: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o" +// CHECK038: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o" +// CHECK038: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK038: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK038: "{{[^"]+}}.o" +// CHECK038-NOT: "-lstdc++" +// CHECK038-NOT: "-lm" +// CHECK038-NOT: "--start-group" +// CHECK038-NOT: "-lstandalone" +// CHECK038-NOT: "-lc" +// CHECK038-NOT: "-lgcc" +// CHECK038-NOT: "--end-group" +// CHECK038: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // -moslib // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -moslib=first -moslib=second \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK020 %s -// CHECK020: "-cc1" -// CHECK020-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK020-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK020-NOT: "-static" -// CHECK020-NOT: "-shared" -// CHECK020-NOT: crt0_standalone.o -// CHECK020: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK020: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK020: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK020: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK020: "-L{{.*}}/lib/gcc" -// CHECK020: "-L{{.*}}/hexagon/lib/v4" -// CHECK020: "-L{{.*}}/hexagon/lib" -// CHECK020: "{{[^"]+}}.o" -// CHECK020: "--start-group" -// CHECK020: "-lfirst" "-lsecond" -// CHECK020-NOT: "-lstandalone" -// CHECK020: "-lc" "-lgcc" "--end-group" -// CHECK020: "{{.*}}/hexagon/lib/v4/fini.o" - -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -moslib=first -moslib=second -moslib=standalone\ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK021 %s -// CHECK021: "-cc1" -// CHECK021-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK021-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK021-NOT: "-static" -// CHECK021-NOT: "-shared" -// CHECK021: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK021: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK021: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK021: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK021: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK021: "-L{{.*}}/lib/gcc" -// CHECK021: "-L{{.*}}/hexagon/lib/v4" -// CHECK021: "-L{{.*}}/hexagon/lib" -// CHECK021: "{{[^"]+}}.o" -// CHECK021: "--start-group" -// CHECK021: "-lfirst" "-lsecond" -// CHECK021: "-lstandalone" -// CHECK021: "-lc" "-lgcc" "--end-group" -// CHECK021: "{{.*}}/hexagon/lib/v4/fini.o" +// RUN: | FileCheck -check-prefix=CHECK039 %s +// CHECK039: "-cc1" +// CHECK039-NEXT: hexagon-link +// CHECK039-NOT: "-static" +// CHECK039-NOT: "-shared" +// CHECK039-NOT: crt0_standalone.o +// CHECK039: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o" +// CHECK039: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o" +// CHECK039: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK039: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK039: "{{[^"]+}}.o" +// CHECK039: "--start-group" +// CHECK039: "-lfirst" "-lsecond" +// CHECK039-NOT: "-lstandalone" +// CHECK039: "-lc" "-lgcc" "--end-group" +// CHECK039: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o" + +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ +// RUN: -moslib=first -moslib=second -moslib=standalone \ +// RUN: %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK03A %s +// CHECK03A: "-cc1" +// CHECK03A-NEXT: hexagon-link +// CHECK03A-NOT: "-static" +// CHECK03A-NOT: "-shared" +// CHECK03A: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" +// CHECK03A: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o" +// CHECK03A: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o" +// CHECK03A: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK03A: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK03A: "{{[^"]+}}.o" +// CHECK03A: "--start-group" +// CHECK03A: "-lfirst" "-lsecond" +// CHECK03A: "-lstandalone" +// CHECK03A: "-lc" "-lgcc" "--end-group" +// CHECK03A: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Other args to pass to linker // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clangxx -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clangxx -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -s \ // RUN: -Tbss 0xdead -Tdata 0xbeef -Ttext 0xcafe \ // RUN: -t \ // RUN: -e start_here \ // RUN: -uFoo -undefined Bar \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK022 %s -// CHECK022: "-cc1" -// CHECK022-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK022-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK022: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK022: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK022: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK022: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK022: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK022: "-L{{.*}}/lib/gcc" -// CHECK022: "-L{{.*}}/hexagon/lib/v4" -// CHECK022: "-L{{.*}}/hexagon/lib" -// CHECK022: "-Tbss" "0xdead" "-Tdata" "0xbeef" "-Ttext" "0xcafe" -// CHECK022: "-s" -// CHECK022: "-t" -// CHECK022: "-u" "Foo" "-undefined" "Bar" -// CHECK022: "{{[^"]+}}.o" -// CHECK022: "-lstdc++" "-lm" -// CHECK022: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" -// CHECK022: "{{.*}}/hexagon/lib/v4/fini.o" +// RUN: | FileCheck -check-prefix=CHECK03B %s +// CHECK03B: "-cc1" +// CHECK03B-NEXT: hexagon-link +// CHECK03B: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" +// CHECK03B: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0.o" +// CHECK03B: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/init.o" +// CHECK03B: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60" +// CHECK03B: "-L{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib" +// CHECK03B: "-s" +// CHECK03B: "-Tbss" "0xdead" "-Tdata" "0xbeef" "-Ttext" "0xcafe" +// CHECK03B: "-t" +// CHECK03B: "-u" "Foo" "-undefined" "Bar" +// CHECK03B: "{{[^"]+}}.o" +// CHECK03B: "-lstdc++" "-lm" +// CHECK03B: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" +// CHECK03B: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/fini.o" // ----------------------------------------------------------------------------- // pic, small data threshold // ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK023 %s -// CHECK023: "-cc1" -// CHECK023: "-mrelocation-model" "static" -// CHECK023-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK023-NOT: "-G{{[0-9]+}}" -// CHECK023-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK023-NOT: "-G{{[0-9]+}}" - -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ +// RUN: %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK040 %s +// CHECK040: "-cc1" +// CHECK040-NEXT: hexagon-link +// CHECK040-NOT: "-G{{[0-9]+}}" + +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -fpic \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK024 %s -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck -check-prefix=CHECK041 %s +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -fPIC \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK024 %s -// CHECK024: "-cc1" -// CHECK024-NOT: "-mrelocation-model" "static" -// CHECK024: "-pic-level" "{{[12]}}" -// CHECK024: "-mllvm" "-hexagon-small-data-threshold=0" -// CHECK024-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK024: "-G0" -// CHECK024-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK024: "-G0" - -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck -check-prefix=CHECK041 %s +// CHECK041: "-cc1" +// CHECK041-NOT: "-mrelocation-model" "static" +// CHECK041: "-pic-level" "{{[12]}}" +// CHECK041: "-mllvm" "-hexagon-small-data-threshold=0" +// CHECK041-NEXT: hexagon-link +// CHECK041: "-G0" + +// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -G=8 \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK025 %s -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck -check-prefix=CHECK042 %s +// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -G 8 \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK025 %s -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck -check-prefix=CHECK042 %s +// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -msmall-data-threshold=8 \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK025 %s -// CHECK025: "-cc1" -// CHECK025: "-mrelocation-model" "static" -// CHECK025: "-mllvm" "-hexagon-small-data-threshold=8" -// CHECK025-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK025: "-G8" -// CHECK025-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK025: "-G8" +// RUN: | FileCheck -check-prefix=CHECK042 %s +// CHECK042: "-cc1" +// CHECK042: "-mrelocation-model" "static" +// CHECK042: "-mllvm" "-hexagon-small-data-threshold=8" +// CHECK042-NEXT: llvm-mc +// CHECK042: "-gpsize=8" +// CHECK042-NEXT: hexagon-link +// CHECK042: "-G8" // ----------------------------------------------------------------------------- // pie // ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -pie \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK026 %s -// CHECK026: "-cc1" -// CHECK026-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK026-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK026: "-pie" +// RUN: | FileCheck -check-prefix=CHECK050 %s +// CHECK050: "-cc1" +// CHECK050-NEXT: hexagon-link +// CHECK050: "-pie" -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -pie -shared \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK027 %s -// CHECK027: "-cc1" -// CHECK027-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK027-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK027-NOT: "-pie" - -// ----------------------------------------------------------------------------- -// Misc Defaults -// ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK028 %s -// CHECK028: "-cc1" -// CHECK028: "-mqdsp6-compat" -// CHECK028: "-Wreturn-type" -// CHECK028-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK028-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" +// RUN: | FileCheck -check-prefix=CHECK051 %s +// CHECK051: "-cc1" +// CHECK051-NEXT: hexagon-link +// CHECK051-NOT: "-pie" // ----------------------------------------------------------------------------- // Test Assembler related args // ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ +// RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ // RUN: -gdwarf-2 \ // RUN: -Wa,--noexecstack,--trap \ // RUN: -Xassembler --keep-locals \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK029 %s -// CHECK029: "-cc1" -// CHECK029-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK029: "--noexecstack" "--trap" "--keep-locals" -// CHECK029-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" +// RUN: | FileCheck -check-prefix=CHECK060 %s +// CHECK060: "-cc1" +// CHECK060-NEXT: llvm-mc +// CHECK060: "--noexecstack" "--trap" "--keep-locals" +// CHECK060-NEXT: hexagon-link + +// ----------------------------------------------------------------------------- +// Misc Defaults +// ----------------------------------------------------------------------------- +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv60 \ +// RUN: %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK070 %s +// CHECK070: "-cc1" +// CHECK070: "-Wreturn-type" diff --git a/test/Driver/hexagon-toolchain.c b/test/Driver/hexagon-toolchain.c deleted file mode 100644 index 5d9553e..0000000 --- a/test/Driver/hexagon-toolchain.c +++ /dev/null @@ -1,588 +0,0 @@ -// ----------------------------------------------------------------------------- -// Test standard include paths -// ----------------------------------------------------------------------------- - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK001 %s -// CHECK001: "-cc1" {{.*}} "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include" -// CHECK001: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include-fixed" -// CHECK001: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include" -// CHECK001-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" - -// RUN: %clangxx -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK002 %s -// CHECK002: "-cc1" {{.*}} "-internal-isystem" "[[INSTALL_DIR:.*]]/Inputs/hexagon_tree/qc/bin/../../gnu{{/|\\\\}}hexagon/include/c++/4.4.0" -// CHECK002: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include" -// CHECK002: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include-fixed" -// CHECK002: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include" -// CHECK002-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" - -// ----------------------------------------------------------------------------- -// Test -nostdinc, -nostdlibinc, -nostdinc++ -// ----------------------------------------------------------------------------- - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -nostdinc \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK003 %s -// CHECK003: "-cc1" -// CHECK003-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include" -// CHECK003-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include-fixed" -// CHECK003-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include" -// CHECK003-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -nostdlibinc \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK004 %s -// CHECK004: "-cc1" -// CHECK004-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include" -// CHECK004-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include-fixed" -// CHECK004-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include" -// CHECK004-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" - -// RUN: %clangxx -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -nostdlibinc \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK005 %s -// CHECK005: "-cc1" -// CHECK005-NOT: "-internal-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include/c++/4.4.0" -// CHECK005-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include" -// CHECK005-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/lib/gcc/hexagon/4.4.0/include-fixed" -// CHECK005-NOT: "-internal-externc-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include" -// CHECK005-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" - -// RUN: %clangxx -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -nostdinc++ \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK006 %s -// CHECK006: "-cc1" -// CHECK006-NOT: "-internal-isystem" "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/hexagon/include/c++/4.4.0" -// CHECK006-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as" - -// ----------------------------------------------------------------------------- -// Test -march=<archname> -mcpu=<archname> -mv<number> -// ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -march=hexagonv3 \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK007 %s -// CHECK007: "-cc1" {{.*}} "-target-cpu" "hexagonv3" -// CHECK007-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as"{{.*}} "-march=v3" -// CHECK007-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-ld"{{.*}} "-mv3" - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -mcpu=hexagonv5 \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK008 %s -// CHECK008: "-cc1" {{.*}} "-target-cpu" "hexagonv5" -// CHECK008-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as"{{.*}} "-march=v5" -// CHECK008-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-ld"{{.*}} "-mv5" - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -mv2 \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK009 %s -// CHECK009: "-cc1" {{.*}} "-target-cpu" "hexagonv2" -// CHECK009-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as"{{.*}} "-march=v2" -// CHECK009-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-ld"{{.*}} "-mv2" - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK010 %s -// CHECK010: "-cc1" {{.*}} "-target-cpu" "hexagonv4" -// CHECK010-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-as"{{.*}} "-march=v4" -// CHECK010-NEXT: "{{.*}}/Inputs/hexagon_tree/qc/bin/../../gnu/bin{{/|\\\\}}hexagon-ld"{{.*}} "-mv4" - -// RUN: not %clang -march=hexagonv2 -target hexagon-unknown-linux \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V2 %s -// RUN: not %clang -mcpu=hexagonv2 -target hexagon-unknown-linux \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V2 %s -// RUN: not %clang -mv2 -target hexagon-unknown-linux \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V2 %s -// CHECK-UNKNOWN-V2: error: unknown target CPU 'hexagonv2' - -// RUN: not %clang -march=hexagonv3 -target hexagon-unknown-linux \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V3 %s -// RUN: not %clang -mcpu=hexagonv3 -target hexagon-unknown-linux \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V3 %s -// RUN: not %clang -mv3 -target hexagon-unknown-linux \ -// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-V3 %s -// CHECK-UNKNOWN-V3: error: unknown target CPU 'hexagonv3' - -// ----------------------------------------------------------------------------- -// Test Linker related args -// ----------------------------------------------------------------------------- - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Defaults for C -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK011 %s -// CHECK011: "-cc1" -// CHECK011-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK011-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK011-NOT: "-static" -// CHECK011-NOT: "-shared" -// CHECK011: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK011: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK011: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK011: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK011: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK011: "-L{{.*}}/lib/gcc" -// CHECK011: "-L{{.*}}/hexagon/lib/v4" -// CHECK011: "-L{{.*}}/hexagon/lib" -// CHECK011: "{{[^"]+}}.o" -// CHECK011: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" -// CHECK011: "{{.*}}/hexagon/lib/v4/fini.o" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Defaults for C++ -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clangxx -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK012 %s -// CHECK012: "-cc1" -// CHECK012-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK012-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK012-NOT: "-static" -// CHECK012-NOT: "-shared" -// CHECK012: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK012: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK012: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK012: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK012: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK012: "-L{{.*}}/lib/gcc" -// CHECK012: "-L{{.*}}/hexagon/lib/v4" -// CHECK012: "-L{{.*}}/hexagon/lib" -// CHECK012: "{{[^"]+}}.o" -// CHECK012: "-lstdc++" "-lm" -// CHECK012: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" -// CHECK012: "{{.*}}/hexagon/lib/v4/fini.o" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Additional Libraries (-L) -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -Lone -L two -L three \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK013 %s -// CHECK013: "-cc1" -// CHECK013-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK013-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK013: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK013: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK013: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK013: "-Lone" "-Ltwo" "-Lthree" -// CHECK013: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK013: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK013: "-L{{.*}}/lib/gcc" -// CHECK013: "-L{{.*}}/hexagon/lib/v4" -// CHECK013: "-L{{.*}}/hexagon/lib" -// CHECK013: "{{[^"]+}}.o" -// CHECK013: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" -// CHECK013: "{{.*}}/hexagon/lib/v4/fini.o" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// -static, -shared -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -static \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK014 %s -// CHECK014: "-cc1" -// CHECK014-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK014-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK014: "-static" -// CHECK014: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK014: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK014: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK014: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK014: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK014: "-L{{.*}}/lib/gcc" -// CHECK014: "-L{{.*}}/hexagon/lib/v4" -// CHECK014: "-L{{.*}}/hexagon/lib" -// CHECK014: "{{[^"]+}}.o" -// CHECK014: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" -// CHECK014: "{{.*}}/hexagon/lib/v4/fini.o" - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -shared \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK015 %s -// CHECK015: "-cc1" -// CHECK015-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK015-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK015: "-shared" "-call_shared" -// CHECK015-NOT: crt0_standalone.o -// CHECK015-NOT: crt0.o -// CHECK015: "{{.*}}/hexagon/lib/v4/G0/initS.o" -// CHECK015: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4/G0" -// CHECK015: "-L{{.*}}/lib/gcc/hexagon/4.4.0/G0" -// CHECK015: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK015: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK015: "-L{{.*}}/lib/gcc" -// CHECK015: "-L{{.*}}/hexagon/lib/v4/G0" -// CHECK015: "-L{{.*}}/hexagon/lib/G0" -// CHECK015: "-L{{.*}}/hexagon/lib/v4" -// CHECK015: "-L{{.*}}/hexagon/lib" -// CHECK015: "{{[^"]+}}.o" -// CHECK015: "--start-group" -// CHECK015-NOT: "-lstandalone" -// CHECK015-NOT: "-lc" -// CHECK015: "-lgcc" -// CHECK015: "--end-group" -// CHECK015: "{{.*}}/hexagon/lib/v4/G0/finiS.o" - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -shared \ -// RUN: -static \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK016 %s -// CHECK016: "-cc1" -// CHECK016-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK016-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK016: "-shared" "-call_shared" "-static" -// CHECK016-NOT: crt0_standalone.o -// CHECK016-NOT: crt0.o -// CHECK016: "{{.*}}/hexagon/lib/v4/G0/init.o" -// CHECK016: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4/G0" -// CHECK016: "-L{{.*}}/lib/gcc/hexagon/4.4.0/G0" -// CHECK016: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK016: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK016: "-L{{.*}}/lib/gcc" -// CHECK016: "-L{{.*}}/hexagon/lib/v4/G0" -// CHECK016: "-L{{.*}}/hexagon/lib/G0" -// CHECK016: "-L{{.*}}/hexagon/lib/v4" -// CHECK016: "-L{{.*}}/hexagon/lib" -// CHECK016: "{{[^"]+}}.o" -// CHECK016: "--start-group" -// CHECK016-NOT: "-lstandalone" -// CHECK016-NOT: "-lc" -// CHECK016: "-lgcc" -// CHECK016: "--end-group" -// CHECK016: "{{.*}}/hexagon/lib/v4/G0/fini.o" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// -nostdlib, -nostartfiles, -nodefaultlibs -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clangxx -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -nostdlib \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK017 %s -// CHECK017: "-cc1" -// CHECK017-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK017-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK017-NOT: crt0_standalone.o -// CHECK017-NOT: crt0.o -// CHECK017-NOT: init.o -// CHECK017: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK017: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK017: "-L{{.*}}/lib/gcc" -// CHECK017: "-L{{.*}}/hexagon/lib/v4" -// CHECK017: "-L{{.*}}/hexagon/lib" -// CHECK017: "{{[^"]+}}.o" -// CHECK017-NOT: "-lstdc++" -// CHECK017-NOT: "-lm" -// CHECK017-NOT: "--start-group" -// CHECK017-NOT: "-lstandalone" -// CHECK017-NOT: "-lc" -// CHECK017-NOT: "-lgcc" -// CHECK017-NOT: "--end-group" -// CHECK017-NOT: fini.o - -// RUN: %clangxx -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -nostartfiles \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK018 %s -// CHECK018: "-cc1" -// CHECK018-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK018-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK018-NOT: crt0_standalone.o -// CHECK018-NOT: crt0.o -// CHECK018-NOT: init.o -// CHECK018: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK018: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK018: "-L{{.*}}/lib/gcc" -// CHECK018: "-L{{.*}}/hexagon/lib/v4" -// CHECK018: "-L{{.*}}/hexagon/lib" -// CHECK018: "{{[^"]+}}.o" -// CHECK018: "-lstdc++" -// CHECK018: "-lm" -// CHECK018: "--start-group" -// CHECK018: "-lstandalone" -// CHECK018: "-lc" -// CHECK018: "-lgcc" -// CHECK018: "--end-group" -// CHECK018-NOT: fini.o - -// RUN: %clangxx -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -nodefaultlibs \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK019 %s -// CHECK019: "-cc1" -// CHECK019-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK019-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK019: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK019: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK019: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK019: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK019: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK019: "-L{{.*}}/lib/gcc" -// CHECK019: "-L{{.*}}/hexagon/lib/v4" -// CHECK019: "-L{{.*}}/hexagon/lib" -// CHECK019: "{{[^"]+}}.o" -// CHECK019-NOT: "-lstdc++" -// CHECK019-NOT: "-lm" -// CHECK019-NOT: "--start-group" -// CHECK019-NOT: "-lstandalone" -// CHECK019-NOT: "-lc" -// CHECK019-NOT: "-lgcc" -// CHECK019-NOT: "--end-group" -// CHECK019: "{{.*}}/hexagon/lib/v4/fini.o" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// -moslib -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -moslib=first -moslib=second \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK020 %s -// CHECK020: "-cc1" -// CHECK020-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK020-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK020-NOT: "-static" -// CHECK020-NOT: "-shared" -// CHECK020-NOT: crt0_standalone.o -// CHECK020: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK020: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK020: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK020: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK020: "-L{{.*}}/lib/gcc" -// CHECK020: "-L{{.*}}/hexagon/lib/v4" -// CHECK020: "-L{{.*}}/hexagon/lib" -// CHECK020: "{{[^"]+}}.o" -// CHECK020: "--start-group" -// CHECK020: "-lfirst" "-lsecond" -// CHECK020-NOT: "-lstandalone" -// CHECK020: "-lc" "-lgcc" "--end-group" -// CHECK020: "{{.*}}/hexagon/lib/v4/fini.o" - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -moslib=first -moslib=second -moslib=standalone\ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK021 %s -// CHECK021: "-cc1" -// CHECK021-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK021-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK021-NOT: "-static" -// CHECK021-NOT: "-shared" -// CHECK021: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK021: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK021: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK021: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK021: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK021: "-L{{.*}}/lib/gcc" -// CHECK021: "-L{{.*}}/hexagon/lib/v4" -// CHECK021: "-L{{.*}}/hexagon/lib" -// CHECK021: "{{[^"]+}}.o" -// CHECK021: "--start-group" -// CHECK021: "-lfirst" "-lsecond" -// CHECK021: "-lstandalone" -// CHECK021: "-lc" "-lgcc" "--end-group" -// CHECK021: "{{.*}}/hexagon/lib/v4/fini.o" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Other args to pass to linker -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// RUN: %clangxx -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -s \ -// RUN: -Tbss 0xdead -Tdata 0xbeef -Ttext 0xcafe \ -// RUN: -t \ -// RUN: -e start_here \ -// RUN: -uFoo -undefined Bar \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK022 %s -// CHECK022: "-cc1" -// CHECK022-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as"{{.*}} -// CHECK022-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK022: "{{.*}}/hexagon/lib/v4/crt0_standalone.o" -// CHECK022: "{{.*}}/hexagon/lib/v4/crt0.o" -// CHECK022: "{{.*}}/hexagon/lib/v4/init.o" -// CHECK022: "-L{{.*}}/lib/gcc/hexagon/4.4.0/v4" -// CHECK022: "-L{{.*}}/lib/gcc/hexagon/4.4.0" -// CHECK022: "-L{{.*}}/lib/gcc" -// CHECK022: "-L{{.*}}/hexagon/lib/v4" -// CHECK022: "-L{{.*}}/hexagon/lib" -// CHECK022: "-Tbss" "0xdead" "-Tdata" "0xbeef" "-Ttext" "0xcafe" -// CHECK022: "-s" -// CHECK022: "-t" -// CHECK022: "-u" "Foo" "-undefined" "Bar" -// CHECK022: "{{[^"]+}}.o" -// CHECK022: "-lstdc++" "-lm" -// CHECK022: "--start-group" "-lstandalone" "-lc" "-lgcc" "--end-group" -// CHECK022: "{{.*}}/hexagon/lib/v4/fini.o" - -// ----------------------------------------------------------------------------- -// pic, small data threshold -// ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK023 %s -// CHECK023: "-cc1" -// CHECK023: "-mrelocation-model" "static" -// CHECK023-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK023-NOT: "-G{{[0-9]+}}" -// CHECK023-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK023-NOT: "-G{{[0-9]+}}" - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -fpic \ -// RUN: %s 2>&1 \ -// RUN: | sed -e "s/\.exe//" -e "s/\.EXE//" | FileCheck -check-prefix=CHECK024 %s -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -fPIC \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK024 %s -// CHECK024: "-cc1" -// CHECK024-NOT: "-mrelocation-model" "static" -// CHECK024: "-pic-level" "{{[12]}}" -// CHECK024: "-mllvm" "-hexagon-small-data-threshold=0" -// CHECK024-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK024: "-G0" -// CHECK024-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK024: "-G0" - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -G=8 \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK025 %s -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -G 8 \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK025 %s -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -msmall-data-threshold=8 \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK025 %s -// CHECK025: "-cc1" -// CHECK025: "-mrelocation-model" "static" -// CHECK025: "-mllvm" "-hexagon-small-data-threshold=8" -// CHECK025-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK025: "-G8" -// CHECK025-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK025: "-G8" - -// ----------------------------------------------------------------------------- -// pie -// ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -pie \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK026 %s -// CHECK026: "-cc1" -// CHECK026-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK026-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK026: "-pie" - -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -pie -shared \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK027 %s -// CHECK027: "-cc1" -// CHECK027-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK027-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" -// CHECK027-NOT: "-pie" - -// ----------------------------------------------------------------------------- -// Misc Defaults -// ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK028 %s -// CHECK028: "-cc1" -// CHECK028: "-mqdsp6-compat" -// CHECK028: "-Wreturn-type" -// CHECK028-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK028-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" - -// ----------------------------------------------------------------------------- -// Test Assembler related args -// ----------------------------------------------------------------------------- -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -gdwarf-2 \ -// RUN: -Wa,--noexecstack,--trap \ -// RUN: -Xassembler --keep-locals \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK029 %s -// CHECK029: "-cc1" -// CHECK029-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-as" -// CHECK029: "--noexecstack" "--trap" "--keep-locals" -// CHECK029-NEXT: "{{.*}}/bin{{/|\\\\}}hexagon-ld" diff --git a/test/Driver/implicit-function-as-error.c b/test/Driver/implicit-function-as-error.c index 5949e20..d630996 100644 --- a/test/Driver/implicit-function-as-error.c +++ b/test/Driver/implicit-function-as-error.c @@ -1,9 +1,11 @@ // RUN: %clang -target x86_64-apple-darwin -mios-simulator-version-min=7 -fsyntax-only %s -Xclang -verify // RUN: %clang -target x86_64-apple-darwin -arch arm64 -target x86_64-apple-darwin -mios-version-min=7 -fsyntax-only %s -Xclang -verify +// RUN: %clang -target armv7k-apple-watchos -arch armv7k -target armv7k-apple-watchos -fsyntax-only %s -Xclang -verify // For 64-bit iOS, automatically promote -Wimplicit-function-declaration // to an error. void radar_10894044() { + printf("Hi\n"); // expected-error {{implicitly declaring library function 'printf' with type 'int (const char *, ...)'}} expected-note {{include the header <stdio.h> or explicitly provide a declaration for 'printf'}} radar_10894044_not_declared(); // expected-error {{implicit declaration of function 'radar_10894044_not_declared' is invalid in C99}} } diff --git a/test/Driver/incremental-linker-compatible.c b/test/Driver/incremental-linker-compatible.c new file mode 100644 index 0000000..e702a01 --- /dev/null +++ b/test/Driver/incremental-linker-compatible.c @@ -0,0 +1,17 @@ +// RUN: %clang '-###' %s -c -o tmp.o -target i686-pc-linux-gnu -integrated-as -mincremental-linker-compatible 2>&1 | FileCheck %s --check-prefix=TEST1 +// TEST1: "-cc1" {{.*}} "-mincremental-linker-compatible" + +// RUN: %clang '-###' %s -c -o tmp.o -target i686-pc-linux-gnu -integrated-as -mno-incremental-linker-compatible 2>&1 | FileCheck %s --check-prefix=TEST2 +// TEST2-NOT: "-cc1" {{.*}} "-mincremental-linker-compatible" + +// RUN: %clang '-###' %s -c -o tmp.o -target i686-pc-linux-gnu -integrated-as -mno-incremental-linker-compatible -mincremental-linker-compatible 2>&1 | FileCheck %s --check-prefix=TEST3 +// TEST3: "-cc1" {{.*}} "-mincremental-linker-compatible" + +// RUN: %clang '-###' %s -c -o tmp.o -target i686-pc-linux-gnu -integrated-as -mincremental-linker-compatible -mno-incremental-linker-compatible 2>&1 | FileCheck %s --check-prefix=TEST4 +// TEST4-NOT: "-cc1" {{.*}} "-mincremental-linker-compatible" + +// RUN: %clang '-###' %s -c -o tmp.o -target i686-pc-mingw32 -integrated-as 2>&1 | FileCheck %s --check-prefix=TEST5 +// TEST5-NOT: "-cc1" {{.*}} "-mincremental-linker-compatible" + +// RUN: %clang '-###' %s -c -o tmp.o -target i686-pc-win32 -integrated-as 2>&1 | FileCheck %s --check-prefix=TEST6 +// TEST6: "-cc1" {{.*}} "-mincremental-linker-compatible" diff --git a/test/Driver/instrprof-ld.c b/test/Driver/instrprof-ld.c index cd926cd..b3ba12e 100644 --- a/test/Driver/instrprof-ld.c +++ b/test/Driver/instrprof-ld.c @@ -89,3 +89,19 @@ // // CHECK-DARWIN-ARM64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-DARWIN-ARM64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_ios.a" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target armv7-apple-darwin -mtvos-version-min=8.3 -fprofile-instr-generate \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=CHECK-TVOS-ARMV7 %s +// +// CHECK-TVOS-ARMV7: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-TVOS-ARMV7: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_tvos.a" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target armv7s-apple-darwin10 -mwatchos-version-min=2.0 -arch armv7k -fprofile-instr-generate \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=CHECK-WATCHOS-ARMV7 %s +// +// CHECK-WATCHOS-ARMV7: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-WATCHOS-ARMV7: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_watchos.a" diff --git a/test/Driver/integrated-as.s b/test/Driver/integrated-as.s index 181f790..5316f52 100644 --- a/test/Driver/integrated-as.s +++ b/test/Driver/integrated-as.s @@ -5,9 +5,6 @@ // RUN: %clang -### -c -integrated-as -Wa,-L %s 2>&1 | FileCheck --check-prefix=OPT_L %s // OPT_L: msave-temp-labels -// RUN: %clang -### -target x86_64-linux-gnu -c -integrated-as %s -fsanitize=address 2>&1 %s | FileCheck --check-prefix=SANITIZE %s -// SANITIZE: argument unused during compilation: '-fsanitize=address' - // Test that -I params in -Wa, and -Xassembler args are passed to integrated assembler // RUN: %clang -### -c -integrated-as %s -Wa,-I,foo_dir 2>&1 | FileCheck --check-prefix=WA_INCLUDE1 %s // WA_INCLUDE1: cc1as @@ -29,20 +26,27 @@ // XA_INCLUDE2: cc1as // XA_INCLUDE2: "-Ifoo_dir" -// RUN: %clang -### -c -integrated-as %s -gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2 %s -// DWARF2: "-g" "-gdwarf-2" +// RUN: %clang -### -c -integrated-as %s -gdwarf-4 -gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2 %s +// DWARF2: "-debug-info-kind=limited" "-dwarf-version=2" // RUN: %clang -### -c -integrated-as %s -gdwarf-3 2>&1 | FileCheck --check-prefix=DWARF3 %s -// DWARF3: "-g" "-gdwarf-3" +// DWARF3: "-debug-info-kind=limited" "-dwarf-version=3" // RUN: %clang -### -c -integrated-as %s -gdwarf-4 2>&1 | FileCheck --check-prefix=DWARF4 %s -// DWARF4: "-g" "-gdwarf-4" +// DWARF4: "-debug-info-kind=limited" "-dwarf-version=4" // RUN: %clang -### -c -integrated-as %s -Xassembler -gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2XASSEMBLER %s -// DWARF2XASSEMBLER: "-gdwarf-2" +// DWARF2XASSEMBLER: "-debug-info-kind=limited" "-dwarf-version=2" // RUN: %clang -### -c -integrated-as %s -Wa,-gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2WA %s -// DWARF2WA: "-gdwarf-2" +// DWARF2WA: "-debug-info-kind=limited" "-dwarf-version=2" + +// A dwarf version number that driver can't parse is just stuffed in. +// RUN: %clang -### -c -integrated-as %s -Wa,-gdwarf-huh 2>&1 | FileCheck --check-prefix=BOGODWARF %s +// BOGODWARF: "-gdwarf-huh" // RUN: %clang -### -x assembler -c -integrated-as %s -I myincludedir 2>&1 | FileCheck --check-prefix=INCLUDEPATH %s // INCLUDEPATH: "-I" "myincludedir" + +// RUN: %clang -### -x assembler -c -fPIC -integrated-as %s 2>&1 | FileCheck --check-prefix=PIC %s +// PIC: "-mrelocation-model" "pic" diff --git a/test/Driver/ios-simulator-arcruntime.c b/test/Driver/ios-simulator-arcruntime.c index 605df93..dbe306e 100644 --- a/test/Driver/ios-simulator-arcruntime.c +++ b/test/Driver/ios-simulator-arcruntime.c @@ -6,3 +6,11 @@ // CHECK-OPTIONS1: -fobjc-runtime=ios-4.2.1 // CHECK-OPTIONS2: i386-apple-ios5.0.0 // CHECK-OPTIONS2: -fobjc-runtime=ios-5.0.0 + +// RUN: %clang -### -x objective-c -target x86_64-apple-darwin -mtvos-simulator-version-min=8.3.0 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS3 %s +// CHECK-OPTIONS3: x86_64-apple-tvos8.3.0 +// CHECK-OPTIONS3: -fobjc-runtime=ios-8.3.0 + +// RUN: %clang -### -x objective-c -target x86_64-apple-darwin -mwatchos-simulator-version-min=2.0.0 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS4 %s +// CHECK-OPTIONS4: x86_64-apple-watchos2.0.0 +// CHECK-OPTIONS4: -fobjc-runtime=watchos-2.0.0 diff --git a/test/Driver/linux-as.c b/test/Driver/linux-as.c index 8aa323a..a07abc17 100644 --- a/test/Driver/linux-as.c +++ b/test/Driver/linux-as.c @@ -110,7 +110,7 @@ // RUN: | FileCheck -check-prefix=CHECK-SPARCV9 %s // CHECK-SPARCV9: as // CHECK-SPARCV9: -64 -// CHECK-SPARCV9: -Av9a +// CHECK-SPARCV9: -Av9 // CHECK-SPARCV9-NOT: -KPIC // CHECK-SPARCV9: -o // @@ -119,7 +119,7 @@ // RUN: | FileCheck -check-prefix=CHECK-SPARCV9PIC %s // CHECK-SPARCV9PIC: as // CHECK-SPARCV9PIC: -64 -// CHECK-SPARCV9PIC: -Av9a +// CHECK-SPARCV9PIC: -Av9 // CHECK-SPARCV9PIC: -KPIC // CHECK-SPARCV9PIC: -o // @@ -128,7 +128,7 @@ // RUN: | FileCheck -check-prefix=CHECK-SPARCV8 %s // CHECK-SPARCV8: as // CHECK-SPARCV8: -32 -// CHECK-SPARCV8: -Av8plusa +// CHECK-SPARCV8: -Av8 // CHECK-SPARCV8: -o // // RUN: %clang -target sparcel-linux -mcpu=invalid-cpu -### \ @@ -136,7 +136,7 @@ // RUN: | FileCheck -check-prefix=CHECK-SPARCV8EL %s // CHECK-SPARCV8EL: as // CHECK-SPARCV8EL: -32 -// CHECK-SPARCV8EL: -Av8plusa +// CHECK-SPARCV8EL: -Av8 // CHECK-SPARCV8EL: -o // // RUN: %clang -target s390x-linux -### -no-integrated-as -c %s 2>&1 \ diff --git a/test/Driver/linux-header-search.cpp b/test/Driver/linux-header-search.cpp index 23912cb..bd1da49 100644 --- a/test/Driver/linux-header-search.cpp +++ b/test/Driver/linux-header-search.cpp @@ -26,6 +26,42 @@ // CHECK-BASIC-LIBCXX-INSTALL: "-internal-isystem" "[[SYSROOT]]/usr/bin/../include/c++/v1" // CHECK-BASIC-LIBCXX-INSTALL: "-internal-isystem" "[[SYSROOT]]/usr/local/include" // +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target x86_64-unknown-linux-gnu \ +// RUN: -stdlib=libc++ \ +// RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \ +// RUN: --sysroot=%S/Inputs/basic_linux_libcxxv2_tree \ +// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXXV2-SYSROOT %s +// CHECK-BASIC-LIBCXXV2-SYSROOT: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-BASIC-LIBCXXV2-SYSROOT: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-BASIC-LIBCXXV2-SYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v2" +// CHECK-BASIC-LIBCXXV2-SYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target x86_64-unknown-linux-gnu \ +// RUN: -stdlib=libc++ \ +// RUN: -ccc-install-dir %S/Inputs/basic_linux_libcxxv2_tree/usr/bin \ +// RUN: --sysroot=%S/Inputs/basic_linux_libcxxv2_tree \ +// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXXV2-INSTALL %s +// CHECK-BASIC-LIBCXXV2-INSTALL: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-BASIC-LIBCXXV2-INSTALL: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-BASIC-LIBCXXV2-INSTALL: "-internal-isystem" "[[SYSROOT]]/usr/bin/../include/c++/v2" +// CHECK-BASIC-LIBCXXV2-INSTALL: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// +// Test Linux with both libc++ and libstdc++ installed. +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target x86_64-unknown-linux-gnu \ +// RUN: -stdlib=libc++ \ +// RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \ +// RUN: --sysroot=%S/Inputs/basic_linux_libstdcxx_libcxxv2_tree \ +// RUN: --gcc-toolchain="" \ +// RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBSTDCXX-LIBCXXV2-SYSROOT %s +// CHECK-BASIC-LIBSTDCXX-LIBCXXV2-SYSROOT: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-BASIC-LIBSTDCXX-LIBCXXV2-SYSROOT: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-BASIC-LIBSTDCXX-LIBCXXV2-SYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v2" +// CHECK-BASIC-LIBSTDCXX-LIBCXXV2-SYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// // Test a very broken version of multiarch that shipped in Ubuntu 11.04. // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ // RUN: -target i386-unknown-linux \ diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index a976b38..c15e24d 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -66,9 +66,9 @@ // CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." // CHECK-LD-RT: "-L[[SYSROOT]]/lib" // CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib" -// CHECK-LD-RT: libclang_rt.builtins-x86_64.a" "-lgcc_s" +// CHECK-LD-RT: libclang_rt.builtins-x86_64.a" // CHECK-LD-RT: "-lc" -// CHECK-LD-RT: libclang_rt.builtins-x86_64.a" "-lgcc_s" +// CHECK-LD-RT: libclang_rt.builtins-x86_64.a" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=arm-linux-androideabi \ @@ -81,9 +81,9 @@ // CHECK-LD-RT-ANDROID: "--eh-frame-hdr" // CHECK-LD-RT-ANDROID: "-m" "armelf_linux_eabi" // CHECK-LD-RT-ANDROID: "-dynamic-linker" -// CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a" "-lgcc_s" +// CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a" // CHECK-LD-RT-ANDROID: "-lc" -// CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a" "-lgcc_s" +// CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=x86_64-unknown-linux \ @@ -102,7 +102,7 @@ // CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.." // CHECK-LD-GCC: "-L[[SYSROOT]]/lib" // CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib" -// CHECK-LD-GCC "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" +// CHECK-LD-GCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" // CHECK-LD-GCC: "-lc" // CHECK-LD-GCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" // diff --git a/test/Driver/lto.c b/test/Driver/lto.c index 62300bd..3f66274 100644 --- a/test/Driver/lto.c +++ b/test/Driver/lto.c @@ -1,25 +1,51 @@ // -flto causes a switch to llvm-bc object files. -// RUN: %clang -ccc-print-phases -c %s -flto 2> %t.log -// RUN: grep '2: compiler, {1}, ir' %t.log -// RUN: grep '3: backend, {2}, lto-bc' %t.log +// RUN: %clang -ccc-print-phases -c %s -flto 2> %t +// RUN: FileCheck -check-prefix=CHECK-COMPILE-ACTIONS < %t %s +// +// CHECK-COMPILE-ACTIONS: 2: compiler, {1}, ir +// CHECK-COMPILE-ACTIONS: 3: backend, {2}, lto-bc -// RUN: %clang -ccc-print-phases %s -flto 2> %t.log -// RUN: grep '0: input, ".*lto.c", c' %t.log -// RUN: grep '1: preprocessor, {0}, cpp-output' %t.log -// RUN: grep '2: compiler, {1}, ir' %t.log -// RUN: grep '3: backend, {2}, lto-bc' %t.log -// RUN: grep '4: linker, {3}, image' %t.log +// RUN: %clang -ccc-print-phases %s -flto 2> %t +// RUN: FileCheck -check-prefix=CHECK-COMPILELINK-ACTIONS < %t %s +// +// CHECK-COMPILELINK-ACTIONS: 0: input, "{{.*}}lto.c", c +// CHECK-COMPILELINK-ACTIONS: 1: preprocessor, {0}, cpp-output +// CHECK-COMPILELINK-ACTIONS: 2: compiler, {1}, ir +// CHECK-COMPILELINK-ACTIONS: 3: backend, {2}, lto-bc +// CHECK-COMPILELINK-ACTIONS: 4: linker, {3}, image // llvm-bc and llvm-ll outputs need to match regular suffixes // (unfortunately). -// RUN: %clang %s -flto -save-temps -### 2> %t.log -// RUN: grep '"-o" ".*lto\.i" "-x" "c" ".*lto\.c"' %t.log -// RUN: grep '"-o" ".*lto\.bc" .*".*lto\.i"' %t.log -// RUN: grep '"-o" ".*lto\.o" .*".*lto\.bc"' %t.log -// RUN: grep '".*a\.\(out\|exe\)" .*".*lto\.o"' %t.log +// RUN: %clang %s -flto -save-temps -### 2> %t +// RUN: FileCheck -check-prefix=CHECK-COMPILELINK-SUFFIXES < %t %s +// +// CHECK-COMPILELINK-SUFFIXES: "-o" "{{.*}}lto.i" "-x" "c" "{{.*}}lto.c" +// CHECK-COMPILELINK-SUFFIXES: "-o" "{{.*}}lto.bc" {{.*}}"{{.*}}lto.i" +// CHECK-COMPILELINK-SUFFIXES: "-o" "{{.*}}lto.o" {{.*}}"{{.*}}lto.bc" +// CHECK-COMPILELINK-SUFFIXES: "{{.*}}a.{{(out|exe)}}" {{.*}}"{{.*}}lto.o" -// RUN: %clang %s -flto -S -### 2> %t.log -// RUN: grep '"-o" ".*lto\.s" "-x" "c" ".*lto\.c"' %t.log +// RUN: %clang %s -flto -S -### 2> %t +// RUN: FileCheck -check-prefix=CHECK-COMPILE-SUFFIXES < %t %s +// +// CHECK-COMPILE-SUFFIXES: "-o" "{{.*}}lto.s" "-x" "c" "{{.*}}lto.c" // RUN: not %clang %s -emit-llvm 2>&1 | FileCheck --check-prefix=LLVM-LINK %s // LLVM-LINK: -emit-llvm cannot be used when linking + +// -flto should cause link using gold plugin +// RUN: %clang -target x86_64-unknown-linux -### %s -flto 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-LTO-ACTION < %t %s +// +// CHECK-LINK-LTO-ACTION: "-plugin" "{{.*}}/LLVMgold.so" + +// -flto=full should cause link using gold plugin +// RUN: %clang -target x86_64-unknown-linux -### %s -flto=full 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-FULL-ACTION < %t %s +// +// CHECK-LINK-FULL-ACTION: "-plugin" "{{.*}}/LLVMgold.so" + +// Check that subsequent -fno-lto takes precedence +// RUN: %clang -target x86_64-unknown-linux -### %s -flto=full -fno-lto 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-NOLTO-ACTION < %t %s +// +// CHECK-LINK-NOLTO-ACTION-NOT: "-plugin" "{{.*}}/LLVMgold.so" diff --git a/test/Driver/mingw-libgcc.c b/test/Driver/mingw-libgcc.c new file mode 100644 index 0000000..75a5696 --- /dev/null +++ b/test/Driver/mingw-libgcc.c @@ -0,0 +1,25 @@ +// Test if mingw toolchain driver emits static linking (-lgcc -lgcc_eh) or dynamic linking (-lgcc_s -lgcc). +// Verified with gcc version 5.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project). + +// gcc, static +// RUN: %clang -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static-libgcc -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static -shared -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static-libgcc -shared -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s + +// gcc, dynamic +// RUN: %clang -shared -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_DYNAMIC %s + +// g++, static +// RUN: %clang -static --driver-mode=g++ -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static-libgcc --driver-mode=g++ -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static -shared --driver-mode=g++ -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static-libgcc -shared --driver-mode=g++ -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s + +// g++, dynamic +// RUN: %clang --driver-mode=g++ -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_DYNAMIC %s +// RUN: %clang -shared --driver-mode=g++ -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_DYNAMIC %s + +// CHECK_STATIC: "-lgcc" "-lgcc_eh" +// CHECK_DYNAMIC: "-lgcc_s" "-lgcc" diff --git a/test/Driver/mingw-useld.c b/test/Driver/mingw-useld.c new file mode 100644 index 0000000..a0ab5a9 --- /dev/null +++ b/test/Driver/mingw-useld.c @@ -0,0 +1,19 @@ +// RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_LD_32 %s +// CHECK_LD_32: ld{{(.exe)?}}" +// CHECK_LD_32: "i386pe" +// CHECK_LD_32-NOT: "-flavor" "gnu" + +// RUN: %clang -### -target i686-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_32 %s +// CHECK_LLD_32-NOT: invalid linker name in argument +// CHECK_LLD_32: lld{{(.exe)?}}" "-flavor" "gnu" +// CHECK_LLD_32: "i386pe" + +// RUN: %clang -### -target x86_64-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_64 %s +// CHECK_LLD_64-NOT: invalid linker name in argument +// CHECK_LLD_64: lld{{(.exe)?}}" "-flavor" "gnu" +// CHECK_LLD_64: "i386pep" + +// RUN: %clang -### -target arm-pc-windows-gnu --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck -check-prefix=CHECK_LLD_ARM %s +// CHECK_LLD_ARM-NOT: invalid linker name in argument +// CHECK_LLD_ARM: lld{{(.exe)?}}" "-flavor" "gnu" +// CHECK_LLD_ARM: "thumb2pe" diff --git a/test/Driver/mips-abi.c b/test/Driver/mips-abi.c index f756324..cede685 100644 --- a/test/Driver/mips-abi.c +++ b/test/Driver/mips-abi.c @@ -99,6 +99,12 @@ // MIPS-ARCH-32R2: "-target-abi" "o32" // // RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -march=p5600 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600 %s +// MIPS-ARCH-P5600: "-target-cpu" "p5600" +// MIPS-ARCH-P5600: "-target-abi" "o32" +// +// RUN: %clang -target mips-linux-gnu -### -c %s \ // RUN: -march=mips64 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-3264 %s // MIPS-ARCH-3264: "-target-cpu" "mips64" diff --git a/test/Driver/mips-as.c b/test/Driver/mips-as.c index 0da1a9e..63fc64c 100644 --- a/test/Driver/mips-as.c +++ b/test/Driver/mips-as.c @@ -58,6 +58,11 @@ // RUN: | FileCheck -check-prefix=MIPS-32R2 %s // MIPS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // +// RUN: %clang -target mips-linux-gnu -march=p5600 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS-P5600 %s +// MIPS-P5600: as{{(.exe)?}}" "-march" "p5600" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" +// // RUN: %clang -target mips64-linux-gnu -march=octeon -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-OCTEON %s diff --git a/test/Driver/mips-ias-Wa.s b/test/Driver/mips-ias-Wa.s new file mode 100644 index 0000000..233d062 --- /dev/null +++ b/test/Driver/mips-ias-Wa.s @@ -0,0 +1,49 @@ +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=TRAP-DEFAULT %s +// TRAP-DEFAULT: -cc1as +// TRAP-DEFAULT-NOT: "-target-feature" "-use-tcc-in-div" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,--trap 2>&1 | \ +// RUN: FileCheck -check-prefix=TRAP-ON %s +// TRAP-ON: -cc1as +// TRAP-ON: "-target-feature" "+use-tcc-in-div" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,--break 2>&1 | \ +// RUN: FileCheck -check-prefix=TRAP-OFF %s +// TRAP-OFF: -cc1as +// TRAP-OFF: "-target-feature" "-use-tcc-in-div" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,--trap,--break 2>&1 | \ +// RUN: FileCheck -check-prefix=TRAP-BOTH-TRAP-FIRST %s +// TRAP-BOTH-TRAP-FIRST: -cc1as +// TRAP-BOTH-TRAP-FIRST: "-target-feature" "+use-tcc-in-div" "-target-feature" "-use-tcc-in-div" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,--break,--trap 2>&1 | \ +// RUN: FileCheck -check-prefix=TRAP-BOTH-BREAK-FIRST %s +// TRAP-BOTH-BREAK-FIRST: -cc1as +// TRAP-BOTH-BREAK-FIRST: "-target-feature" "-use-tcc-in-div" "-target-feature" "+use-tcc-in-div" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-DEFAULT %s +// MSOFT-FLOAT-DEFAULT: -cc1as +// MSOFT-FLOAT-DEFAULT-NOT: "-target-feature" "-soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-msoft-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-ON %s +// MSOFT-FLOAT-ON: -cc1as +// MSOFT-FLOAT-ON: "-target-feature" "+soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mhard-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-OFF %s +// MSOFT-FLOAT-OFF: -cc1as +// MSOFT-FLOAT-OFF: "-target-feature" "-soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-msoft-float,-mhard-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST %s +// MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST: -cc1as +// MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST: "-target-feature" "+soft-float" "-target-feature" "-soft-float" + +// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mhard-float,-msoft-float 2>&1 | \ +// RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s +// MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as +// MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" "-target-feature" "+soft-float" diff --git a/test/Driver/mips-mti-linux.c b/test/Driver/mips-mti-linux.c new file mode 100644 index 0000000..e3560e2 --- /dev/null +++ b/test/Driver/mips-mti-linux.c @@ -0,0 +1,43 @@ +// Check frontend and linker invocations on GPL-free MIPS toolchain. +// +// FIXME: Using --sysroot with this toolchain/triple isn't supported. We use +// it here to test that we are producing the correct paths/flags. +// Ideally, we'd like to have an --llvm-toolchain option similar to +// the --gcc-toolchain one. +// REQUIRES: mips-registered-target + +// = Big-endian, mips32r2, hard float +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips-mti-linux -mips32r2 -mhard-float \ +// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s +// +// CHECK-BE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" "mips-mti-linux" +// CHECK-BE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2" +// CHECK-BE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot" +// CHECK-BE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "old-gnu" "-target" "mips-mti-linux" +// CHECK-BE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mips.so.1" +// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|\\\\}}crt1.o" +// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|\\\\}}crti.o" +// CHECK-BE-HF-32R2-SAME: "-L[[SYSROOT]]/mips-r2-hard-musl/usr/lib" +// CHECK-BE-HF-32R2-SAME: "{{[^"]+}}/mips-r2-hard-musl{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.builtins-mips.a" +// CHECK-BE-HF-32R2-SAME: "-lc" +// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|\\\\}}crtn.o" + +// = Little-endian, mips32r2, hard float +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips-mti-linux -mips32r2 -EL -mhard-float \ +// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-LE-HF-32R2 %s +// +// CHECK-LE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" "mipsel-mti-linux" +// CHECK-LE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2" +// CHECK-LE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot" +// CHECK-LE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "old-gnu" "-target" "mipsel-mti-linux" +// CHECK-LE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mipsel.so.1" +// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|\\\\}}crt1.o" +// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|\\\\}}crti.o" +// CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib" +// CHECK-LE-HF-32R2-SAME: "{{[^"]+}}/mipsel-r2-hard-musl{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.builtins-mips.a" +// CHECK-LE-HF-32R2-SAME: "-lc" +// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|\\\\}}crtn.o" diff --git a/test/Driver/modules.m b/test/Driver/modules.m index 8a0c8ba..0f2d4d5 100644 --- a/test/Driver/modules.m +++ b/test/Driver/modules.m @@ -37,3 +37,13 @@ // CHECK-MODULE-MAP-FILES: "-fmodules" // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=foo.map" // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=bar.map" + +// RUN: %clang -fmodules -fmodule-file=foo.pcm -fmodule-file=bar.pcm -### %s 2>&1 | FileCheck -check-prefix=CHECK-MODULE-FILES %s +// CHECK-MODULE-FILES: "-fmodules" +// CHECK-MODULE-FILES: "-fmodule-file=foo.pcm" +// CHECK-MODULE-FILES: "-fmodule-file=bar.pcm" + +// RUN: %clang -fno-modules -fmodule-file=foo.pcm -fmodule-file=bar.pcm -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MODULE-FILES %s +// CHECK-NO-MODULE-FILES-NOT: "-fmodules" +// CHECK-NO-MODULE-FILES-NOT: "-fmodule-file=foo.pcm" +// CHECK-NO-MODULE-FILES-NOT: "-fmodule-file=bar.pcm" diff --git a/test/Driver/ms-bitfields.c b/test/Driver/ms-bitfields.c new file mode 100644 index 0000000..7bf9aaa --- /dev/null +++ b/test/Driver/ms-bitfields.c @@ -0,0 +1,8 @@ +// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS +// RUN: %clang -### -mno-ms-bitfields -mms-bitfields %s 2>&1 | FileCheck %s -check-prefix=MSBITFIELDS +// RUN: %clang -### -mms-bitfields -mno-ms-bitfields %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS + +// MSBITFIELDS: -mms-bitfields +// NO-MSBITFIELDS-NOT: -mms-bitfields + +// REQUIRES: clang-driver diff --git a/test/Driver/myriad-toolchain.c b/test/Driver/myriad-toolchain.c new file mode 100644 index 0000000..6c94cff --- /dev/null +++ b/test/Driver/myriad-toolchain.c @@ -0,0 +1,79 @@ +// RUN: %clang -no-canonical-prefixes -### -target sparc-myriad-rtems-elf %s \ +// RUN: --gcc-toolchain=%S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=LINK_WITH_RTEMS +// LINK_WITH_RTEMS: Inputs{{.*}}crti.o +// LINK_WITH_RTEMS: Inputs{{.*}}crtbegin.o +// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/../../..{{/|\\\\}}../sparc-myriad-elf/lib" +// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2" +// LINK_WITH_RTEMS: "--start-group" "-lc" "-lrtemscpu" "-lrtemsbsp" "--end-group" "-lgcc" +// LINK_WITH_RTEMS: Inputs{{.*}}crtend.o +// LINK_WITH_RTEMS: Inputs{{.*}}crtn.o + +// RUN: %clang -c -no-canonical-prefixes -### -target sparc-myriad-rtems-elf -x c++ %s \ +// RUN: --gcc-toolchain=%S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=COMPILE_CXX +// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/../../../../sparc-myriad-elf/include/c++/4.8.2" +// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/../../../../sparc-myriad-elf/include/c++/4.8.2/sparc-myriad-elf" +// COMPILE_CXX: "-internal-isystem" "{{.*}}/Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/../../../../sparc-myriad-elf/include/c++/4.8.2/backward" + +// RUN: %clang -### -E -target sparc-myriad --sysroot=/yow %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=SLASH_INCLUDE +// SLASH_INCLUDE: "-isysroot" "/yow" "-internal-isystem" "/yow/include" + +// RUN: %clang -### -E -target sparc-myriad --sysroot=/yow %s -nostdinc 2>&1 \ +// RUN: | FileCheck %s -check-prefix=NO_SLASH_INCLUDE +// NO_SLASH_INCLUDE: "-isysroot" "/yow" +// NO_SLASH_INCLUDE-NOT: "-internal-isystem" "/yow/include" + +// RUN: %clang -### -target what-myriad %s 2>&1 | FileCheck %s -check-prefix=BAD_ARCH +// BAD_ARCH: the target architecture 'what' is not supported by the target 'myriad' + +// Ensure that '-target shave' picks a different compiler. +// Also check that '-I' is turned into '-i:' for the assembler. + +// Note that since we don't know where movi tools are installed, +// the driver may or may not find a full path to them. +// That is, the 0th argument will be "/path/to/my/moviCompile" +// or just "moviCompile" depending on whether moviCompile is found. +// As such, we test only for a trailing quote in its rendering. +// The same goes for "moviAsm". + +// RUN: %clang -target shave-myriad -c -### %s -isystem somewhere -Icommon -Wa,-yippee 2>&1 \ +// RUN: | FileCheck %s -check-prefix=MOVICOMPILE +// MOVICOMPILE: moviCompile{{(.exe)?}}" "-S" "-fno-exceptions" "-mcpu=myriad2" "-DMYRIAD2" "-isystem" "somewhere" "-I" "common" +// MOVICOMPILE: moviAsm{{(.exe)?}}" "-no6thSlotCompression" "-cv:myriad2" "-noSPrefixing" "-a" +// MOVICOMPILE: "-yippee" "-i:somewhere" "-i:common" "-elf" + +// RUN: %clang -target shave-myriad -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \ +// RUN: | FileCheck %s -check-prefix=DEFINES +// DEFINES: "-D" "EFINE_ME" "-U" "NDEFINE_ME" + +// RUN: %clang -target shave-myriad -c -### %s -Icommon -iquote quotepath -isystem syspath 2>&1 \ +// RUN: | FileCheck %s -check-prefix=INCLUDES +// INCLUDES: "-iquote" "quotepath" "-isystem" "syspath" + +// RUN: %clang -target shave-myriad -c -### %s -g -fno-inline-functions \ +// RUN: -fno-inline-functions-called-once -Os -Wall -MF dep.d \ +// RUN: -ffunction-sections 2>&1 | FileCheck %s -check-prefix=PASSTHRU_OPTIONS +// PASSTHRU_OPTIONS: "-g" "-fno-inline-functions" "-fno-inline-functions-called-once" +// PASSTHRU_OPTIONS: "-Os" "-Wall" "-MF" "dep.d" "-ffunction-sections" + +// RUN: %clang -target shave-myriad -c %s -o foo.o -### -MD -MF dep.d 2>&1 \ +// RUN: | FileCheck %s -check-prefix=MDMF +// MDMF: "-S" "-fno-exceptions" "-mcpu=myriad2" "-DMYRIAD2" "-MD" "-MF" "dep.d" "-MT" "foo.o" + +// RUN: %clang -target shave-myriad -std=gnu++11 -S %s -o foo.o -### 2>&1 \ +// RUN: | FileCheck %s -check-prefix=STDEQ +// STDEQ: "-S" "-fno-exceptions" "-mcpu=myriad2" "-DMYRIAD2" "-std=gnu++11" + +// RUN: %clang -target shave-myriad -E -Ifoo %s -o foo.i -### 2>&1 \ +// RUN: | FileCheck %s -check-prefix=PREPROCESS +// PREPROCESS: "-E" "-mcpu=myriad2" "-DMYRIAD2" "-I" "foo" + +// RUN: %clang -target sparc-myriad -### --driver-mode=g++ %s 2>&1 | FileCheck %s --check-prefix=STDLIBCXX +// STDLIBCXX: "-lstdc++" "-lc" "-lgcc" + +// RUN: %clang -target sparc-myriad -### -nostdlib %s 2>&1 | FileCheck %s --check-prefix=NOSTDLIB +// NOSTDLIB-NOT: crtbegin.o +// NOSTDLIB-NOT: "-lc" + +// RUN: %clang -### -c -g %s -target sparc-myriad 2>&1 | FileCheck -check-prefix=G_SPARC %s +// G_SPARC: "-debug-info-kind=limited" "-dwarf-version=2" diff --git a/test/Driver/nacl-direct.c b/test/Driver/nacl-direct.c index 5fe8576..f71e14f 100644 --- a/test/Driver/nacl-direct.c +++ b/test/Driver/nacl-direct.c @@ -9,7 +9,7 @@ // CHECK-I686: "-target-cpu" "pentium4" // CHECK-I686: "-resource-dir" "foo" // CHECK-I686: "-internal-isystem" "foo{{/|\\\\}}include" -// CHECK-I686: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}usr{{/|\\\\}}include" +// CHECK-I686: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}i686-nacl{{/|\\\\}}usr{{/|\\\\}}include" // CHECK-I686: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}include" // CHECK-I686: as{{(.exe)?}}" "--32" // CHECK-I686: ld{{(.exe)?}}" @@ -17,7 +17,7 @@ // CHECK-I686: "-m" "elf_i386_nacl" // CHECK-I686: "-static" // CHECK-I686: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}lib32" -// CHECK-I686: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}usr{{/|\\\\}}lib32" +// CHECK-I686: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}i686-nacl{{/|\\\\}}usr{{/|\\\\}}lib" // CHECK-I686: "-Lfoo{{/|\\\\}}lib{{/|\\\\}}i686-nacl" // CHECK-I686-NOT: -lpthread // @@ -118,7 +118,7 @@ // CHECK-I686-CXX: "-resource-dir" "foo" // CHECK-I686-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" // CHECK-I686-CXX: "-internal-isystem" "foo{{/|\\\\}}include" -// CHECK-I686-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}usr{{/|\\\\}}include" +// CHECK-I686-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}i686-nacl{{/|\\\\}}usr{{/|\\\\}}include" // CHECK-I686-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}include" // CHECK-I686-CXX: "-lpthread" diff --git a/test/Driver/netbsd.c b/test/Driver/netbsd.c index 612935d..ffaab36 100644 --- a/test/Driver/netbsd.c +++ b/test/Driver/netbsd.c @@ -206,7 +206,7 @@ // ARM-6: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" // SPARC: clang{{.*}}" "-cc1" "-triple" "sparc--netbsd" -// SPARC: as{{.*}}" "-32" "-o" +// SPARC: as{{.*}}" "-32" "-Av8" "-o" // SPARC: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so" // SPARC: "-m" "elf32_sparc" // SPARC: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" diff --git a/test/Driver/no-canonical-prefixes.c b/test/Driver/no-canonical-prefixes.c index 1aef9f4..7bc76be 100644 --- a/test/Driver/no-canonical-prefixes.c +++ b/test/Driver/no-canonical-prefixes.c @@ -1,10 +1,17 @@ +// Due to ln -sf: // REQUIRES: shell -// RUN: mkdir -p %t -// RUN: cd %t +// RUN: mkdir -p %t.real +// RUN: cd %t.real // RUN: ln -sf %clang test-clang -// RUN: ./test-clang -v -S %s 2>&1 | FileCheck %s -// RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=NCP %s - - -// CHECK: /clang{{.*}}" -cc1 -// NCP: test-clang" -cc1 +// RUN: cd .. +// RUN: ln -sf %t.real %t.fake +// RUN: cd %t.fake +// RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s +// RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=NON-CANONICAL %s +// +// FIXME: This should really be '.real'. +// CANONICAL: InstalledDir: {{.*}}.fake +// CANONICAL: {{[/|\\]*}}clang{{.*}}" -cc1 +// +// NON-CANONICAL: InstalledDir: .{{$}} +// NON-CANONICAL: test-clang" -cc1 diff --git a/test/Driver/no-integrated-as.s b/test/Driver/no-integrated-as.s new file mode 100644 index 0000000..cd6f5e2 --- /dev/null +++ b/test/Driver/no-integrated-as.s @@ -0,0 +1,8 @@ +; RUN: %clang -### -no-integrated-as -c %s 2>&1 | FileCheck %s -check-prefix IAS +; Windows doesn't support no-integrated-as +; XFAIL: win32,win64 +; +; Make sure the current file's filename appears in the output. +; We can't generically match on the assembler name, so we just make sure +; the filename is in the output. +; IAS: no-integrated-as.s diff --git a/test/Driver/nodefaultlib.c b/test/Driver/nodefaultlib.c index f9462fd..08bcea5 100644 --- a/test/Driver/nodefaultlib.c +++ b/test/Driver/nodefaultlib.c @@ -1,8 +1,10 @@ -// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2> %t -// RUN: FileCheck < %t %s -// -// CHECK-NOT: start-group -// CHECK-NOT: "-lgcc" -// CHECK-NOT: "-lc" -// CHECK: crtbegin -// CHECK: crtend +// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2>&1 | FileCheck -check-prefix=TEST1 %s +// TEST1-NOT: start-group +// TEST1-NOT: "-lgcc" +// TEST1-NOT: "-lc" +// TEST1: crtbegin +// TEST1: crtend + +// RUN: %clang -target i686-pc-linux-gnu -stdlib=libc++ -nodefaultlibs -lstdc++ -### %s 2>&1 | FileCheck -check-prefix=TEST2 %s +// TEST2-NOT: "-lc++" +// TEST2: "-lstdc++" diff --git a/test/Driver/nostdlib.c b/test/Driver/nostdlib.c index e9ada31..47c6f8b 100644 --- a/test/Driver/nostdlib.c +++ b/test/Driver/nostdlib.c @@ -2,3 +2,26 @@ // RUN: FileCheck < %t %s // // CHECK-NOT: start-group + +// Most of the toolchains would check for -nostartfiles and -nostdlib +// in a short-circuiting boolean expression, so if both of the preceding +// options were present, the second would warn about being unused. +// RUN: %clang -### -nostartfiles -nostdlib -target i386-apple-darwin %s \ +// RUN: 2>&1 | FileCheck %s -check-prefix=ARGSCLAIMED +// ARGSCLAIMED-NOT: warning: + +// In the presence of -nostdlib, the standard libraries should not be +// passed down to link line +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target i686-pc-linux-gnu -nostdlib --rtlib=compiler-rt \ +// RUN: -resource-dir=%S/Inputs/resource_dir -lclang_rt.builtins-i686 \ +// RUN: | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB %s +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target i686-pc-linux-gnu --rtlib=compiler-rt -nostdlib \ +// RUN: -resource-dir=%S/Inputs/resource_dir -lclang_rt.builtins-i686 \ +// RUN: | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB %s +// +// CHECK-LINUX-NOSTDLIB: warning: argument unused during compilation: '--rtlib=compiler-rt' +// CHECK-LINUX-NOSTDLIB: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-LINUX-NOSTDLIB-NOT: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.builtins-i686.a" diff --git a/test/Driver/objc-weak.m b/test/Driver/objc-weak.m new file mode 100644 index 0000000..ff60759 --- /dev/null +++ b/test/Driver/objc-weak.m @@ -0,0 +1,27 @@ +// Check miscellaneous Objective-C options. + +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-arc -fobjc-weak 2>&1 | FileCheck %s --check-prefix ARC-WEAK +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fno-objc-weak -fobjc-weak -fobjc-arc 2>&1 | FileCheck %s --check-prefix ARC-WEAK +// ARC-WEAK: -fobjc-arc +// ARC-WEAK: -fobjc-weak + +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-arc -fno-objc-weak 2>&1 | FileCheck %s --check-prefix ARC-NO-WEAK +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-weak -fno-objc-weak -fobjc-arc 2>&1 | FileCheck %s --check-prefix ARC-NO-WEAK +// ARC-NO-WEAK: -fobjc-arc +// ARC-NO-WEAK: -fno-objc-weak + +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.5 -S -### %s -fobjc-arc -fobjc-weak 2>&1 | FileCheck %s --check-prefix ARC-WEAK-UNSUPPORTED +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.5 -S -### %s -fno-objc-weak -fobjc-weak -fobjc-arc 2>&1 | FileCheck %s --check-prefix ARC-WEAK-UNSUPPORTED +// ARC-WEAK-UNSUPPORTED: error: -fobjc-weak is not supported on the current deployment target + +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fno-objc-weak -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK +// MRC-WEAK: -fobjc-weak + +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fno-objc-weak 2>&1 | FileCheck %s --check-prefix MRC-NO-WEAK +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.7 -S -### %s -fobjc-weak -fno-objc-weak 2>&1 | FileCheck %s --check-prefix MRC-NO-WEAK +// MRC-NO-WEAK: -fno-objc-weak + +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.5 -S -### %s -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK-UNSUPPORTED +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.5 -S -### %s -fno-objc-weak -fobjc-weak 2>&1 | FileCheck %s --check-prefix MRC-WEAK-UNSUPPORTED +// MRC-WEAK-UNSUPPORTED: error: -fobjc-weak is not supported on the current deployment target diff --git a/test/Driver/openbsd.c b/test/Driver/openbsd.c index 74fef50..95b9e6a 100644 --- a/test/Driver/openbsd.c +++ b/test/Driver/openbsd.c @@ -61,8 +61,8 @@ // RUN: | FileCheck -check-prefix=CHECK-MIPS64EL-PIC %s // CHECK-AMD64-M32: as{{.*}}" "--32" // CHECK-POWERPC: as{{.*}}" "-mppc" "-many" -// CHECK-SPARC: as{{.*}}" "-32" -// CHECK-SPARC64: as{{.*}}" "-64" "-Av9a" +// CHECK-SPARC: as{{.*}}" "-32" "-Av8" +// CHECK-SPARC64: as{{.*}}" "-64" "-Av9" // CHECK-MIPS64: as{{.*}}" "-mabi" "64" "-EB" // CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC" // CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL" diff --git a/test/Driver/pic.c b/test/Driver/pic.c index 120e66a..06b4204 100644 --- a/test/Driver/pic.c +++ b/test/Driver/pic.c @@ -11,6 +11,7 @@ // CHECK-PIC2: "-mrelocation-model" "pic" // CHECK-PIC2: "-pic-level" "2" // +// CHECK-STATIC: "-static" // CHECK-NO-STATIC-NOT: "-static" // // CHECK-PIE1: "-mrelocation-model" "pic" @@ -135,8 +136,15 @@ // 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 + +// The -static argument *doesn't* override PIC: -static only affects +// linking, and -fPIC only affects code generation. // RUN: %clang -c %s -target i386-unknown-unknown -static -fPIC -### 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 +// RUN: %clang %s -target i386-linux-gnu -static -fPIC -### \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-STATIC // // On Linux, disregard -pie if we have -shared. // RUN: %clang %s -target i386-unknown-linux -shared -pie -### 2>&1 \ @@ -204,6 +212,8 @@ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 // RUN: %clang -x assembler -c %s -target arm64-apple-ios -mkernel -miphoneos-version-min=7.0.0 -no-integrated-as -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-STATIC +// RUN: %clang -c %s -target armv7k-apple-watchos -fapple-kext -mwatchos-version-min=1.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 armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -static -### 2>&1 \ diff --git a/test/Driver/ppc-features.cpp b/test/Driver/ppc-features.cpp index 947183c..34c1ce5 100644 --- a/test/Driver/ppc-features.cpp +++ b/test/Driver/ppc-features.cpp @@ -12,6 +12,50 @@ // RUN: not %clang -target mips64-linux-gnu -faltivec -fsyntax-only %s 2>&1 | FileCheck %s // RUN: not %clang -target sparc-unknown-solaris -faltivec -fsyntax-only %s 2>&1 | FileCheck %s +// check -msoft-float option for ppc32 +// RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT %s +// CHECK-SOFTFLOAT: "-target-feature" "+soft-float" + +// check -mfloat-abi=soft option for ppc32 +// RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=soft -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABISOFT %s +// CHECK-FLOATABISOFT: "-target-feature" "+soft-float" + +// check -mhard-float option for ppc32 +// RUN: %clang -target powerpc-unknown-linux-gnu %s -mhard-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-HARDFLOAT %s +// CHECK-HARDFLOAT-NOT: "-target-feature" "+soft-float" + +// check -mfloat-abi=hard option for ppc32 +// RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=hard -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABIHARD %s +// CHECK-FLOATABIHARD-NOT: "-target-feature" "+soft-float" + +// check combine -mhard-float -msoft-float option for ppc32 +// RUN: %clang -target powerpc-unknown-linux-gnu %s -mhard-float -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-HARDSOFT %s +// CHECK-HARDSOFT: "-target-feature" "+soft-float" + +// check combine -msoft-float -mhard-float option for ppc32 +// RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -mhard-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTHARD %s +// CHECK-SOFTHARD-NOT: "-target-feature" "+soft-float" + +// check -mfloat-abi=x option +// RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=x -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-ERRMSG %s +// CHECK-ERRMSG: error: invalid float ABI '-mfloat-abi=x' + +// check -msoft-float option for ppc64 +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT64 %s +// CHECK-SOFTFLOAT64: error: invalid float ABI 'soft float is not supported for ppc64' + +// check -mfloat-abi=soft option for ppc64 +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mfloat-abi=soft -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABISOFT64 %s +// CHECK-FLOATABISOFT64: error: invalid float ABI 'soft float is not supported for ppc64' + +// check -msoft-float option for ppc64 +// RUN: %clang -target powerpc64le-unknown-linux-gnu %s -msoft-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTFLOAT64le %s +// CHECK-SOFTFLOAT64le: error: invalid float ABI 'soft float is not supported for ppc64' + +// check -mfloat-abi=soft option for ppc64 +// RUN: %clang -target powerpc64le-unknown-linux-gnu %s -mfloat-abi=soft -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-FLOATABISOFT64le %s +// CHECK-FLOATABISOFT64le: error: invalid float ABI 'soft float is not supported for ppc64' + // CHECK: invalid argument '-faltivec' only allowed with 'ppc/ppc64/ppc64le' // Check that -fno-altivec and -mno-altivec correctly disable the altivec diff --git a/test/Driver/ps4-header-search.c b/test/Driver/ps4-header-search.c new file mode 100644 index 0000000..15e093f --- /dev/null +++ b/test/Driver/ps4-header-search.c @@ -0,0 +1,10 @@ +// REQUIRES: x86-registered-target + +// RUN: env SCE_PS4_SDK_DIR=%S/Inputs/scei-ps4_tree %clang -target x86_64-scei-ps4 -E -v %s 2>&1 | FileCheck %s --check-prefix=ENVPS4 +// ENVPS4: Inputs/scei-ps4_tree/target/include{{$}} +// ENVPS4: Inputs/scei-ps4_tree/target/include_common{{$}} + +// RUN: %clang -isysroot %S/Inputs/scei-ps4_tree -target x86_64-scei-ps4 -E -v %s 2>&1 | FileCheck %s --check-prefix=SYSROOTPS4 +// SYSROOTPS4: "{{[^"]*}}clang{{[^"]*}}" +// SYSROOTPS4: Inputs/scei-ps4_tree/target/include{{$}} +// SYSROOTPS4: Inputs/scei-ps4_tree/target/include_common{{$}} diff --git a/test/Driver/ps4-linker-non-win.c b/test/Driver/ps4-linker-non-win.c new file mode 100644 index 0000000..1fce6d6 --- /dev/null +++ b/test/Driver/ps4-linker-non-win.c @@ -0,0 +1,21 @@ +// UNSUPPORTED: system-windows +// REQUIRES: x86-registered-target + +// RUN: mkdir -p %T/Output +// RUN: rm -f %T/Output/ps4-ld +// RUN: touch %T/Output/ps4-ld +// RUN: chmod +x %T/Output/ps4-ld + +// RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4 %s -fuse-ld=gold 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s +// RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4 %s -shared 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s + +// RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4 %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s +// RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4 %s -fuse-ld=ps4 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s +// RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4 %s -shared \ +// RUN: -fuse-ld=ps4 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER %s + +// CHECK-PS4-LINKER: Output/ps4-ld diff --git a/test/Driver/ps4-linker-win.c b/test/Driver/ps4-linker-win.c new file mode 100644 index 0000000..e42fc96 --- /dev/null +++ b/test/Driver/ps4-linker-win.c @@ -0,0 +1,27 @@ +// The full path to the gold linker was not found on Windows because the +// driver fails to add an .exe extension to the name. +// We check that gold linker's full name (with an extension) is specified +// on the command line if -fuse-ld=gold, or -shared with no -fuse-ld option +// are passed. Otherwise, we check that the PS4's linker's full name is +// specified. + +// REQUIRES: system-windows, x86-registered-target + +// RUN: touch %T/ps4-ld.exe +// RUN: touch %T/ps4-ld.gold.exe + +// RUN: env "PATH=%T;%PATH%" %clang -target x86_64-scei-ps4 %s -fuse-ld=gold -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PS4-GOLD %s +// RUN: env "PATH=%T;%PATH%" %clang -target x86_64-scei-ps4 %s -shared -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PS4-GOLD %s + +// RUN: env "PATH=%T;%PATH%" %clang -target x86_64-scei-ps4 %s -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s +// RUN: env "PATH=%T;%PATH%" %clang -target x86_64-scei-ps4 %s -fuse-ld=ps4 -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s +// RUN: env "PATH=%T;%PATH%" %clang -target x86_64-scei-ps4 %s -shared \ +// RUN: -fuse-ld=ps4 -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER %s + +// FIXME: "Output\\" is hardcoded part of %T. +// CHECK-PS4-GOLD: Output\\ps4-ld.gold.exe" +// CHECK-PS4-LINKER: Output\\ps4-ld.exe" diff --git a/test/Driver/ps4-pic.c b/test/Driver/ps4-pic.c new file mode 100644 index 0000000..0cf9ad5 --- /dev/null +++ b/test/Driver/ps4-pic.c @@ -0,0 +1,106 @@ +// REQUIRES: x86-registered-target + +// Test the driver's control over the PIC behavior for PS4 compiler. +// These consist of tests of the relocation model flags and the +// pic level flags passed to CC1. +// +// CHECK-NO-PIC: "-mrelocation-model" "static" +// CHECK-NO-PIC-NOT: "-pic-level" +// CHECK-NO-PIC-NOT: "-pie-level" +// +// CHECK-DYNAMIC-NO-PIC2: unsupported option '-mdynamic-no-pic' +// CHECK-DYNAMIC-NO-PIC2: "-mrelocation-model" "dynamic-no-pic" +// +// CHECK-PIC2: "-mrelocation-model" "pic" +// CHECK-PIC2: "-pic-level" "2" +// +// CHECK-PIE2: "-mrelocation-model" "pic" +// CHECK-PIE2: "-pie-level" "2" +// +// CHECK-NOPIC-IGNORED: using '-fPIC' +// CHECK-NOPIC-IGNORED: "-mrelocation-model" "pic" +// CHECK-NOPIC-IGNORED: "-pic-level" "2" +// +// CHECK-DIAG-PIC: option '-fno-PIC' was ignored by the PS4 toolchain, using '-fPIC' +// CHECK-DIAG-PIE: option '-fno-PIE' was ignored by the PS4 toolchain, using '-fPIC' +// CHECK-DIAG-pic: option '-fno-pic' was ignored by the PS4 toolchain, using '-fPIC' +// CHECK-DIAG-pie: option '-fno-pie' was ignored by the PS4 toolchain, using '-fPIC' +// +// CHECK-STATIC-ERR: unsupported option '-static' for target 'PS4' + +// RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIE -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-pic -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -fno-PIC -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-PIC -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -fno-pic -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fno-pie -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIE -fno-PIE -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fno-PIE -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIE -fno-pie -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fno-pic -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-pie -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fPIC -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -fpic -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fPIE -fpie -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fPIC -fPIE -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 +// +// Defaults change for PS4. +// RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pic -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIC -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED +// +// Disregard any of the PIC-specific flags if we have a trump-card flag. +// RUN: %clang -c %s -target x86_64-scei-ps4 -mkernel -fPIC -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC +// RUN: %clang -c %s -target x86_64-scei-ps4 -mdynamic-no-pic -fPIC -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2 +// +// -static not supported at all. +// RUN: %clang -c %s -target x86_64-scei-ps4 -static -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-STATIC-ERR +// +// -fno-PIC etc. is obeyed if -mcmodel=kernel is also present. +// RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIC -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC +// RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIE -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC +// RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-pic -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC +// RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-pie -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC +// +// Verify that we reflect the option the user specified, when we ignore it. +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIC -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-DIAG-PIC +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIE -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-DIAG-PIE +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pic -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-DIAG-pic +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pie -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-DIAG-pie diff --git a/test/Driver/ps4-runtime-flags.c b/test/Driver/ps4-runtime-flags.c new file mode 100644 index 0000000..315976d --- /dev/null +++ b/test/Driver/ps4-runtime-flags.c @@ -0,0 +1,19 @@ +// REQUIRES: x86-registered-target +// +// Test the profile runtime library to be linked for PS4 compiler. +// Check PS4 runtime flag --dependent-lib which does not append the default library search path. +// +// RUN: %clang -target x86_64-scei-ps4 --coverage %s -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-PROFILE %s +// RUN: %clang -target x86_64-scei-ps4 -fprofile-arcs %s -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-PROFILE %s +// RUN: %clang -target x86_64-scei-ps4 -fno-profile-arcs -fprofile-arcs %s -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-PROFILE %s +// RUN: %clang -target x86_64-scei-ps4 -fno-profile-arcs %s -### 2>&1 | FileCheck -check-prefix=CHECK-PS4-NO-PROFILE %s +// RUN: %clang -target x86_64-scei-ps4 -fprofile-arcs -fno-profile-arcs %s -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-NO-PROFILE %s +// RUN: %clang -target x86_64-scei-ps4 -fprofile-generate %s -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-PROFILE %s +// RUN: %clang -target x86_64-scei-ps4 -fno-profile-generate %s -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-NO-PROFILE %s +// RUN: %clang -target x86_64-scei-ps4 -fprofile-generate=dir %s -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-PROFILE %s +// RUN: %clang -target x86_64-scei-ps4 -fprofile-instr-generate %s -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-PROFILE %s +// RUN: %clang -target x86_64-scei-ps4 -fno-profile-instr-generate %s -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-NO-PROFILE %s +// RUN: %clang -target x86_64-scei-ps4 -fprofile-instr-generate=somefile.profraw %s -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-PROFILE %s +// +// CHECK-PS4-PROFILE: "--dependent-lib=libclang_rt.profile-x86_64.a" +// CHECK-PS4-NO-PROFILE-NOT: "--dependent-lib=libclang_rt.profile-x86_64.a" diff --git a/test/Driver/ps4-sdk-root.c b/test/Driver/ps4-sdk-root.c new file mode 100644 index 0000000..f40a963 --- /dev/null +++ b/test/Driver/ps4-sdk-root.c @@ -0,0 +1,48 @@ +// REQUIRES: x86-registered-target + +// Check that ps4-clang doesn't report a warning message when locating +// system header files (either by looking at the value of SCE_PS4_SDK_DIR +// or relative to the location of the compiler driver), if "-nostdinc", +// "--sysroot" or "-isysroot" option is specified on the command line. +// Otherwise, check that ps4-clang reports a warning. + +// Check that clang doesn't report a warning message when locating +// system libraries (either by looking at the value of SCE_PS4_SDK_DIR +// or relative to the location of the compiler driver), if "-c", "-S", "-E", +// "--sysroot", "-nostdlib" or "-nodefaultlibs" option is specified on +// the command line. +// Otherwise, check that ps4-clang reports a warning. + +// setting up SCE_PS4_SDK_DIR to existing location, which is not a PS4 SDK. +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS -check-prefix=WARN-SYS-LIBS -check-prefix=NO-WARN %s + +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -c -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -S -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -E -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -emit-ast -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -isysroot foo -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-ISYSROOT -check-prefix=WARN-SYS-LIBS -check-prefix=NO-WARN %s + +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -c -nostdinc -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -S -nostdinc -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -E -nostdinc -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -emit-ast -nostdinc -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s + +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -c --sysroot=foo/ -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -S --sysroot=foo/ -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -E --sysroot=foo/ -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -emit-ast --sysroot=foo/ -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s + +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -c -isysroot foo -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-ISYSROOT -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -S -isysroot foo -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-ISYSROOT -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -E -isysroot foo -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-ISYSROOT -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -emit-ast -isysroot foo -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-ISYSROOT -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### --sysroot=foo/ -isysroot foo -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-ISYSROOT -check-prefix=NO-WARN %s + +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -nostdlib -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS -check-prefix=NO-WARN %s +// RUN: env SCE_PS4_SDK_DIR=.. %clang -Winvalid-or-nonexistent-directory -### -nodefaultlibs -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS -check-prefix=NO-WARN %s + +// NO-WARN-NOT: {{warning:|error:}} +// WARN-SYS-HEADERS: warning: unable to find PS4 system headers directory +// WARN-ISYSROOT: warning: no such sysroot directory: 'foo' +// WARN-SYS-LIBS: warning: unable to find PS4 system libraries directory +// NO-WARN-NOT: {{warning:|error:}} diff --git a/test/Driver/rewrite-legacy-objc.m b/test/Driver/rewrite-legacy-objc.m index b0b78d0..6a2b44b 100644 --- a/test/Driver/rewrite-legacy-objc.m +++ b/test/Driver/rewrite-legacy-objc.m @@ -3,11 +3,11 @@ // 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" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" +// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fobjc-runtime=macosx-fragile" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" // TEST0: rewrite-legacy-objc.m" // RUN: %clang -no-canonical-prefixes -target i386-apple-macosx10.9.0 -rewrite-legacy-objc %s -o - -### 2>&1 | \ // RUN: FileCheck -check-prefix=TEST1 %s // RUN: %clang -no-canonical-prefixes -target i386-apple-macosx10.6.0 -rewrite-legacy-objc %s -o - -### 2>&1 | \ // RUN: FileCheck -check-prefix=TEST2 %s -// TEST1: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-fragile" "-fobjc-subscripting-legacy-runtime" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" -// TEST2: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-fragile" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" +// TEST1: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fobjc-runtime=macosx-fragile" "-fobjc-subscripting-legacy-runtime" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" +// TEST2: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fobjc-runtime=macosx-fragile" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" diff --git a/test/Driver/rewrite-objc.m b/test/Driver/rewrite-objc.m index ba5f835..ca1e840 100644 --- a/test/Driver/rewrite-objc.m +++ b/test/Driver/rewrite-objc.m @@ -3,4 +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" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" +// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fobjc-runtime=macosx" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" diff --git a/test/Driver/rtti-options.cpp b/test/Driver/rtti-options.cpp index 50354e5..bb2958d 100644 --- a/test/Driver/rtti-options.cpp +++ b/test/Driver/rtti-options.cpp @@ -21,6 +21,10 @@ // RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s // RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s // RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-WARN %s +// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s +// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s // Exceptions + no/default rtti // RUN: %clang -### -c -target x86_64-scei-ps4 -fcxx-exceptions -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-EXC-ERROR-CXX %s @@ -46,6 +50,7 @@ // RUN: %clang -### -c -target x86_64-unknown-unknown %s 2>&1 | FileCheck -check-prefix=CHECK-RTTI %s // CHECK-UNUSED: warning: argument unused during compilation: '-fcxx-exceptions' +// CHECK-SAN-WARN: implicitly disabling vptr sanitizer because rtti wasn't enabled // CHECK-SAN-ERROR: invalid argument '-fsanitize=vptr' not allowed with '-fno-rtti' // CHECK-EXC-WARN: implicitly enabling rtti for exception handling // CHECK-EXC-ERROR: invalid argument '-fno-rtti' not allowed with '-fexceptions' diff --git a/test/Driver/sanitizer-ld.c b/test/Driver/sanitizer-ld.c index 5fef817..0e9c596 100644 --- a/test/Driver/sanitizer-ld.c +++ b/test/Driver/sanitizer-ld.c @@ -291,6 +291,40 @@ // CHECK-LSAN-ASAN-LINUX: libclang_rt.asan-x86_64 // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan +// CFI by itself does not link runtime libraries. +// RUN: %clang -fsanitize=cfi %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-CFI-LINUX %s +// CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}" +// CHECK-CFI-LINUX-NOT: libclang_rt. + +// CFI with diagnostics links the UBSan runtime. +// RUN: %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \ +// RUN: %s -### -o %t.o 2>&1\ +// RUN: -target x86_64-unknown-linux \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-CFI-DIAG-LINUX %s +// CHECK-CFI-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}" +// CHECK-CFI-DIAG-LINUX: "-whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a" "-no-whole-archive" + +// Cross-DSO CFI links the CFI runtime. +// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s +// CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}" +// CHECK-CFI-CROSS-DSO-LINUX: "-whole-archive" "{{[^"]*}}libclang_rt.cfi-x86_64.a" "-no-whole-archive" + +// Cross-DSO CFI with diagnostics links just the CFI runtime. +// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \ +// RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \ +// RUN: -target x86_64-unknown-linux \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s +// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}" +// CHECK-CFI-CROSS-DSO-DIAG-LINUX: "-whole-archive" "{{[^"]*}}libclang_rt.cfi_diag-x86_64.a" "-no-whole-archive" + // RUN: %clangxx -fsanitize=address %s -### -o %t.o 2>&1 \ // RUN: -mmacosx-version-min=10.6 \ // RUN: -target x86_64-apple-darwin13.4.0 \ @@ -299,3 +333,59 @@ // CHECK-ASAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}" // CHECK-ASAN-DARWIN106-CXX: libclang_rt.asan_osx_dynamic.dylib // CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux -fsanitize=safe-stack \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-LINUX %s +// +// CHECK-SAFESTACK-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-SAFESTACK-LINUX-NOT: "-lc" +// CHECK-SAFESTACK-LINUX: libclang_rt.safestack-x86_64.a" +// CHECK-SAFESTACK-LINUX: "-lpthread" +// CHECK-SAFESTACK-LINUX: "-ldl" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi -fsanitize=safe-stack \ +// RUN: --sysroot=%S/Inputs/basic_android_tree \ +// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s +// +// CHECK-SAFESTACK-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-SAFESTACK-ANDROID-ARM-NOT: libclang_rt.safestack + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o -shared 2>&1 \ +// RUN: -target arm-linux-androideabi -fsanitize=safe-stack \ +// RUN: --sysroot=%S/Inputs/basic_android_tree \ +// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s +// +// CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target aarch64-linux-android -fsanitize=safe-stack \ +// RUN: --sysroot=%S/Inputs/basic_android_tree \ +// RUN: | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-AARCH64 %s +// +// CHECK-SAFESTACK-ANDROID-AARCH64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-SAFESTACK-ANDROID-AARCH64-NOT: libclang_rt.safestack + +// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-scei-ps4 \ +// RUN: -shared \ +// RUN: | FileCheck --check-prefix=CHECK-UBSAN-PS4 %s +// CHECK-UBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}" +// CHECK-UBSAN-PS4: -lSceDbgUBSanitizer_stub_weak + +// RUN: %clang -fsanitize=address %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-scei-ps4 \ +// RUN: -shared \ +// RUN: | FileCheck --check-prefix=CHECK-ASAN-PS4 %s +// CHECK-ASAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}" +// CHECK-ASAN-PS4: -lSceDbgAddressSanitizer_stub_weak + +// RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-scei-ps4 \ +// RUN: -shared \ +// RUN: | FileCheck --check-prefix=CHECK-AUBSAN-PS4 %s +// CHECK-AUBSAN-PS4: "{{.*}}ld{{(.gold)?(.exe)?}}" +// CHECK-AUBSAN-PS4: -lSceDbgAddressSanitizer_stub_weak diff --git a/test/Driver/save-temps.c b/test/Driver/save-temps.c index 277a901..c974d15 100644 --- a/test/Driver/save-temps.c +++ b/test/Driver/save-temps.c @@ -2,7 +2,7 @@ // RUN: | FileCheck %s // CHECK: "-o" "save-temps.i" // CHECK: "-emit-llvm-uselists" -// CHECK: "-disable-llvm-optzns" +// CHECK: "-disable-llvm-passes" // CHECK: "-o" "save-temps.bc" // CHECK: "-o" "save-temps.s" // CHECK: "-o" "save-temps.o" @@ -14,7 +14,7 @@ // RUN: | FileCheck %s -check-prefix=CWD // CWD: "-o" "save-temps.i" // CWD: "-emit-llvm-uselists" -// CWD: "-disable-llvm-optzns" +// CWD: "-disable-llvm-passes" // CWD: "-o" "save-temps.bc" // CWD: "-o" "save-temps.s" // CWD: "-o" "save-temps.o" @@ -63,7 +63,7 @@ // RUN: %clang -target x86_64-apple-darwin -save-temps=obj -o obj/dir/a.out -arch x86_64 %s -### 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-OBJ // CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.i" -// CHECK-OBJ: "-disable-llvm-optzns" +// CHECK-OBJ: "-disable-llvm-passes" // CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.bc" // CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.s" // CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.o" @@ -72,7 +72,7 @@ // RUN: %clang -target x86_64-apple-darwin -save-temps=obj -arch x86_64 %s -### 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-OBJ-NOO // CHECK-OBJ-NOO: "-o" "save-temps.i" -// CHECK-OBJ-NOO: "-disable-llvm-optzns" +// CHECK-OBJ-NOO: "-disable-llvm-passes" // CHECK-OBJ-NOO: "-o" "save-temps.bc" // CHECK-OBJ-NOO: "-o" "save-temps.s" // CHECK-OBJ-NOO: "-o" "save-temps.o" diff --git a/test/Driver/shave-toolchain.c b/test/Driver/shave-toolchain.c deleted file mode 100644 index a02d049..0000000 --- a/test/Driver/shave-toolchain.c +++ /dev/null @@ -1,22 +0,0 @@ -// Ensure that '-target shave' picks a different compiler. -// Also check that '-I' is turned into '-i:' for the assembler. - -// Note that since we don't know where movi tools are installed, -// the driver may or may not find a full path to them. -// That is, the 0th argument will be "/path/to/my/moviCompile" -// or just "moviCompile" depending on whether moviCompile is found. -// As such, we test only for a trailing quote in its rendering. -// The same goes for "moviAsm". - -// RUN: %clang -target shave -c -### %s -Icommon 2>&1 \ -// RUN: | FileCheck %s -check-prefix=movicompile -// movicompile: moviCompile" "-DMYRIAD2" -// movicompile: moviAsm" "-no6thSlotCompression" "-cv:myriad2" "-noSPrefixing" "-a" "-i:common" "-elf" - -// RUN: %clang -target shave -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \ -// RUN: | FileCheck %s -check-prefix=defines -// defines: "-D" "EFINE_ME" "-U" "NDEFINE_ME" - -// RUN: %clang -target shave -c -### %s -Icommon -iquote quotepath -isystem syspath 2>&1 \ -// RUN: | FileCheck %s -check-prefix=includes -// includes: "-iquote" "quotepath" "-isystem" "syspath" diff --git a/test/Driver/solaris-header-search.cpp b/test/Driver/solaris-header-search.cpp new file mode 100644 index 0000000..667b2c0 --- /dev/null +++ b/test/Driver/solaris-header-search.cpp @@ -0,0 +1,11 @@ +// Test that the C++ headers are found. +// +// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \ +// RUN: --target=sparc-sun-solaris2.11 \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/sparc-sun-solaris2.11 \ +// RUN: | FileCheck %s +// CHECK: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK: "-internal-isystem" "{{.*}}/usr/include/c++/v1/support/solaris" +// CHECK: "-internal-isystem" "{{.*}}/usr/gcc/4.8/include/c++/4.8.2" +// CHECK: "-internal-isystem" "{{.*}}/usr/gcc/4.8/include/c++/4.8.2/sparc-sun-solaris2.11" diff --git a/test/Driver/solaris-ld.c b/test/Driver/solaris-ld.c new file mode 100644 index 0000000..d871b59 --- /dev/null +++ b/test/Driver/solaris-ld.c @@ -0,0 +1,33 @@ +// Test ld invocation on Solaris targets. + +// Check sparc-sun-solaris2.1 +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=sparc-sun-solaris2.11 \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/sparc-sun-solaris2.11 \ +// RUN: | FileCheck %s +// CHECK: "-cc1" "-triple" "sparc-sun-solaris2.11" +// CHECK: ld{{.*}}" +// CHECK: "--dynamic-linker" "{{.*}}/usr/lib/ld.so.1" +// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crt1.o" +// CHECK: "{{.*}}/usr/lib/crti.o" +// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crtbegin.o" +// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crtend.o" +// CHECK: "{{.*}}/usr/lib/crtn.o" +// CHECK "-lc" +// CHECK "-lgcc_s" +// CHECK "-lgcc" +// CHECK "-lm" + +// Check the right -l flags are present with -shared +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o -shared 2>&1 \ +// RUN: --target=sparc-sun-solaris2.11 \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/sparc-sun-solaris2.11 \ +// RUN: | FileCheck --check-prefix=CHECK-SHARED %s + +// CHECK-SHARED: ld{{.*}}" +// CHECK-SHARED "-lc" +// CHECK-SHARED "-lgcc_s" +// CHECK-SHARED-NOT "-lgcc" +// CHECK-SHARED-NOT: "-lm" diff --git a/test/Driver/solaris-opts.c b/test/Driver/solaris-opts.c new file mode 100644 index 0000000..8c54ae0 --- /dev/null +++ b/test/Driver/solaris-opts.c @@ -0,0 +1,4 @@ +// RUN: %clang %s --target=sparc-sun-solaris2.11 -### -o %t.o 2>&1 | FileCheck %s + +// CHECK: "-fno-use-cxa-atexit" + diff --git a/test/Driver/sparc-as.c b/test/Driver/sparc-as.c new file mode 100644 index 0000000..5b93995 --- /dev/null +++ b/test/Driver/sparc-as.c @@ -0,0 +1,85 @@ +// Make sure Sparc does not use the integrated assembler by default. + +// RUN: %clang -target sparc-linux -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=NO-IAS %s + +// RUN: %clang -target sparc-linux -fintegrated-as -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=IAS %s + +// RUN: %clang -target sparc-linux -fno-integrated-as -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=NO-IAS %s + +// IAS-NOT: "-no-integrated-as" +// NO-IAS: "-no-integrated-as" + +// RUN: %clang -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC %s + +// RUN: %clang -mcpu=v8 -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// RUN: %clang -mcpu=supersparc -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// RUN: %clang -mcpu=sparclite -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-SPARCLITE %s + +// RUN: %clang -mcpu=f934 -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-SPARCLITE %s + +// RUN: %clang -mcpu=hypersparc -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// RUN: %clang -mcpu=sparclite86x -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-SPARCLITE %s + +// RUN: %clang -mcpu=sparclet -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-SPARCLET %s + +// RUN: %clang -mcpu=tsc701 -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-SPARCLET %s + +// RUN: %clang -mcpu=v9 -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8PLUS %s + +// RUN: %clang -mcpu=ultrasparc -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8PLUS %s + +// RUN: %clang -mcpu=ultrasparc3 -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8PLUS %s + +// RUN: %clang -mcpu=niagara -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8PLUSB %s + +// RUN: %clang -mcpu=niagara2 -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8PLUSB %s + +// RUN: %clang -mcpu=niagara3 -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8PLUSD %s + +// RUN: %clang -mcpu=niagara4 -no-canonical-prefixes -target sparc--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8PLUSD %s + +// SPARC: as{{.*}}" "-32" "-Av8" "-o" +// SPARC-V8: as{{.*}}" "-32" "-Av8" "-o" +// SPARC-SPARCLITE: as{{.*}}" "-32" "-Asparclite" "-o" +// SPARC-SPARCLET: as{{.*}}" "-32" "-Asparclet" "-o" +// SPARC-V8PLUS: as{{.*}}" "-32" "-Av8plus" "-o" +// SPARC-V8PLUSB: as{{.*}}" "-32" "-Av8plusb" "-o" +// SPARC-V8PLUSD: as{{.*}}" "-32" "-Av8plusd" "-o" diff --git a/test/Driver/sparcv9-as.c b/test/Driver/sparcv9-as.c new file mode 100644 index 0000000..3b641cc --- /dev/null +++ b/test/Driver/sparcv9-as.c @@ -0,0 +1,86 @@ +// Make sure SparcV9 does not use the integrated assembler by default. + +// RUN: %clang -target sparcv9-linux -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=NO-IAS %s + +// RUN: %clang -target sparcv9-linux -fintegrated-as -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=IAS %s + +// RUN: %clang -target sparcv9-linux -fno-integrated-as -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=NO-IAS %s + +// IAS-NOT: "-no-integrated-as" +// NO-IAS: "-no-integrated-as" + +// RUN: %clang -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC %s + +// RUN: %clang -mcpu=v9 -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V9 %s + +// RUN: %clang -mcpu=ultrasparc -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V9 %s + +// RUN: %clang -mcpu=ultrasparc3 -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V9 %s + +// RUN: %clang -mcpu=niagara -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V9B %s + +// RUN: %clang -mcpu=niagara2 -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V9B %s + +// RUN: %clang -mcpu=niagara3 -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V9D %s + +// RUN: %clang -mcpu=niagara4 -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V9D %s + +// SPARC: as{{.*}}" "-64" "-Av9" "-o" +// SPARC-V9: as{{.*}}" "-64" "-Av9" "-o" +// SPARC-V9B: as{{.*}}" "-64" "-Av9b" "-o" +// SPARC-V9D: as{{.*}}" "-64" "-Av9d" "-o" + +// RUN: not %clang -mcpu=v8 -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -c 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// RUN: not %clang -mcpu=supersparc -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -c 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// RUN: not %clang -mcpu=sparclite -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -c 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// RUN: not %clang -mcpu=f934 -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -c 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// RUN: not %clang -mcpu=hypersparc -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -c 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// RUN: not %clang -mcpu=sparclite86x -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -c 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// RUN: not %clang -mcpu=sparclet -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -c 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// RUN: not %clang -mcpu=tsc701 -no-canonical-prefixes -target sparcv9--netbsd \ +// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -c 2>&1 \ +// RUN: | FileCheck -check-prefix=SPARC-V8 %s + +// SPARC-V8: error: unknown target CPU + +int x; diff --git a/test/Driver/split-debug.c b/test/Driver/split-debug.c index 6296c46..ed66852 100644 --- a/test/Driver/split-debug.c +++ b/test/Driver/split-debug.c @@ -32,3 +32,29 @@ // RUN: FileCheck -check-prefix=CHECK-IAS < %t %s // // CHECK-IAS: objcopy + +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -S -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-GMLT-OVER-SPLIT < %t %s +// +// CHECK-GMLT-OVER-SPLIT: "-debug-info-kind=line-tables-only" +// CHECK-GMLT-OVER-SPLIT-NOT: "-split-dwarf=Enable" +// CHECK-GMLT-OVER-SPLIT-NOT: "-split-dwarf-file" + +// RUN: %clang -target x86_64-unknown-linux-gnu -gmlt -gsplit-dwarf -S -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-SPLIT-OVER-GMLT < %t %s +// +// CHECK-SPLIT-OVER-GMLT: "-split-dwarf=Enable" "-debug-info-kind=limited" +// CHECK-SPLIT-OVER-GMLT: "-split-dwarf-file" + +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -g0 -S -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-G0-OVER-SPLIT < %t %s +// +// CHECK-G0-OVER-SPLIT-NOT: "-debug-info-kind +// CHECK-G0-OVER-SPLIT-NOT: "-split-dwarf=Enable" +// CHECK-G0-OVER-SPLIT-NOT: "-split-dwarf-file" + +// RUN: %clang -target x86_64-unknown-linux-gnu -g0 -gsplit-dwarf -S -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-SPLIT-OVER-G0 < %t %s +// +// CHECK-SPLIT-OVER-G0: "-split-dwarf=Enable" "-debug-info-kind=limited" +// CHECK-SPLIT-OVER-G0: "-split-dwarf-file" diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c index 7fecd1b..487af56 100644 --- a/test/Driver/stack-protector.c +++ b/test/Driver/stack-protector.c @@ -23,3 +23,12 @@ // RUN: %clang -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SSP-ALL // SSP-ALL: "-stack-protector" "3" // SSP-ALL-NOT: "-stack-protector-buffer-size" + +// RUN: %clang -target x86_64-scei-ps4 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4 +// RUN: %clang -target x86_64-scei-ps4 -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4 +// SSP-PS4: "-stack-protector" "2" +// SSP-PS4-NOT: "-stack-protector-buffer-size" + +// RUN: %clang -target x86_64-scei-ps4 -fstack-protector --param ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4-BUF +// SSP-PS4-BUF: "-stack-protector" "2" +// SSP-PS4-BUF: "-stack-protector-buffer-size" "16" diff --git a/test/Driver/stackrealign.c b/test/Driver/stackrealign.c index c5221d6..217be7a 100644 --- a/test/Driver/stackrealign.c +++ b/test/Driver/stackrealign.c @@ -1,12 +1,7 @@ -// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=NORMAL -// NORMAL-NOT: -force-align-stack -// NORMAL: -mstackrealign +// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=NO-REALIGN +// RUN: %clang -### -mno-stackrealign -mstackrealign %s 2>&1 | FileCheck %s -check-prefix=REALIGN +// RUN: %clang -### -mstackrealign -mno-stackrealign %s 2>&1 | FileCheck %s -check-prefix=NO-REALIGN +// REQUIRES: clang-driver -// RUN: %clang -### -mstackrealign %s 2>&1 | FileCheck %s -check-prefix=MREALIGN -// MREALIGN: -force-align-stack -// MREALIGN: -mstackrealign - -// RUN: %clang -### -mno-stackrealign %s 2>&1 | \ -// RUN: FileCheck %s -check-prefix=MNOREALIGN -// MNOREALIGN-NOT: -force-align-stack -// MNOREALIGN-NOT: -mstackrealign +// REALIGN: -mstackrealign +// NO-REALIGN-NOT: -mstackrealign diff --git a/test/Driver/thinlto.c b/test/Driver/thinlto.c new file mode 100644 index 0000000..0369b78 --- /dev/null +++ b/test/Driver/thinlto.c @@ -0,0 +1,37 @@ +// -flto=thin causes a switch to llvm-bc object files. +// RUN: %clang -ccc-print-phases -c %s -flto=thin 2> %t +// RUN: FileCheck -check-prefix=CHECK-COMPILE-ACTIONS < %t %s +// +// CHECK-COMPILE-ACTIONS: 2: compiler, {1}, ir +// CHECK-COMPILE-ACTIONS: 3: backend, {2}, lto-bc + +// RUN: %clang -ccc-print-phases %s -flto=thin 2> %t +// RUN: FileCheck -check-prefix=CHECK-COMPILELINK-ACTIONS < %t %s +// +// CHECK-COMPILELINK-ACTIONS: 0: input, "{{.*}}thinlto.c", c +// CHECK-COMPILELINK-ACTIONS: 1: preprocessor, {0}, cpp-output +// CHECK-COMPILELINK-ACTIONS: 2: compiler, {1}, ir +// CHECK-COMPILELINK-ACTIONS: 3: backend, {2}, lto-bc +// CHECK-COMPILELINK-ACTIONS: 4: linker, {3}, image + +// -flto=thin should cause link using gold plugin with thinlto option, +// also confirm that it takes precedence over earlier -fno-lto and -flto=full. +// RUN: %clang -target x86_64-unknown-linux -### %s -flto=full -fno-lto -flto=thin 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-THIN-ACTION < %t %s +// +// CHECK-LINK-THIN-ACTION: "-plugin" "{{.*}}/LLVMgold.so" +// CHECK-LINK-THIN-ACTION: "-plugin-opt=thinlto" + +// Check that subsequent -flto=full takes precedence +// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -flto=full 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-FULL-ACTION < %t %s +// +// CHECK-LINK-FULL-ACTION: "-plugin" "{{.*}}/LLVMgold.so" +// CHECK-LINK-FULL-ACTION-NOT: "-plugin-opt=thinlto" + +// Check that subsequent -fno-lto takes precedence +// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -fno-lto 2> %t +// RUN: FileCheck -check-prefix=CHECK-LINK-NOLTO-ACTION < %t %s +// +// CHECK-LINK-NOLTO-ACTION-NOT: "-plugin" "{{.*}}/LLVMgold.so" +// CHECK-LINK-NOLTO-ACTION-NOT: "-plugin-opt=thinlto" diff --git a/test/Driver/thinlto_backend.c b/test/Driver/thinlto_backend.c new file mode 100644 index 0000000..6def582 --- /dev/null +++ b/test/Driver/thinlto_backend.c @@ -0,0 +1,10 @@ +// RUN: %clang -O2 %s -flto=thin -c -o %t.o +// RUN: llvm-lto -thinlto -o %t %t.o + +// -fthinlto_index should be passed to cc1 +// RUN: %clang -O2 -o %t1.o -x ir %t.o -c -fthinlto-index=%t.thinlto.bc -### 2>&1 | FileCheck %s -check-prefix=CHECK-THINLTOBE-ACTION +// CHECK-THINLTOBE-ACTION: -fthinlto-index= + +// Ensure clang driver gives the expected error for incorrect input type +// RUN: not %clang -O2 -o %t1.o %s -c -fthinlto-index=%t.thinlto.bc 2>&1 | FileCheck %s -check-prefix=CHECK-WARNING +// CHECK-WARNING: error: invalid argument '-fthinlto-index={{.*}}' only allowed with '-x ir' diff --git a/test/Driver/thread-model.c b/test/Driver/thread-model.c index 9702c22..d01ef1c 100644 --- a/test/Driver/thread-model.c +++ b/test/Driver/thread-model.c @@ -13,3 +13,19 @@ // CHECK-LINUX-SINGLE: Thread model: single // CHECK-LINUX-SINGLE: "-mthread-model" "single" // CHECK-LINUX-INVALID-NOT: Thread model: + +// RUN: %clang -### -target wasm32-unknown-linux-gnu -c %s -v 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-DEFAULT %s +// RUN: %clang -### -target wasm32-unknown-linux-gnu -c %s -v -mthread-model single 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-SINGLE %s +// RUN: %clang -### -target wasm32-unknown-linux-gnu -c %s -v -mthread-model posix 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-POSIX %s +// RUN: %clang -### -target wasm32-unknown-linux-gnu -c %s -v -mthread-model silly 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-INVALID %s +// RUN: %clang -### -target wasm64-unknown-linux-gnu -c %s -v 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-DEFAULT %s +// RUN: %clang -### -target wasm64-unknown-linux-gnu -c %s -v -mthread-model single 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-SINGLE %s +// RUN: %clang -### -target wasm64-unknown-linux-gnu -c %s -v -mthread-model posix 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-POSIX %s +// RUN: %clang -### -target wasm64-unknown-linux-gnu -c %s -v -mthread-model silly 2>&1 | FileCheck -check-prefix=CHECK-WEBASSEMBLY-INVALID %s +// CHECK-WEBASSEMBLY-DEFAULT: Thread model: posix +// CHECK-WEBASSEMBLY-DEFAULT: "-mthread-model" "posix" +// CHECK-WEBASSEMBLY-SINGLE: Thread model: single +// CHECK-WEBASSEMBLY-SINGLE: "-mthread-model" "single" +// CHECK-WEBASSEMBLY-POSIX: Thread model: posix +// CHECK-WEBASSEMBLY-POSIX: "-mthread-model" "posix" +// CHECK-WEBASSEMBLY-INVALID-NOT: Thread model: diff --git a/test/Driver/wasm-toolchain.c b/test/Driver/wasm-toolchain.c new file mode 100644 index 0000000..4d707a0 --- /dev/null +++ b/test/Driver/wasm-toolchain.c @@ -0,0 +1,3 @@ +// RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown -x assembler %s 2>&1 | FileCheck -check-prefix=AS_LINK %s +// AS_LINK: clang{{.*}}" "-cc1as" {{.*}} "-o" "[[temp:[^"]*]]" +// AS_LINK: lld{{.*}}" "-flavor" "ld" "[[temp]]" "-o" "a.out" diff --git a/test/Driver/wasm32-unknown-unknown.cpp b/test/Driver/wasm32-unknown-unknown.cpp new file mode 100644 index 0000000..c474287 --- /dev/null +++ b/test/Driver/wasm32-unknown-unknown.cpp @@ -0,0 +1,119 @@ +// RUN: %clang -target wasm32-unknown-unknown -### %s -emit-llvm-only -c 2>&1 \ +// RUN: | FileCheck %s -check-prefix=ECHO +// RUN: %clang -target wasm32-unknown-unknown %s -emit-llvm -S -o - \ +// RUN: | FileCheck %s +// RUN: %clang -target wasm32-unknown-unknown %s -emit-llvm -S -pthread -o - \ +// RUN: | FileCheck %s -check-prefix=THREADS + +// ECHO: {{.*}} "-cc1" {{.*}}wasm32-unknown-unknown.c + +typedef __builtin_va_list va_list; +typedef __SIZE_TYPE__ size_t; +typedef __PTRDIFF_TYPE__ ptrdiff_t; + +extern "C" { + +// CHECK: @align_c = global i32 1 +int align_c = __alignof(char); + +// CHECK: @align_s = global i32 2 +int align_s = __alignof(short); + +// CHECK: @align_i = global i32 4 +int align_i = __alignof(int); + +// CHECK: @align_l = global i32 4 +int align_l = __alignof(long); + +// CHECK: @align_ll = global i32 8 +int align_ll = __alignof(long long); + +// CHECK: @align_p = global i32 4 +int align_p = __alignof(void*); + +// CHECK: @align_f = global i32 4 +int align_f = __alignof(float); + +// CHECK: @align_d = global i32 8 +int align_d = __alignof(double); + +// CHECK: @align_ld = global i32 16 +int align_ld = __alignof(long double); + +// CHECK: @align_vl = global i32 4 +int align_vl = __alignof(va_list); + +// CHECK: _GNU_SOURCEdefined +#ifdef _GNU_SOURCE +void _GNU_SOURCEdefined() {} +#endif + +// THREADS: _REENTRANTdefined +// CHECK: _REENTRANTundefined +#ifdef _REENTRANT +void _REENTRANTdefined() {} +#else +void _REENTRANTundefined() {} +#endif + +// Check types + +// CHECK: signext i8 @check_char() +char check_char() { return 0; } + +// CHECK: signext i16 @check_short() +short check_short() { return 0; } + +// CHECK: i32 @check_int() +int check_int() { return 0; } + +// CHECK: i32 @check_long() +long check_long() { return 0; } + +// CHECK: i64 @check_longlong() +long long check_longlong() { return 0; } + +// CHECK: zeroext i8 @check_uchar() +unsigned char check_uchar() { return 0; } + +// CHECK: zeroext i16 @check_ushort() +unsigned short check_ushort() { return 0; } + +// CHECK: i32 @check_uint() +unsigned int check_uint() { return 0; } + +// CHECK: i32 @check_ulong() +unsigned long check_ulong() { return 0; } + +// CHECK: i64 @check_ulonglong() +unsigned long long check_ulonglong() { return 0; } + +// CHECK: i32 @check_size_t() +size_t check_size_t() { return 0; } + +// CHECK: float @check_float() +float check_float() { return 0; } + +// CHECK: double @check_double() +double check_double() { return 0; } + +// CHECK: fp128 @check_longdouble() +long double check_longdouble() { return 0; } + +} + +template<int> void Switch(); +template<> void Switch<4>(); +template<> void Switch<8>(); +template<> void Switch<16>(); + +void check_pointer_size() { + // CHECK: SwitchILi4 + Switch<sizeof(void*)>(); + + // CHECK: SwitchILi8 + Switch<sizeof(long long)>(); + + // CHECK: SwitchILi4 + Switch<sizeof(va_list)>(); +} diff --git a/test/Driver/wasm64-unknown-unknown.cpp b/test/Driver/wasm64-unknown-unknown.cpp new file mode 100644 index 0000000..c33f4e5 --- /dev/null +++ b/test/Driver/wasm64-unknown-unknown.cpp @@ -0,0 +1,119 @@ +// RUN: %clang -target wasm64-unknown-unknown -### %s -emit-llvm-only -c 2>&1 \ +// RUN: | FileCheck %s -check-prefix=ECHO +// RUN: %clang -target wasm64-unknown-unknown %s -emit-llvm -S -o - \ +// RUN: | FileCheck %s +// RUN: %clang -target wasm64-unknown-unknown %s -emit-llvm -S -pthread -o - \ +// RUN: | FileCheck %s -check-prefix=THREADS + +// ECHO: {{.*}} "-cc1" {{.*}}wasm64-unknown-unknown.c + +typedef __builtin_va_list va_list; +typedef __SIZE_TYPE__ size_t; +typedef __PTRDIFF_TYPE__ ptrdiff_t; + +extern "C" { + +// CHECK: @align_c = global i32 1 +int align_c = __alignof(char); + +// CHECK: @align_s = global i32 2 +int align_s = __alignof(short); + +// CHECK: @align_i = global i32 4 +int align_i = __alignof(int); + +// CHECK: @align_l = global i32 8 +int align_l = __alignof(long); + +// CHECK: @align_ll = global i32 8 +int align_ll = __alignof(long long); + +// CHECK: @align_p = global i32 8 +int align_p = __alignof(void*); + +// CHECK: @align_f = global i32 4 +int align_f = __alignof(float); + +// CHECK: @align_d = global i32 8 +int align_d = __alignof(double); + +// CHECK: @align_ld = global i32 16 +int align_ld = __alignof(long double); + +// CHECK: @align_vl = global i32 8 +int align_vl = __alignof(va_list); + +// CHECK: _GNU_SOURCEdefined +#ifdef _GNU_SOURCE +void _GNU_SOURCEdefined() {} +#endif + +// THREADS: _REENTRANTdefined +// CHECK: _REENTRANTundefined +#ifdef _REENTRANT +void _REENTRANTdefined() {} +#else +void _REENTRANTundefined() {} +#endif + +// Check types + +// CHECK: signext i8 @check_char() +char check_char() { return 0; } + +// CHECK: signext i16 @check_short() +short check_short() { return 0; } + +// CHECK: i32 @check_int() +int check_int() { return 0; } + +// CHECK: i64 @check_long() +long check_long() { return 0; } + +// CHECK: i64 @check_longlong() +long long check_longlong() { return 0; } + +// CHECK: zeroext i8 @check_uchar() +unsigned char check_uchar() { return 0; } + +// CHECK: zeroext i16 @check_ushort() +unsigned short check_ushort() { return 0; } + +// CHECK: i32 @check_uint() +unsigned int check_uint() { return 0; } + +// CHECK: i64 @check_ulong() +unsigned long check_ulong() { return 0; } + +// CHECK: i64 @check_ulonglong() +unsigned long long check_ulonglong() { return 0; } + +// CHECK: i64 @check_size_t() +size_t check_size_t() { return 0; } + +// CHECK: float @check_float() +float check_float() { return 0; } + +// CHECK: double @check_double() +double check_double() { return 0; } + +// CHECK: fp128 @check_longdouble() +long double check_longdouble() { return 0; } + +} + +template<int> void Switch(); +template<> void Switch<4>(); +template<> void Switch<8>(); +template<> void Switch<16>(); + +void check_pointer_size() { + // CHECK: SwitchILi8 + Switch<sizeof(void*)>(); + + // CHECK: SwitchILi8 + Switch<sizeof(long long)>(); + + // CHECK: SwitchILi8 + Switch<sizeof(va_list)>(); +} diff --git a/test/Driver/watchos-version-min.c b/test/Driver/watchos-version-min.c new file mode 100644 index 0000000..8f12285 --- /dev/null +++ b/test/Driver/watchos-version-min.c @@ -0,0 +1,7 @@ +// REQUIRES: x86-registered-target +// REQUIRES: arm-registered-target +// RUN: %clang -target i386-apple-darwin10 -mwatchsimulator-version-min=2.0 -arch i386 -S -o - %s | FileCheck %s +// RUN: %clang -target armv7s-apple-darwin10 -mwatchos-version-min=2.0 -arch armv7k -S -o - %s | FileCheck %s + +int main() { return 0; } +// CHECK: .watchos_version_min 2, 0 diff --git a/test/Driver/windows-cross.c b/test/Driver/windows-cross.c index 979f685..d355fbc 100644 --- a/test/Driver/windows-cross.c +++ b/test/Driver/windows-cross.c @@ -38,3 +38,32 @@ // CHECK-LIBSTDCXX: "-internal-isystem" "{{.*}}/usr/include/c++" "-internal-isystem" "{{.*}}/usr/include/c++/armv7--windows-itanium" "-internal-isystem" "{{.*}}/usr/include/c++/backwards" +// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -shared -o shared.dll -x c++ %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix CHECK-FUSE-LD + +// CHECK-FUSE-LD: "{{.*}}lld-link2" + +// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=address -x c++ %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS + +// CHECK-SANITIZE-ADDRESS: "-fsanitize=address" +// CHECK-SANITIZE-ADDRESS: "{{.*}}clang_rt.asan_dll_thunk-arm.lib" + +// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -o test.exe -fsanitize=address -x c++ %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE + +// CHECK-SANITIZE-ADDRESS-EXE: "-fsanitize=address" +// CHECK-SANITIZE-ADDRESS-EXE: "{{.*}}clang_rt.asan_dynamic-arm.lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk-arm.lib" "--undefined" "__asan_seh_interceptor" + +// RUN: %clang -### -target i686-windows-itanium -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -o test.exe -fsanitize=address -x c++ %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE-X86 + +// CHECK-SANITIZE-ADDRESS-EXE-X86: "-fsanitize=address" +// CHECK-SANITIZE-ADDRESS-EXE-X86: "{{.*}}clang_rt.asan_dynamic-i686.lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk-i686.lib" "--undefined" "___asan_seh_interceptor" + +// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=tsan -x c++ %s 2>&1 \ +// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-TSAN + +// CHECK-SANITIZE-TSAN: error: unsupported argument 'tsan' to option 'fsanitize=' +// CHECK-SANITIZE-TSAN-NOT: "-fsanitize={{.*}}" + diff --git a/test/Driver/woa-fp.c b/test/Driver/woa-fp.c new file mode 100644 index 0000000..f851e93 --- /dev/null +++ b/test/Driver/woa-fp.c @@ -0,0 +1,40 @@ +// RUN: %clang -target armv7-windows-msvc -### -S %s -O0 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT +// RUN: %clang -target armv7-windows-msvc -### -S %s -O1 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT +// RUN: %clang -target armv7-windows-msvc -### -S %s -O2 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT +// RUN: %clang -target armv7-windows-msvc -### -S %s -O3 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT +// RUN: %clang -target armv7-windows-msvc -### -S %s -Os -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT + +// RUN: %clang -target armv7-windows-itanium -### -S %s -O0 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT +// RUN: %clang -target armv7-windows-itanium -### -S %s -O1 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT +// RUN: %clang -target armv7-windows-itanium -### -S %s -O2 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT +// RUN: %clang -target armv7-windows-itanium -### -S %s -O3 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT +// RUN: %clang -target armv7-windows-itanium -### -S %s -Os -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-DEFAULT + +// RUN: %clang -target armv7-windows-msvc -fomit-frame-pointer -### -S %s -O0 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-FPO +// RUN: %clang -target armv7-windows-msvc -fomit-frame-pointer -### -S %s -O1 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-FPO +// RUN: %clang -target armv7-windows-msvc -fomit-frame-pointer -### -S %s -O2 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-FPO +// RUN: %clang -target armv7-windows-msvc -fomit-frame-pointer -### -S %s -O3 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-FPO +// RUN: %clang -target armv7-windows-msvc -fomit-frame-pointer -### -S %s -Os -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-FPO + +// RUN: %clang -target armv7-windows-itanium -fomit-frame-pointer -### -S %s -O0 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-FPO +// RUN: %clang -target armv7-windows-itanium -fomit-frame-pointer -### -S %s -O1 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-FPO +// RUN: %clang -target armv7-windows-itanium -fomit-frame-pointer -### -S %s -O2 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-FPO +// RUN: %clang -target armv7-windows-itanium -fomit-frame-pointer -### -S %s -O3 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-FPO +// RUN: %clang -target armv7-windows-itanium -fomit-frame-pointer -### -S %s -Os -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-FPO + +// RUN: %clang -target armv7-windows-msvc -fno-omit-frame-pointer -### -S %s -O0 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-NO-FPO +// RUN: %clang -target armv7-windows-msvc -fno-omit-frame-pointer -### -S %s -O1 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-NO-FPO +// RUN: %clang -target armv7-windows-msvc -fno-omit-frame-pointer -### -S %s -O2 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-NO-FPO +// RUN: %clang -target armv7-windows-msvc -fno-omit-frame-pointer -### -S %s -O3 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-NO-FPO +// RUN: %clang -target armv7-windows-msvc -fno-omit-frame-pointer -### -S %s -Os -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-NO-FPO + +// RUN: %clang -target armv7-windows-itanium -fno-omit-frame-pointer -### -S %s -O0 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-NO-FPO +// RUN: %clang -target armv7-windows-itanium -fno-omit-frame-pointer -### -S %s -O1 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-NO-FPO +// RUN: %clang -target armv7-windows-itanium -fno-omit-frame-pointer -### -S %s -O2 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-NO-FPO +// RUN: %clang -target armv7-windows-itanium -fno-omit-frame-pointer -### -S %s -O3 -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-NO-FPO +// RUN: %clang -target armv7-windows-itanium -fno-omit-frame-pointer -### -S %s -Os -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-NO-FPO + +// CHECK-DEFAULT: "-mdisable-fp-elim" +// CHECK-FPO-NOT: "-mdisable-fp-elim" +// CHECK-NO-FPO: "-mdisable-fp-elim" + diff --git a/test/Driver/working-directory.c b/test/Driver/working-directory.c index 195abac..15ba8f0 100644 --- a/test/Driver/working-directory.c +++ b/test/Driver/working-directory.c @@ -1,4 +1,3 @@ // RUN: %clang -### -working-directory /no/such/dir/ input 2>&1 | FileCheck %s -// REQUIRES: shell-preserves-root //CHECK: no such file or directory: '/no/such/dir/input' |