diff options
Diffstat (limited to 'test/Driver')
76 files changed, 1368 insertions, 252 deletions
diff --git a/test/Driver/Inputs/hip_dev_lib/irif.amdgcn.bc b/test/Driver/Inputs/basic_android_ndk_tree/sysroot/usr/include/c++/v1/.keep index e69de29bb2..e69de29bb2 100644 --- a/test/Driver/Inputs/hip_dev_lib/irif.amdgcn.bc +++ b/test/Driver/Inputs/basic_android_ndk_tree/sysroot/usr/include/c++/v1/.keep diff --git a/test/Driver/Inputs/basic_hurd_tree/include/.keep b/test/Driver/Inputs/basic_hurd_tree/include/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/basic_hurd_tree/include/.keep diff --git a/test/Driver/Inputs/basic_hurd_tree/lib/i386-gnu/.keep b/test/Driver/Inputs/basic_hurd_tree/lib/i386-gnu/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/basic_hurd_tree/lib/i386-gnu/.keep diff --git a/test/Driver/Inputs/basic_hurd_tree/lib32/.keep b/test/Driver/Inputs/basic_hurd_tree/lib32/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/basic_hurd_tree/lib32/.keep diff --git a/test/Driver/Inputs/basic_hurd_tree/usr/include/i386-gnu/.keep b/test/Driver/Inputs/basic_hurd_tree/usr/include/i386-gnu/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/basic_hurd_tree/usr/include/i386-gnu/.keep diff --git a/test/Driver/Inputs/basic_hurd_tree/usr/lib/i386-gnu/.keep b/test/Driver/Inputs/basic_hurd_tree/usr/lib/i386-gnu/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/basic_hurd_tree/usr/lib/i386-gnu/.keep diff --git a/test/Driver/Inputs/basic_hurd_tree/usr/lib32/.keep b/test/Driver/Inputs/basic_hurd_tree/usr/lib32/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/basic_hurd_tree/usr/lib32/.keep diff --git a/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g++/backward/.keep b/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g++/backward/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/include/g++/backward/.keep diff --git a/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o b/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o diff --git a/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c++/4.8/.keep b/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c++/4.8/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/cray_suse_gcc_tree/usr/include/c++/4.8/.keep diff --git a/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o b/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/cray_suse_gcc_tree/usr/lib/gcc/x86_64-suse-linux/8.2.0/crtbegin.o diff --git a/test/Driver/Inputs/hip_dev_lib/hip.amdgcn.bc b/test/Driver/Inputs/hip_dev_lib/hip.amdgcn.bc new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/hip_dev_lib/hip.amdgcn.bc diff --git a/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/asan/.keep b/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/asan/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/asan/.keep diff --git a/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.xray-basic.a b/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.xray-basic.a new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.xray-basic.a diff --git a/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.xray.a b/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.xray.a new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/resource_dir_with_per_target_subdir/aarch64-fuchsia/lib/libclang_rt.xray.a diff --git a/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/asan/.keep b/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/asan/.keep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/asan/.keep diff --git a/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.xray-basic.a b/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.xray-basic.a new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.xray-basic.a diff --git a/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.xray.a b/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.xray.a new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/Driver/Inputs/resource_dir_with_per_target_subdir/x86_64-fuchsia/lib/libclang_rt.xray.a diff --git a/test/Driver/aarch64-mte.c b/test/Driver/aarch64-mte.c new file mode 100644 index 0000000000..89c9da9e70 --- /dev/null +++ b/test/Driver/aarch64-mte.c @@ -0,0 +1,13 @@ +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.4a+memtag %s 2>&1 | FileCheck %s +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.5a+memtag %s 2>&1 | FileCheck %s +// CHECK: "-target-feature" "+mte" + +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.4a+nomemtag %s 2>&1 | FileCheck %s --check-prefix=NOMTE +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.5a+nomemtag %s 2>&1 | FileCheck %s --check-prefix=NOMTE +// NOMTE: "-target-feature" "-mte" + +// RUN: %clang -### -target aarch64-none-none-eabi %s 2>&1 | FileCheck %s --check-prefix=ABSENTMTE +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.4a %s 2>&1 | FileCheck %s --check-prefix=ABSENTMTE +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8.5a %s 2>&1 | FileCheck %s --check-prefix=ABSENTMTE +// ABSENTMTE-NOT: "-target-feature" "+mte" +// ABSENTMTE-NOT: "-target-feature" "-mte" diff --git a/test/Driver/aarch64-security-options.c b/test/Driver/aarch64-security-options.c new file mode 100644 index 0000000000..9ba5067cc3 --- /dev/null +++ b/test/Driver/aarch64-security-options.c @@ -0,0 +1,54 @@ +// Check the -msign-return-address= option, which has a required argument to +// select scope. +// RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=none 2>&1 | \ +// RUN: FileCheck %s --check-prefix=RA-OFF --check-prefix=KEY-A --check-prefix=BTE-OFF + +// RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=non-leaf 2>&1 | \ +// RUN: FileCheck %s --check-prefix=RA-NON-LEAF --check-prefix=KEY-A --check-prefix=BTE-OFF + +// RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=all 2>&1 | \ +// RUN: FileCheck %s --check-prefix=RA-ALL --check-prefix=KEY-A --check-prefix=BTE-OFF + +// Check that the -msign-return-address= option can also accept the signing key +// to use. + +// RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=non-leaf 2>&1 | \ +// RUN: FileCheck %s --check-prefix=RA-NON-LEAF --check-prefix=KEY-B --check-prefix=BTE-OFF + +// RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=all 2>&1 | \ +// RUN: FileCheck %s --check-prefix=RA-ALL --check-prefix=KEY-B --check-prefix=BTE-OFF + +// -mbranch-protection with standard +// RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=standard 2>&1 | \ +// RUN: FileCheck %s --check-prefix=RA-NON-LEAF --check-prefix=KEY-A --check-prefix=BTE-ON + +// If the -msign-return-address and -mbranch-protection are both used, the +// right-most one controls return address signing. +// RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=non-leaf -mbranch-protection=none 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CONFLICT + +// RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=pac-ret -msign-return-address=none 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CONFLICT + +// RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=foo 2>&1 | \ +// RUN: FileCheck %s --check-prefix=BAD-RA-PROTECTION + +// RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=bar 2>&1 | \ +// RUN: FileCheck %s --check-prefix=BAD-BP-PROTECTION + +// RA-OFF: "-msign-return-address=none" +// RA-NON-LEAF: "-msign-return-address=non-leaf" +// RA-ALL: "-msign-return-address=all" + +// KEY-A: "-msign-return-address-key=a_key" + +// BTE-OFF-NOT: "-mbranch-target-enforce" +// BTE-ON: "-mbranch-target-enforce" + +// CONFLICT: "-msign-return-address=none" + +// BAD-RA-PROTECTION: invalid branch protection option 'foo' in '-msign-return-address={{.*}}' +// BAD-BP-PROTECTION: invalid branch protection option 'bar' in '-mbranch-protection={{.*}}' + +// BAD-B-KEY-COMBINATION: invalid branch protection option 'b-key' in '-mbranch-protection={{.*}}' +// BAD-LEAF-COMBINATION: invalid branch protection option 'leaf' in '-mbranch-protection={{.*}}' diff --git a/test/Driver/aarch64-ssbs.c b/test/Driver/aarch64-ssbs.c new file mode 100644 index 0000000000..86c93ae926 --- /dev/null +++ b/test/Driver/aarch64-ssbs.c @@ -0,0 +1,9 @@ +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8a+ssbs %s 2>&1 | FileCheck %s +// CHECK: "-target-feature" "+ssbs" + +// RUN: %clang -### -target aarch64-none-none-eabi -march=armv8a+nossbs %s 2>&1 | FileCheck %s --check-prefix=NOSSBS +// NOSSBS: "-target-feature" "-ssbs" + +// RUN: %clang -### -target aarch64-none-none-eabi %s 2>&1 | FileCheck %s --check-prefix=ABSENTSSBS +// ABSENTSSBS-NOT: "-target-feature" "+ssbs" +// ABSENTSSBS-NOT: "-target-feature" "-ssbs" diff --git a/test/Driver/amdgpu-features.c b/test/Driver/amdgpu-features.c index 0e54a5e251..15bcfed155 100644 --- a/test/Driver/amdgpu-features.c +++ b/test/Driver/amdgpu-features.c @@ -6,8 +6,20 @@ // RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s // CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops" "-target-feature" "+amdgpu-debugger-emit-prologue" +// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mcode-object-v3 %s 2>&1 | FileCheck --check-prefix=CODE-OBJECT-V3 %s +// CODE-OBJECT-V3: "-target-feature" "+code-object-v3" + +// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-code-object-v3 %s 2>&1 | FileCheck --check-prefix=NO-CODE-OBJECT-V3 %s +// NO-CODE-OBJECT-V3: "-target-feature" "-code-object-v3" + // RUN: %clang -### -target amdgcn -mcpu=gfx700 -mxnack %s 2>&1 | FileCheck --check-prefix=XNACK %s // XNACK: "-target-feature" "+xnack" // RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-xnack %s 2>&1 | FileCheck --check-prefix=NO-XNACK %s // NO-XNACK: "-target-feature" "-xnack" + +// RUN: %clang -### -target amdgcn -mcpu=gfx700 -msram-ecc %s 2>&1 | FileCheck --check-prefix=SRAM-ECC %s +// SRAM-ECC: "-target-feature" "+sram-ecc" + +// RUN: %clang -### -target amdgcn -mcpu=gfx700 -mno-sram-ecc %s 2>&1 | FileCheck --check-prefix=NO-SRAM-ECC %s +// NO-SRAM-ECC: "-target-feature" "-sram-ecc" diff --git a/test/Driver/amdgpu-macros.cl b/test/Driver/amdgpu-macros.cl index c57d3805be..09f28123b1 100644 --- a/test/Driver/amdgpu-macros.cl +++ b/test/Driver/amdgpu-macros.cl @@ -175,6 +175,7 @@ // RUN: %clang -E -dM -target amdgcn -mcpu=gfx902 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX902 %s // RUN: %clang -E -dM -target amdgcn -mcpu=gfx904 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX904 %s // RUN: %clang -E -dM -target amdgcn -mcpu=gfx906 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX906 %s +// RUN: %clang -E -dM -target amdgcn -mcpu=gfx909 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,GFX909 %s // GFX600-DAG: #define FP_FAST_FMA 1 // GFX601-DAG: #define FP_FAST_FMA 1 @@ -191,6 +192,7 @@ // GFX902-DAG: #define FP_FAST_FMA 1 // GFX904-DAG: #define FP_FAST_FMA 1 // GFX906-DAG: #define FP_FAST_FMA 1 +// GFX909-DAG: #define FP_FAST_FMA 1 // GFX600-DAG: #define FP_FAST_FMAF 1 // GFX601-NOT: #define FP_FAST_FMAF 1 @@ -207,6 +209,7 @@ // GFX902-DAG: #define FP_FAST_FMAF 1 // GFX904-DAG: #define FP_FAST_FMAF 1 // GFX906-DAG: #define FP_FAST_FMAF 1 +// GFX909-DAG: #define FP_FAST_FMAF 1 // ARCH-GCN-DAG: #define __AMDGCN__ 1 // ARCH-GCN-DAG: #define __AMDGPU__ 1 @@ -227,6 +230,7 @@ // GFX902-DAG: #define __HAS_FMAF__ 1 // GFX904-DAG: #define __HAS_FMAF__ 1 // GFX906-DAG: #define __HAS_FMAF__ 1 +// GFX909-DAG: #define __HAS_FMAF__ 1 // GFX600-DAG: #define __HAS_FP64__ 1 // GFX601-DAG: #define __HAS_FP64__ 1 @@ -243,6 +247,7 @@ // GFX902-DAG: #define __HAS_FP64__ 1 // GFX904-DAG: #define __HAS_FP64__ 1 // GFX906-DAG: #define __HAS_FP64__ 1 +// GFX909-DAG: #define __HAS_FP64__ 1 // GFX600-DAG: #define __HAS_LDEXPF__ 1 // GFX601-DAG: #define __HAS_LDEXPF__ 1 @@ -259,6 +264,7 @@ // GFX902-DAG: #define __HAS_LDEXPF__ 1 // GFX904-DAG: #define __HAS_LDEXPF__ 1 // GFX906-DAG: #define __HAS_LDEXPF__ 1 +// GFX909-DAG: #define __HAS_LDEXPF__ 1 // GFX600-DAG: #define __gfx600__ 1 // GFX601-DAG: #define __gfx601__ 1 @@ -275,3 +281,4 @@ // GFX902-DAG: #define __gfx902__ 1 // GFX904-DAG: #define __gfx904__ 1 // GFX906-DAG: #define __gfx906__ 1 +// GFX909-DAG: #define __gfx909__ 1 diff --git a/test/Driver/amdgpu-mcpu.cl b/test/Driver/amdgpu-mcpu.cl index c036e2ef09..4191d1884c 100644 --- a/test/Driver/amdgpu-mcpu.cl +++ b/test/Driver/amdgpu-mcpu.cl @@ -84,6 +84,7 @@ // RUN: %clang -### -target amdgcn -mcpu=gfx902 %s 2>&1 | FileCheck --check-prefix=GFX902 %s // RUN: %clang -### -target amdgcn -mcpu=gfx904 %s 2>&1 | FileCheck --check-prefix=GFX904 %s // RUN: %clang -### -target amdgcn -mcpu=gfx906 %s 2>&1 | FileCheck --check-prefix=GFX906 %s +// RUN: %clang -### -target amdgcn -mcpu=gfx909 %s 2>&1 | FileCheck --check-prefix=GFX909 %s // GFX600: "-target-cpu" "gfx600" // TAHITI: "-target-cpu" "tahiti" @@ -117,3 +118,4 @@ // GFX902: "-target-cpu" "gfx902" // GFX904: "-target-cpu" "gfx904" // GFX906: "-target-cpu" "gfx906" +// GFX909: "-target-cpu" "gfx909" diff --git a/test/Driver/android-aarch64-link.cpp b/test/Driver/android-aarch64-link.cpp index 2c4cfb9898..051bcd57b1 100644 --- a/test/Driver/android-aarch64-link.cpp +++ b/test/Driver/android-aarch64-link.cpp @@ -12,6 +12,11 @@ // RUN: -mcpu=cortex-a57 -### -v %s 2> %t // RUN: FileCheck -check-prefix=CORTEX-A57 < %t %s // +// RUN: %clang -target aarch64-none-linux-android \ +// RUN: -### -v %s 2> %t +// RUN: FileCheck -check-prefix=MAX-PAGE-SIZE < %t %s +// // GENERIC-ARM: --fix-cortex-a53-843419 // CORTEX-A53: --fix-cortex-a53-843419 // CORTEX-A57-NOT: --fix-cortex-a53-843419 +// MAX-PAGE-SIZE: max-page-size=4096 diff --git a/test/Driver/android-gcc-toolchain.c b/test/Driver/android-gcc-toolchain.c new file mode 100644 index 0000000000..17834132ad --- /dev/null +++ b/test/Driver/android-gcc-toolchain.c @@ -0,0 +1,8 @@ +// Test that gcc-toolchain option works correctly with a aarch64-linux-gnu +// triple. +// +// RUN: %clang %s -### -v --target=aarch64-linux-gnu \ +// RUN: --gcc-toolchain=%S/Inputs/basic_android_ndk_tree/ 2>&1 \ +// RUN: | FileCheck %s +// +// CHECK: Selected GCC installation: {{.*}}/Inputs/basic_android_ndk_tree/lib/gcc/aarch64-linux-android/4.9 diff --git a/test/Driver/android-ndk-standalone.cpp b/test/Driver/android-ndk-standalone.cpp index dd5ebe9754..c4d9399347 100644 --- a/test/Driver/android-ndk-standalone.cpp +++ b/test/Driver/android-ndk-standalone.cpp @@ -2,21 +2,13 @@ // toolchain. // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \ +// RUN: -target arm-linux-androideabi21 \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck %s // CHECK: {{.*}}clang{{.*}}" "-cc1" // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9" -// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" -// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" -// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" -// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" -// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" -// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" -// CHECK-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" -// CHECK: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK: "-internal-isystem" "{{.*}}/include/c++/v1" // CHECK: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" // CHECK: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include" // CHECK: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/arm-linux-androideabi" @@ -49,21 +41,47 @@ // CHECK-14: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target armv7a-none-linux-androideabi21 -stdlib=libstdc++ \ +// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \ +// RUN: -B%S/Inputs/basic_android_ndk_tree \ +// RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-STDCXX %s +// CHECK-STDCXX: {{.*}}clang{{.*}}" "-cc1" +// CHECK-STDCXX: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" +// CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9" +// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" +// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" +// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" +// CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" +// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" +// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" +// CHECK-STDCXX-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" +// CHECK-STDCXX: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-STDCXX: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb" +// CHECK-STDCXX: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a/thumb" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/armv7-a" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/thumb" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb" +// CHECK-STDCXX: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi/21" +// CHECK-STDCXX: "-L{{.*}}/sysroot/usr/lib/arm-linux-androideabi" +// CHECK-STDCXX: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/arm-linux-androideabi/lib" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a/thumb" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/armv7-a" +// CHECK-STDCXX-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib/thumb" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target armv7a-none-linux-androideabi21 \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-ARMV7 %s // CHECK-ARMV7: {{.*}}clang{{.*}}" "-cc1" // CHECK-ARMV7: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9" -// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" -// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" -// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" -// CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" -// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" -// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" -// CHECK-ARMV7-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" -// CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-ARMV7: "-internal-isystem" "{{.*}}/include/c++/v1" // CHECK-ARMV7: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" // CHECK-ARMV7: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include" // CHECK-ARMV7: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/arm-linux-androideabi" @@ -89,19 +107,19 @@ // // Other flags that can trigger armv7 mode. // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \ +// RUN: -target arm-linux-androideabi21 \ // RUN: -march=armv7 \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-ARMV7 %s // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \ +// RUN: -target arm-linux-androideabi21 \ // RUN: -march=armv7a \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-ARMV7 %s // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \ +// RUN: -target arm-linux-androideabi21 \ // RUN: -march=armv7-a \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ @@ -109,22 +127,14 @@ // // ARM thumb mode. // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \ +// RUN: -target arm-linux-androideabi21 \ // RUN: -mthumb \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-THUMB %s // CHECK-THUMB: {{.*}}clang{{.*}}" "-cc1" // CHECK-THUMB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9" -// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7/thumb" -// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7" -// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" -// CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" -// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7/thumb" -// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7" -// CHECK-THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" -// CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-THUMB: "-internal-isystem" "{{.*}}/include/c++/v1" // CHECK-THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" // CHECK-THUMB: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include" // CHECK-THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/arm-linux-androideabi" @@ -151,22 +161,14 @@ // // ARM V7 thumb mode. // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \ +// RUN: -target arm-linux-androideabi21 \ // RUN: -march=armv7-a -mthumb \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-ARMV7THUMB %s // CHECK-ARMV7THUMB: {{.*}}clang{{.*}}" "-cc1" // CHECK-ARMV7THUMB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9" -// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" -// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" -// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" -// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a/thumb" -// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/armv7-a" -// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi/thumb" -// CHECK-ARMV7THUMB-NOT: "-internal-isystem" "{{.*}}/include/c++/4.9/arm-linux-androideabi" -// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/include/c++/v1" // CHECK-ARMV7THUMB: "-internal-isystem" "{{.*}}/sysroot/usr/local/include" // CHECK-ARMV7THUMB: "-internal-isystem" "[[RESOURCE_DIR]]{{(/|\\\\)}}include" // CHECK-ARMV7THUMB: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/arm-linux-androideabi" @@ -191,7 +193,7 @@ // CHECK-ARMV7THUMB-NOT: "-L{{.*}}/lib/gcc/arm-linux-androideabi/4.9/../{{[^ ]*}}/lib" // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target arm-linux-androideabi21 -stdlib=libstdc++ \ +// RUN: -target arm-linux-androideabi21 \ // RUN: -march=armv7-a -mthumb \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ @@ -205,21 +207,19 @@ // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target armv7a-none-linux-androideabi21 -stdlib=libstdc++ \ +// RUN: -target armv7a-none-linux-androideabi21 \ // RUN: -mthumb \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-ARMV7THUMB %s // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target aarch64-linux-android21 -stdlib=libstdc++ \ +// RUN: -target aarch64-linux-android21 \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-AARCH64 %s // CHECK-AARCH64: {{.*}}clang{{.*}}" "-cc1" -// CHECK-AARCH64: "-internal-isystem" "{{.*}}/include/c++/4.9" -// CHECK-AARCH64: "-internal-isystem" "{{.*}}/include/c++/4.9/aarch64-linux-android" -// CHECK-AARCH64: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-AARCH64: "-internal-isystem" "{{.*}}/include/c++/v1" // CHECK-AARCH64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/aarch64-linux-android" // CHECK-AARCH64: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-AARCH64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" @@ -230,14 +230,12 @@ // CHECK-AARCH64: "-L{{.*}}/lib/gcc/aarch64-linux-android/4.9/../../../../aarch64-linux-android/lib" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target arm64-linux-android21 -stdlib=libstdc++ \ +// RUN: -target arm64-linux-android21 \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-ARM64 %s // CHECK-ARM64: {{.*}}clang{{.*}}" "-cc1" -// CHECK-ARM64: "-internal-isystem" "{{.*}}/include/c++/4.9" -// CHECK-ARM64: "-internal-isystem" "{{.*}}/include/c++/4.9/aarch64-linux-android" -// CHECK-ARM64: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-ARM64: "-internal-isystem" "{{.*}}/include/c++/v1" // CHECK-ARM64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/aarch64-linux-android" // CHECK-ARM64: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-ARM64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" @@ -249,14 +247,12 @@ // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target mipsel-linux-android21 \ -// RUN: -mips32 -stdlib=libstdc++ \ +// RUN: -mips32 \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-MIPS %s // CHECK-MIPS: {{.*}}clang{{.*}}" "-cc1" -// CHECK-MIPS: "-internal-isystem" "{{.*}}/include/c++/4.9" -// CHECK-MIPS: "-internal-isystem" "{{.*}}/include/c++/4.9/mipsel-linux-android" -// CHECK-MIPS: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-MIPS: "-internal-isystem" "{{.*}}/include/c++/v1" // CHECK-MIPS: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-MIPS: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" // CHECK-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" @@ -267,14 +263,11 @@ // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target i686-linux-android21 \ -// RUN: -stdlib=libstdc++ \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-I686 %s // CHECK-I686: {{.*}}clang{{.*}}" "-cc1" -// CHECK-I686: "-internal-isystem" "{{.*}}/include/c++/4.9" -// CHECK-I686: "-internal-isystem" "{{.*}}/include/c++/4.9/i686-linux-android" -// CHECK-I686: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-I686: "-internal-isystem" "{{.*}}/include/c++/v1" // CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/i686-linux-android" // CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-I686: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" @@ -286,14 +279,11 @@ // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target x86_64-linux-android21 \ -// RUN: -stdlib=libstdc++ \ // RUN: -B%S/Inputs/basic_android_ndk_tree \ // RUN: --sysroot=%S/Inputs/basic_android_ndk_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-X86_64 %s // CHECK-X86_64: {{.*}}clang{{.*}}" "-cc1" -// CHECK-X86_64: "-internal-isystem" "{{.*}}/include/c++/4.9" -// CHECK-X86_64: "-internal-isystem" "{{.*}}/include/c++/4.9/x86_64-linux-android" -// CHECK-X86_64: "-internal-isystem" "{{.*}}/include/c++/4.9/backward" +// CHECK-X86_64: "-internal-isystem" "{{.*}}/include/c++/v1" // CHECK-X86_64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include/x86_64-linux-android" // CHECK-X86_64: "-internal-externc-isystem" "{{.*}}/sysroot/include" // CHECK-X86_64: "-internal-externc-isystem" "{{.*}}/sysroot/usr/include" diff --git a/test/Driver/arm-features.c b/test/Driver/arm-features.c index 74cedf3bd8..b278af15fa 100644 --- a/test/Driver/arm-features.c +++ b/test/Driver/arm-features.c @@ -17,3 +17,42 @@ // RUN: %clang -target arm-none-none-eabi -mcpu=generic+nodsp -march=armv8m.main -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NODSP %s // RUN: %clang -target arm-none-none-eabi -mcpu=generic -march=armv8m.main+nodsp -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NODSP %s // CHECK-NODSP: "-cc1"{{.*}} "-triple" "thumbv8m.main-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-dsp" + +// Check that crypto means sha2 + aes: +// +// Check +sha2 +aes: +// +// RUN: %clang -target arm-arm-none-eabi -march=armv8.2a+sha2+aes -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-SHA2-AES %s +// CHECK-SHA2-AES: "-cc1"{{.*}} "-triple" "armv8.2a-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+sha2" "-target-feature" "+aes" +// +// Check -sha2 -aes: +// +// RUN: %clang -target arm-arm-none-eabi -march=armv8.2a+sha2+nosha2+aes+noaes -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SHA2-AES %s +// CHECK-NO-SHA2-AES: "-cc1"{{.*}} "-triple" "armv8.2a-{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "-sha2" "-target-feature" "-aes" +// +// Check +crypto: +// +// RUN: %clang -target arm-arm-none-eabi -march=armv8a+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO2 %s +// RUN: %clang -target arm-arm-none-eabi -march=armv8.1a+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO2 %s +// RUN: %clang -target arm-arm-none-eabi -march=armv8.2a+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO2 %s +// RUN: %clang -target arm-arm-none-eabi -march=armv8.3a+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO2 %s +// RUN: %clang -target arm-arm-none-eabi -march=armv8.4a+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO2 %s +// CHECK-CRYPTO2: "-cc1"{{.*}} "-target-cpu" "generic"{{.*}} "-target-feature" "+crypto" "-target-feature" "+sha2" "-target-feature" "+aes" +// +// Check -crypto: +// +// RUN: %clang -target arm-arm-none-eabi -march=armv8.1a+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO2 %s +// RUN: %clang -target arm-arm-none-eabi -march=armv8.2a+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO2 %s +// RUN: %clang -target arm-arm-none-eabi -march=armv8.3a+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO2 %s +// RUN: %clang -target arm-arm-none-eabi -march=armv8.4a+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO2 %s +// CHECK-NOCRYPTO2-NOT: "-target-feature" "+crypto" "-target-feature" "+sha2" "-target-feature" "+aes" +// +// Check +crypto -sha2 -aes: +// +// RUN: %clang -target arm-arm-none-eabi -march=armv8.1a+crypto+nosha2+noaes -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO3 %s +// CHECK-CRYPTO3-NOT: "-target-feature" "+sha2" "-target-feature" "+aes" +// +// Check -crypto +sha2 +aes: +// +// RUN: %clang -target arm-arm-none-eabi -march=armv8.1a+nocrypto+sha2+aes -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CRYPTO4 %s +// CHECK-CRYPTO4: "-target-feature" "+sha2" "-target-feature" "+aes" diff --git a/test/Driver/arm-mfpu.c b/test/Driver/arm-mfpu.c index 2f8d64f023..c3a644f241 100644 --- a/test/Driver/arm-mfpu.c +++ b/test/Driver/arm-mfpu.c @@ -364,3 +364,67 @@ // CHECK-SOFT-ABI-FP: "-target-feature" "-fp-armv8" // CHECK-SOFT-ABI-FP: "-target-feature" "-neon" // CHECK-SOFT-ABI-FP: "-target-feature" "-crypto" + +// RUN: %clang -target arm-linux-androideabi21 %s -### -c 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-ARM5-ANDROID-FP-DEFAULT %s +// CHECK-ARM5-ANDROID-FP-DEFAULT: "-target-feature" "+soft-float" +// CHECK-ARM5-ANDROID-FP-DEFAULT: "-target-feature" "+soft-float-abi" +// CHECK-ARM5-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+d16" +// CHECK-ARM5-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+vfp3" +// CHECK-ARM5-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+vfp4" +// CHECK-ARM5-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+fp-armv8" +// CHECK-ARM5-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+neon" +// CHECK-ARM5-ANDROID-FP-DEFAULT-NOT: "-target-feature" "+crypto" + +// RUN: %clang -target arm-linux-androideabi21 -march=armv7-a %s -### -c 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MARCH-ARM7-ANDROID-FP %s +// CHECK-MARCH-ARM7-ANDROID-FP-NOT: "-target-feature" "+soft-float" +// CHECK-MARCH-ARM7-ANDROID-FP: "-target-feature" "+soft-float-abi" +// CHECK-MARCH-ARM7-ANDROID-FP: "-target-feature" "+d16" +// CHECK-MARCH-ARM7-ANDROID-FP: "-target-feature" "+vfp3" +// CHECK-MARCH-ARM7-ANDROID-FP-NOT: "-target-feature" "+vfp4" +// CHECK-MARCH-ARM7-ANDROID-FP-NOT: "-target-feature" "+fp-armv8" +// CHECK-MARCH-ARM7-ANDROID-FP-NOT: "-target-feature" "+neon" +// CHECK-MARCH-ARM7-ANDROID-FP-NOT: "-target-feature" "+crypto" + +// RUN: %clang -target armv7-linux-androideabi21 %s -### -c 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-ARM-ANDROID-L-FP-DEFAULT %s +// CHECK-ARM-ANDROID-L-FP-DEFAULT-NOT: "-target-feature" "+soft-float" +// CHECK-ARM-ANDROID-L-FP-DEFAULT: "-target-feature" "+soft-float-abi" +// CHECK-ARM-ANDROID-L-FP-DEFAULT: "-target-feature" "+d16" +// CHECK-ARM-ANDROID-L-FP-DEFAULT: "-target-feature" "+vfp3" +// CHECK-ARM-ANDROID-L-FP-DEFAULT-NOT: "-target-feature" "+vfp4" +// CHECK-ARM-ANDROID-L-FP-DEFAULT-NOT: "-target-feature" "+fp-armv8" +// CHECK-ARM-ANDROID-L-FP-DEFAULT-NOT: "-target-feature" "+neon" +// CHECK-ARM-ANDROID-L-FP-DEFAULT-NOT: "-target-feature" "+crypto" + +// RUN: %clang -target armv7-linux-androideabi21 -mfpu=neon %s -### -c 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-ARM-ANDROID-L-FP-NEON %s +// CHECK-ARM-ANDROID-L-FP-NEON-NOT: "-target-feature" "+soft-float" +// CHECK-ARM-ANDROID-L-FP-NEON: "-target-feature" "+soft-float-abi" +// CHECK-ARM-ANDROID-L-FP-NEON: "-target-feature" "+vfp3" +// CHECK-ARM-ANDROID-L-FP-NEON-NOT: "-target-feature" "+vfp4" +// CHECK-ARM-ANDROID-L-FP-NEON-NOT: "-target-feature" "+fp-armv8" +// CHECK-ARM-ANDROID-L-FP-NEON: "-target-feature" "+neon" +// CHECK-ARM-ANDROID-L-FP-NEON-NOT: "-target-feature" "+crypto" + +// RUN: %clang -target armv7-linux-androideabi23 %s -### -c 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-ARM-ANDROID-M-FP-DEFAULT %s +// CHECK-ARM-ANDROID-M-FP-DEFAULT-NOT: "-target-feature" "+soft-float" +// CHECK-ARM-ANDROID-M-FP-DEFAULT: "-target-feature" "+soft-float-abi" +// CHECK-ARM-ANDROID-M-FP-DEFAULT: "-target-feature" "+vfp3" +// CHECK-ARM-ANDROID-M-FP-DEFAULT-NOT: "-target-feature" "+vfp4" +// CHECK-ARM-ANDROID-M-FP-DEFAULT-NOT: "-target-feature" "+fp-armv8" +// CHECK-ARM-ANDROID-M-FP-DEFAULT: "-target-feature" "+neon" +// CHECK-ARM-ANDROID-M-FP-DEFAULT-NOT: "-target-feature" "+crypto" + +// RUN: %clang -target armv7-linux-androideabi23 %s -mfpu=vfp3-d16 -### -c 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-ARM-ANDROID-M-FP-D16 %s +// CHECK-ARM-ANDROID-M-FP-D16-NOT: "-target-feature" "+soft-float" +// CHECK-ARM-ANDROID-M-FP-D16: "-target-feature" "+soft-float-abi" +// CHECK-ARM-ANDROID-M-FP-D16: "-target-feature" "+d16" +// CHECK-ARM-ANDROID-M-FP-D16: "-target-feature" "+vfp3" +// CHECK-ARM-ANDROID-M-FP-D16-NOT: "-target-feature" "+vfp4" +// CHECK-ARM-ANDROID-M-FP-D16-NOT: "-target-feature" "+fp-armv8" +// CHECK-ARM-ANDROID-M-FP-D16-NOT: "-target-feature" "+neon" +// CHECK-ARM-ANDROID-M-FP-D16-NOT: "-target-feature" "+crypto" diff --git a/test/Driver/autocomplete.c b/test/Driver/autocomplete.c index 16f2edf034..f8271770d0 100644 --- a/test/Driver/autocomplete.c +++ b/test/Driver/autocomplete.c @@ -25,6 +25,7 @@ // STDLIBALL-NEXT: platform // RUN: %clang --autocomplete=-meabi,d | FileCheck %s -check-prefix=MEABI // MEABI: default +// RUN: %clang --autocomplete=-meabi, | FileCheck %s -check-prefix=MEABIALL // RUN: %clang --autocomplete=-meabi | FileCheck %s -check-prefix=MEABIALL // MEABIALL: 4 // MEABIALL-NEXT: 5 @@ -115,3 +116,14 @@ // Check if they can autocomplete values with coron // RUN: %clang --autocomplete=foo,bar,,,-fno-sanitize-coverage=,f | FileCheck %s -check-prefix=FNOSANICOVER-CORON // FNOSANICOVER-CORON: func + +// Clang should return empty string when no value completion was found, which will fall back to file autocompletion +// RUN: %clang --autocomplete=-fmodule-file= | FileCheck %s -check-prefix=MODULE_FILE_EQUAL +// MODULE_FILE_EQUAL-NOT: -fmodule-file= +// RUN: %clang --autocomplete=-fmodule-file | FileCheck %s -check-prefix=MODULE_FILE +// MODULE_FILE: -fmodule-file= + +// RUN: %clang --autocomplete=-Qunused-arguments, | FileCheck %s -check-prefix=QUNUSED_COMMA +// QUNUSED_COMMA-NOT: -Qunused-arguments +// RUN: %clang --autocomplete=-Qunused-arguments | FileCheck %s -check-prefix=QUNUSED +// QUNUSED: -Qunused-arguments diff --git a/test/Driver/cf-runtime-abi.c b/test/Driver/cf-runtime-abi.c new file mode 100644 index 0000000000..1d4b9702ef --- /dev/null +++ b/test/Driver/cf-runtime-abi.c @@ -0,0 +1,22 @@ +// RUN: %clang -### -target aarch64-unknown-windows-msvc -c %s 2>&1 | FileCheck -check-prefix CHECK-UNSPECIFIED %s +// RUN: %clang -### -target thumbv7-unknown-linux-android -c %s 2>&1 | FileCheck -check-prefix CHECK-UNSPECIFIED %s +// RUN: %clang -### -target x86_64-apple-macosx -c %s 2>&1 | FileCheck -check-prefix CHECK-UNSPECIFIED %s + +// RUN: %clang -### -target aarch64-unknown-windows-msvc -fcf-runtime-abi=objc -c %s 2>&1 | FileCheck -check-prefix CHECK-OBJC %s +// RUN: %clang -### -target thumbv7-unknown-linux-android -fcf-runtime-abi=swift-5.0 -c %s 2>&1 | FileCheck -check-prefix CHECK-SWIFT-5_0 %s +// RUN: %clang -### -target i386-unknown-freebsd -fcf-runtime-abi=swift-4.2 -c %s 2>&1 | FileCheck -check-prefix CHECK-SWIFT-4_2 %s +// RUN: %clang -### -target s390x-unknown-linux-gnu -fcf-runtime-abi=swift-4.1 -c %s 2>&1 | FileCheck -check-prefix CHECK-SWIFT-4_1 %s +// RUN: %clang -### -target x86_64-apple-macosx -fcf-runtime-abi=swift -c %s 2>&1 | FileCheck -check-prefix CHECK-SWIFT %s + +// RUN: %clang -### -target arm7k-apple-watchos -fcf-runtime-abi=invalid -c %s 2>&1 | FileCheck -check-prefix CHECK-INVALID %s + +// CHECK-UNSPECIFIED-NOT: "-fcf-runtime-abi= + +// CHECK-OBJC: "-fcf-runtime-abi=objc" +// CHECK-SWIFT-5_0: "-fcf-runtime-abi=swift-5.0" +// CHECK-SWIFT-4_2: "-fcf-runtime-abi=swift-4.2" +// CHECK-SWIFT-4_1: "-fcf-runtime-abi=swift-4.1" +// CHECK-SWIFT: "-fcf-runtime-abi=swift" + +// CHECK-INVALID: error: invalid CoreFoundation Runtime ABI 'invalid'; must be one of 'objc', 'standalone', 'swift', 'swift-5.0', 'swift-4.2', 'swift-4.1' + diff --git a/test/Driver/cl-options.c b/test/Driver/cl-options.c index 80f2d74815..f5171d5c04 100644 --- a/test/Driver/cl-options.c +++ b/test/Driver/cl-options.c @@ -490,6 +490,13 @@ // RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s // ThreadSafeStatics-NOT: "-fno-threadsafe-statics" +// RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoDllExportInlines %s +// NoDllExportInlines: "-fno-dllexport-inlines" +// RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlines %s +// DllExportInlines-NOT: "-fno-dllexport-inlines" +// RUN: %clang_cl /fallback /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlinesFallback %s +// DllExportInlinesFallback: error: option '/Zc:dllexportInlines-' is ABI-changing and not compatible with '/fallback' + // RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s // Zi: "-gcodeview" // Zi: "-debug-info-kind=limited" @@ -614,5 +621,19 @@ // RUN: --version \ // RUN: -Werror /Zs -- %s 2>&1 +// Accept clang options under the /clang: flag. +// The first test case ensures that the SLP vectorizer is on by default and that +// it's being turned off by the /clang:-fno-slp-vectorize flag. + +// RUN: %clang_cl -O2 -### -- %s 2>&1 | FileCheck -check-prefix=NOCLANG %s +// NOCLANG: "--dependent-lib=libcmt" +// NOCLANG-SAME: "-vectorize-slp" +// NOCLANG-NOT: "--dependent-lib=msvcrt" + +// RUN: %clang_cl -O2 -MD /clang:-fno-slp-vectorize /clang:-MD /clang:-MF /clang:my_dependency_file.dep -### -- %s 2>&1 | FileCheck -check-prefix=CLANG %s +// CLANG: "--dependent-lib=msvcrt" +// CLANG-SAME: "-dependency-file" "my_dependency_file.dep" +// CLANG-NOT: "--dependent-lib=libcmt" +// CLANG-NOT: "-vectorize-slp" void f() { } diff --git a/test/Driver/cl-showfilenames.c b/test/Driver/cl-showfilenames.c new file mode 100644 index 0000000000..b2932f1a01 --- /dev/null +++ b/test/Driver/cl-showfilenames.c @@ -0,0 +1,23 @@ +// We have to run the compilation step to see the output, so we must be able to +// target Windows. +// REQUIRES: x86-registered-target + +// RUN: %clang_cl --target=i686-pc-win32 /c /Fo%T/ /showFilenames -- %s 2>&1 | FileCheck -check-prefix=show %s +// RUN: %clang_cl --target=i686-pc-win32 /c /Fo%T/ /showFilenames -- %s %S/Inputs/wildcard*.c 2>&1 | FileCheck -check-prefix=multiple %s + +// RUN: %clang_cl --target=i686-pc-win32 /c /Fo%T/ -- %s 2>&1 | FileCheck -check-prefix=noshow %s +// RUN: %clang_cl --target=i686-pc-win32 /c /Fo%T/ /showFilenames /showFilenames- -- %s 2>&1 | FileCheck -check-prefix=noshow %s + + +#pragma message "Hello" + +// show: cl-showfilenames.c +// show-NEXT: warning: Hello + +// multiple: cl-showfilenames.c +// multiple-NEXT: warning: Hello +// multiple: wildcard1.c +// multiple-NEXT: wildcard2.c + +// noshow: warning: Hello +// noshow-NOT: cl-showfilenames.c diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index 2ade15c06a..ed24ae27fb 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -291,6 +291,13 @@ // MIPS: "-target-cpu" "mips32r2" // MIPS: "-mfloat-abi" "hard" +// RUN: %clang -target mipsisa32r6-linux-gnu -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPSR6 %s +// MIPSR6: clang +// MIPSR6: "-cc1" +// MIPSR6: "-target-cpu" "mips32r6" +// MIPSR6: "-mfloat-abi" "hard" + // RUN: %clang -target mipsel-linux-gnu -### -S %s 2>&1 | \ // RUN: FileCheck -check-prefix=MIPSEL %s // MIPSEL: clang @@ -298,6 +305,13 @@ // MIPSEL: "-target-cpu" "mips32r2" // MIPSEL: "-mfloat-abi" "hard" +// RUN: %clang -target mipsisa32r6el-linux-gnu -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPSR6EL %s +// MIPSR6EL: clang +// MIPSR6EL: "-cc1" +// MIPSR6EL: "-target-cpu" "mips32r6" +// MIPSR6EL: "-mfloat-abi" "hard" + // RUN: %clang -target mipsel-linux-android -### -S %s 2>&1 | \ // RUN: FileCheck -check-prefix=MIPSEL-ANDROID %s // MIPSEL-ANDROID: clang @@ -323,6 +337,13 @@ // MIPS64: "-target-cpu" "mips64r2" // MIPS64: "-mfloat-abi" "hard" +// RUN: %clang -target mipsisa64r6-linux-gnu -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R6 %s +// MIPS64R6: clang +// MIPS64R6: "-cc1" +// MIPS64R6: "-target-cpu" "mips64r6" +// MIPS64R6: "-mfloat-abi" "hard" + // RUN: %clang -target mips64el-linux-gnu -### -S %s 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS64EL %s // MIPS64EL: clang @@ -330,6 +351,77 @@ // MIPS64EL: "-target-cpu" "mips64r2" // MIPS64EL: "-mfloat-abi" "hard" +// RUN: %clang -target mipsisa64r6el-linux-gnu -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R6EL %s +// MIPS64R6EL: clang +// MIPS64R6EL: "-cc1" +// MIPS64R6EL: "-target-cpu" "mips64r6" +// MIPS64R6EL: "-mfloat-abi" "hard" + +// RUN: %clang -target mips64-linux-gnuabi64 -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64-GNUABI64 %s +// MIPS64-GNUABI64: clang +// MIPS64-GNUABI64: "-cc1" +// MIPS64-GNUABI64: "-target-cpu" "mips64r2" +// MIPS64-GNUABI64: "-target-abi" "n64" +// MIPS64-GNUABI64: "-mfloat-abi" "hard" + +// RUN: %clang -target mipsisa64r6-linux-gnuabi64 -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R6-GNUABI64 %s +// MIPS64R6-GNUABI64: clang +// MIPS64R6-GNUABI64: "-cc1" +// MIPS64R6-GNUABI64: "-target-cpu" "mips64r6" +// MIPS64R6-GNUABI64: "-target-abi" "n64" +// MIPS64R6-GNUABI64: "-mfloat-abi" "hard" + +// RUN: %clang -target mips64el-linux-gnuabi64 -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64EL-GNUABI64 %s +// MIPS64EL-GNUABI64: clang +// MIPS64EL-GNUABI64: "-cc1" +// MIPS64EL-GNUABI64: "-target-cpu" "mips64r2" +// MIPS64EL-GNUABI64: "-target-abi" "n64" +// MIPS64EL-GNUABI64: "-mfloat-abi" "hard" + +// RUN: %clang -target mipsisa64r6el-linux-gnuabi64 -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPS64R6EL-GNUABI64 %s +// MIPS64R6EL-GNUABI64: clang +// MIPS64R6EL-GNUABI64: "-cc1" +// MIPS64R6EL-GNUABI64: "-target-cpu" "mips64r6" +// MIPS64R6EL-GNUABI64: "-target-abi" "n64" +// MIPS64R6EL-GNUABI64: "-mfloat-abi" "hard" + +// RUN: %clang -target mips64-linux-gnuabin32 -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPSN32 %s +// MIPSN32: clang +// MIPSN32: "-cc1" +// MIPSN32: "-target-cpu" "mips64r2" +// MIPSN32: "-target-abi" "n32" +// MIPSN32: "-mfloat-abi" "hard" + +// RUN: %clang -target mipsisa64r6-linux-gnuabin32 -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPSN32R6 %s +// MIPSN32R6: clang +// MIPSN32R6: "-cc1" +// MIPSN32R6: "-target-cpu" "mips64r6" +// MIPSN32R6: "-target-abi" "n32" +// MIPSN32R6: "-mfloat-abi" "hard" + +// RUN: %clang -target mips64el-linux-gnuabin32 -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPSN32EL %s +// MIPSN32EL: clang +// MIPSN32EL: "-cc1" +// MIPSN32EL: "-target-cpu" "mips64r2" +// MIPSN32EL: "-target-abi" "n32" +// MIPSN32EL: "-mfloat-abi" "hard" + +// RUN: %clang -target mipsisa64r6el-linux-gnuabin32 -### -S %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MIPSN32R6EL %s +// MIPSN32R6EL: clang +// MIPSN32R6EL: "-cc1" +// MIPSN32R6EL: "-target-cpu" "mips64r6" +// MIPSN32R6EL: "-target-abi" "n32" +// MIPSN32R6EL: "-mfloat-abi" "hard" + // RUN: %clang -target mips64el-linux-android -### -S %s 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS64EL-ANDROID %s // MIPS64EL-ANDROID: clang diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c index f1836980c1..984244679d 100644 --- a/test/Driver/clang_f_opts.c +++ b/test/Driver/clang_f_opts.c @@ -85,6 +85,10 @@ // CHECK-PROFILE-DIR-UNUSED-NOT: "-coverage-data-file" "abc // CHECK-PROFILE-DIR-NEITHER-NOT: argument unused +// RUN: %clang -### -fprofile-arcs -ftest-coverage %s 2>&1 | FileCheck -check-prefix=CHECK-u %s +// RUN: %clang -### --coverage %s 2>&1 | FileCheck -check-prefix=CHECK-u %s +// CHECK-u-NOT: "-u{{.*}}" + // RUN: %clang -### -S -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-LLVM %s // RUN: %clang -### -S -fprofile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s // RUN: %clang -### -S -fprofile-generate=/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-DIR %s @@ -116,6 +120,7 @@ // 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 +// RUN: %clang -### -S -fprofile-remapping-file foo/bar.txt %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-REMAP %s // CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang" // CHECK-PROFILE-GENERATE-LLVM: "-fprofile-instrument=llvm" // CHECK-PROFILE-GENERATE-DIR: "-fprofile-instrument-path=/some/dir{{/|\\\\}}{{.*}}" @@ -126,6 +131,7 @@ // 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" +// CHECK-PROFILE-REMAP: "-fprofile-remapping-file=foo/bar.txt" // 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 @@ -536,3 +542,18 @@ // RUN: %clang -### -S -fomit-frame-pointer -fno-omit-frame-pointer -pg %s 2>&1 | FileCheck -check-prefix=CHECK-MIX-NO-OMIT-FP-PG %s // CHECK-NO-MIX-OMIT-FP-PG: '-fomit-frame-pointer' not allowed with '-pg' // CHECK-MIX-NO-OMIT-FP-PG-NOT: '-fomit-frame-pointer' not allowed with '-pg' + +// RUN: %clang -### -S -target x86_64-unknown-linux -frecord-gcc-switches %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES %s +// RUN: %clang -### -S -target x86_64-unknown-linux -fno-record-gcc-switches %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RECORD-GCC-SWITCHES %s +// RUN: %clang -### -S -target x86_64-unknown-linux -fno-record-gcc-switches -frecord-gcc-switches %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES %s +// RUN: %clang -### -S -target x86_64-unknown-linux -frecord-gcc-switches -fno-record-gcc-switches %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RECORD-GCC-SWITCHES %s +// RUN: %clang -### -S -target x86_64-unknown-linux -frecord-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES %s +// RUN: %clang -### -S -target x86_64-unknown-linux -fno-record-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RECORD-GCC-SWITCHES %s +// RUN: %clang -### -S -target x86_64-unknown-linux -fno-record-command-line -frecord-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES %s +// RUN: %clang -### -S -target x86_64-unknown-linux -frecord-command-line -fno-record-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RECORD-GCC-SWITCHES %s +// Test with a couple examples of non-ELF object file formats +// RUN: %clang -### -S -target x86_64-unknown-macosx -frecord-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES-ERROR %s +// RUN: %clang -### -S -target x86_64-unknown-windows -frecord-command-line %s 2>&1 | FileCheck -check-prefix=CHECK-RECORD-GCC-SWITCHES-ERROR %s +// CHECK-RECORD-GCC-SWITCHES: "-record-command-line" +// CHECK-NO-RECORD-GCC-SWITCHES-NOT: "-record-command-line" +// CHECK-RECORD-GCC-SWITCHES-ERROR: error: unsupported option '-frecord-command-line' for target diff --git a/test/Driver/cuda-dwarf-2.cu b/test/Driver/cuda-dwarf-2.cu index 7956e6ddbe..bcfb2444bc 100644 --- a/test/Driver/cuda-dwarf-2.cu +++ b/test/Driver/cuda-dwarf-2.cu @@ -1,25 +1,28 @@ // REQUIRES: clang-driver // -// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 | \ -// RUN: FileCheck %s -check-prefix NO_DEBUG +// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O1 --no-cuda-noopt-device-debug 2>&1 | \ +// RUN: FileCheck %s -check-prefix DEBUG_DIRECTIVES // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O3 2>&1 | \ -// RUN: FileCheck %s -check-prefix NO_DEBUG +// RUN: FileCheck %s -check-prefix DEBUG_DIRECTIVES // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O3 --no-cuda-noopt-device-debug 2>&1 | \ -// RUN: FileCheck %s -check-prefix NO_DEBUG +// RUN: FileCheck %s -check-prefix DEBUG_DIRECTIVES // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g0 2>&1 | \ // RUN: FileCheck %s -check-prefix NO_DEBUG // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb0 -O3 --cuda-noopt-device-debug 2>&1 | \ // RUN: FileCheck %s -check-prefix NO_DEBUG -// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb1 2>&1 | \ -// RUN: FileCheck %s -check-prefix NO_DEBUG -check-prefix LINE_TABLE -// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-tables-only -O2 --cuda-noopt-device-debug 2>&1 | \ -// RUN: FileCheck %s -check-prefix NO_DEBUG -check-prefix LINE_TABLE +// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-directives-only -O2 --cuda-noopt-device-debug 2>&1 | \ +// RUN: FileCheck %s -check-prefix DEBUG_DIRECTIVES // NO_DEBUG-NOT: warning: debug -// LINE_TABLE-NOT: warning: debug +// DEBUG_DIRECTIVES-NOT: warning: debug +// NO_DEBUG: "-fcuda-is-device" +// NO_DEBUG-NOT: "-debug-info-kind= // NO_DEBUG: ptxas // NO_DEBUG-NOT: "-g" -// LINE_TABLE: "-lineinfo" +// DEBUG_DIRECTIVES: "-fcuda-is-device" +// DEBUG_DIRECTIVES-SAME: "-debug-info-kind=line-directives-only" +// DEBUG_DIRECTIVES: ptxas +// DEBUG_DIRECTIVES-SAME: "-lineinfo" // NO_DEBUG: fatbinary // NO_DEBUG-NOT: "-g" @@ -27,6 +30,8 @@ // RUN: FileCheck %s -check-prefix HAS_DEBUG // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O0 --cuda-noopt-device-debug 2>&1 | \ // RUN: FileCheck %s -check-prefix HAS_DEBUG +// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 | \ +// RUN: FileCheck %s -check-prefix HAS_DEBUG // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g -O3 --cuda-noopt-device-debug 2>&1 | \ // RUN: FileCheck %s -check-prefix HAS_DEBUG // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -g2 2>&1 | \ @@ -37,9 +42,14 @@ // RUN: FileCheck %s -check-prefix HAS_DEBUG // RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb3 -O3 --cuda-noopt-device-debug 2>&1 | \ // RUN: FileCheck %s -check-prefix HAS_DEBUG +// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -ggdb1 2>&1 | \ +// RUN: FileCheck %s -check-prefix HAS_DEBUG +// RUN: %clang -### -target x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 %s -gline-tables-only -O2 --cuda-noopt-device-debug 2>&1 | \ +// RUN: FileCheck %s -check-prefix HAS_DEBUG // HAS_DEBUG-NOT: warning: debug // HAS_DEBUG: "-fcuda-is-device" +// HAS_DEBUG-SAME: "-debug-info-kind={{limited|line-tables-only}}" // HAS_DEBUG-SAME: "-dwarf-version=2" // HAS_DEBUG: ptxas // HAS_DEBUG-SAME: "-g" diff --git a/test/Driver/cuda-external-tools.cu b/test/Driver/cuda-external-tools.cu index 367c6997ea..5da6ffe026 100644 --- a/test/Driver/cuda-external-tools.cu +++ b/test/Driver/cuda-external-tools.cu @@ -19,7 +19,7 @@ // RUN: %clang -### -target x86_64-linux-gnu -Ofast -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH64,SM20,OPT3 %s // Generating relocatable device code -// RUN: %clang -### -target x86_64-linux-gnu -fcuda-rdc -c %s 2>&1 \ +// RUN: %clang -### -target x86_64-linux-gnu -fgpu-rdc -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH64,SM20,RDC %s // With debugging enabled, ptxas should be run with with no ptxas optimizations. @@ -46,21 +46,21 @@ // RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_35 -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH64,SM35 %s // Separate compilation targeting sm_35. -// RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_35 -fcuda-rdc -c %s 2>&1 \ +// RUN: %clang -### -target x86_64-linux-gnu --cuda-gpu-arch=sm_35 -fgpu-rdc -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH64,SM35,RDC %s // 32-bit compile. // RUN: %clang -### -target i386-linux-gnu -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH32,SM20 %s // 32-bit compile when generating relocatable device code. -// RUN: %clang -### -target i386-linux-gnu -fcuda-rdc -c %s 2>&1 \ +// RUN: %clang -### -target i386-linux-gnu -fgpu-rdc -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH32,SM20,RDC %s // Compile with -fintegrated-as. This should still cause us to invoke ptxas. // RUN: %clang -### -target x86_64-linux-gnu -fintegrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH64,SM20,OPT0 %s // Check that we still pass -c when generating relocatable device code. -// RUN: %clang -### -target x86_64-linux-gnu -fintegrated-as -fcuda-rdc -c %s 2>&1 \ +// RUN: %clang -### -target x86_64-linux-gnu -fintegrated-as -fgpu-rdc -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH64,SM20,RDC %s // Check -Xcuda-ptxas and -Xcuda-fatbinary @@ -77,11 +77,11 @@ // RUN: | FileCheck -check-prefixes=CHECK,ARCH32,SM20 %s // Check relocatable device code generation on MacOS. -// RUN: %clang -### -target x86_64-apple-macosx -O0 -fcuda-rdc -c %s 2>&1 \ +// RUN: %clang -### -target x86_64-apple-macosx -O0 -fgpu-rdc -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH64,SM20,RDC %s -// RUN: %clang -### -target x86_64-apple-macosx --cuda-gpu-arch=sm_35 -fcuda-rdc -c %s 2>&1 \ +// RUN: %clang -### -target x86_64-apple-macosx --cuda-gpu-arch=sm_35 -fgpu-rdc -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH64,SM35,RDC %s -// RUN: %clang -### -target i386-apple-macosx -fcuda-rdc -c %s 2>&1 \ +// RUN: %clang -### -target i386-apple-macosx -fgpu-rdc -c %s 2>&1 \ // RUN: | FileCheck -check-prefixes=CHECK,ARCH32,SM20,RDC %s // Check that CLANG forwards the -v flag to PTXAS. @@ -92,12 +92,12 @@ // CHECK: "-cc1" // ARCH64-SAME: "-triple" "nvptx64-nvidia-cuda" // ARCH32-SAME: "-triple" "nvptx-nvidia-cuda" +// RDC-SAME: "-fgpu-rdc" +// CHECK-NOT: "-fgpu-rdc" // SM20-SAME: "-target-cpu" "sm_20" // SM35-SAME: "-target-cpu" "sm_35" // SM20-SAME: "-o" "[[PTXFILE:[^"]*]]" // SM35-SAME: "-o" "[[PTXFILE:[^"]*]]" -// RDC-SAME: "-fcuda-rdc" -// CHECK-NOT: "-fcuda-rdc" // Match the call to ptxas (which assembles PTX to SASS). // CHECK: ptxas @@ -141,7 +141,7 @@ // ARCH64-SAME: "-triple" "x86_64- // ARCH32-SAME: "-triple" "i386- // CHECK-SAME: "-fcuda-include-gpubinary" "[[FATBINARY]]" -// RDC-SAME: "-fcuda-rdc" -// CHECK-NOT: "-fcuda-rdc" +// RDC-SAME: "-fgpu-rdc" +// CHECK-NOT: "-fgpu-rdc" // CHK-PTXAS-VERBOSE: ptxas{{.*}}" "-v" diff --git a/test/Driver/cuda-phases.cu b/test/Driver/cuda-phases.cu index e34ffa802d..58be50ae2e 100644 --- a/test/Driver/cuda-phases.cu +++ b/test/Driver/cuda-phases.cu @@ -11,12 +11,21 @@ // // Test single gpu architecture with complete compilation. // +// Test CUDA NVPTX phases. // RUN: %clang -target powerpc64le-ibm-linux-gnu -ccc-print-phases \ // RUN: --cuda-gpu-arch=sm_30 %s 2>&1 \ // RUN: | FileCheck -check-prefixes=BIN,BIN_NV %s +// +// Test HIP AMDGPU -fgpu-rdc phases. +// RUN: %clang -x hip -target powerpc64le-ibm-linux-gnu -ccc-print-phases \ +// RUN: --cuda-gpu-arch=gfx803 -fgpu-rdc %s 2>&1 \ +// RUN: | FileCheck -check-prefixes=BIN,BIN_AMD,BIN_AMD_RDC %s +// +// Test HIP AMDGPU -fno-gpu-rdc phases (default). // RUN: %clang -x hip -target powerpc64le-ibm-linux-gnu -ccc-print-phases \ // RUN: --cuda-gpu-arch=gfx803 %s 2>&1 \ -// RUN: | FileCheck -check-prefixes=BIN,BIN_AMD %s +// RUN: | FileCheck -check-prefixes=BIN,BIN_AMD,BIN_AMD_NRDC %s +// // BIN_NV-DAG: [[P0:[0-9]+]]: input, "{{.*}}cuda-phases.cu", [[T:cuda]], (host-[[T]]) // BIN_AMD-DAG: [[P0:[0-9]+]]: input, "{{.*}}cuda-phases.cu", [[T:hip]], (host-[[T]]) // BIN-DAG: [[P1:[0-9]+]]: preprocessor, {[[P0]]}, [[T]]-cpp-output, (host-[[T]]) @@ -32,12 +41,17 @@ // BIN_NV-DAG: [[P10:[0-9]+]]: linker, {[[P8]], [[P9]]}, cuda-fatbin, (device-[[T]]) // BIN_NV-DAG: [[P11:[0-9]+]]: offload, "host-[[T]] (powerpc64le-ibm-linux-gnu)" {[[P2]]}, "device-[[T]] ([[TRIPLE]])" {[[P10]]}, ir // BIN_NV-DAG: [[P12:[0-9]+]]: backend, {[[P11]]}, assembler, (host-[[T]]) -// BIN_AMD-DAG: [[P12:[0-9]+]]: backend, {[[P2]]}, assembler, (host-[[T]]) +// BIN_AMD_RDC-DAG: [[P12:[0-9]+]]: backend, {[[P2]]}, assembler, (host-[[T]]) +// BIN_AMD_NRDC-DAG: [[P6:[0-9]+]]: linker, {[[P5]]}, image, (device-hip, [[ARCH]]) +// BIN_AMD_NRDC-DAG: [[P7:[0-9]+]]: offload, "device-hip (amdgcn-amd-amdhsa:[[ARCH]])" {[[P6]]}, image +// BIN_AMD_NRDC-DAG: [[P8:[0-9]+]]: linker, {[[P7]]}, hip-fatbin, (device-hip) +// BIN_AMD_NRDC-DAG: [[P11:[0-9]+]]: offload, "host-hip (powerpc64le-ibm-linux-gnu)" {[[P2]]}, "device-hip (amdgcn-amd-amdhsa)" {[[P8]]}, ir +// BIN_AMD_NRDC-DAG: [[P12:[0-9]+]]: backend, {[[P11]]}, assembler, (host-[[T]]) // BIN-DAG: [[P13:[0-9]+]]: assembler, {[[P12]]}, object, (host-[[T]]) // BIN-DAG: [[P14:[0-9]+]]: linker, {[[P13]]}, image, (host-[[T]]) -// BIN_AMD-DAG: [[P15:[0-9]+]]: linker, {[[P5]]}, image, (device-[[T]], [[ARCH]]) -// BIN_AMD-DAG: [[P16:[0-9]+]]: offload, "host-[[T]] (powerpc64le-ibm-linux-gnu)" {[[P14]]}, -// BIN_AMD-DAG-SAME: "device-[[T]] ([[TRIPLE:amdgcn-amd-amdhsa]]:[[ARCH]])" {[[P15]]}, object +// BIN_AMD_RDC-DAG: [[P15:[0-9]+]]: linker, {[[P5]]}, image, (device-[[T]], [[ARCH]]) +// BIN_AMD_RDC-DAG: [[P16:[0-9]+]]: offload, "host-[[T]] (powerpc64le-ibm-linux-gnu)" {[[P14]]}, +// BIN_AMD_RDC-DAG-SAME: "device-[[T]] ([[TRIPLE:amdgcn-amd-amdhsa]]:[[ARCH]])" {[[P15]]}, object // // Test single gpu architecture up to the assemble phase. @@ -46,7 +60,10 @@ // RUN: --cuda-gpu-arch=sm_30 %s -S 2>&1 \ // RUN: | FileCheck -check-prefixes=ASM,ASM_NV %s // RUN: %clang -x hip -target powerpc64le-ibm-linux-gnu -ccc-print-phases \ -// RUN: --cuda-gpu-arch=gfx803 %s -S 2>&1 \ +// RUN: --cuda-gpu-arch=gfx803 -fgpu-rdc %s -S 2>&1 \ +// RUN: | FileCheck -check-prefixes=ASM,ASM_AMD %s +// RUN: %clang -x hip -target powerpc64le-ibm-linux-gnu -ccc-print-phases \ +// RUN: --cuda-gpu-arch=gfx803 -fcuda-rdc %s -S 2>&1 \ // RUN: | FileCheck -check-prefixes=ASM,ASM_AMD %s // ASM_NV-DAG: [[P0:[0-9]+]]: input, "{{.*}}cuda-phases.cu", [[T:cuda]], (device-[[T]], [[ARCH:sm_30]]) // ASM_AMD-DAG: [[P0:[0-9]+]]: input, "{{.*}}cuda-phases.cu", [[T:hip]], (device-[[T]], [[ARCH:gfx803]]) @@ -66,7 +83,7 @@ // RUN: --cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35 %s 2>&1 \ // RUN: | FileCheck -check-prefixes=BIN2,BIN2_NV %s // RUN: %clang -x hip -target powerpc64le-ibm-linux-gnu -ccc-print-phases \ -// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s 2>&1 \ +// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 -fgpu-rdc %s 2>&1 \ // RUN: | FileCheck -check-prefixes=BIN2,BIN2_AMD %s // BIN2_NV-DAG: [[P0:[0-9]+]]: input, "{{.*}}cuda-phases.cu", [[T:cuda]], (host-[[T]]) // BIN2_AMD-DAG: [[P0:[0-9]+]]: input, "{{.*}}cuda-phases.cu", [[T:hip]], (host-[[T]]) @@ -105,7 +122,7 @@ // RUN: --cuda-gpu-arch=sm_30 --cuda-gpu-arch=sm_35 %s -S 2>&1 \ // RUN: | FileCheck -check-prefixes=ASM2,ASM2_NV %s // RUN: %clang -x hip -target powerpc64le-ibm-linux-gnu -ccc-print-phases \ -// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s -S 2>&1 \ +// RUN: --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 -fgpu-rdc %s -S 2>&1 \ // RUN: | FileCheck -check-prefixes=ASM2,ASM2_AMD %s // ASM2_NV-DAG: [[P0:[0-9]+]]: input, "{{.*}}cuda-phases.cu", [[T:cuda]], (device-[[T]], [[ARCH1:sm_30]]) // ASM2_AMD-DAG: [[P0:[0-9]+]]: input, "{{.*}}cuda-phases.cu", [[T:hip]], (device-[[T]], [[ARCH1:gfx803]]) @@ -140,6 +157,7 @@ // HBIN-DAG: [[P3:[0-9]+]]: backend, {[[P2]]}, assembler, (host-[[T]]) // HBIN-DAG: [[P4:[0-9]+]]: assembler, {[[P3]]}, object, (host-[[T]]) // HBIN-DAG: [[P5:[0-9]+]]: linker, {[[P4]]}, image, (host-[[T]]) +// HBIN-NOT: device // // Test single gpu architecture up to the assemble phase in host-only // compilation mode. @@ -155,6 +173,7 @@ // HASM-DAG: [[P1:[0-9]+]]: preprocessor, {[[P0]]}, [[T]]-cpp-output, (host-[[T]]) // HASM-DAG: [[P2:[0-9]+]]: compiler, {[[P1]]}, ir, (host-[[T]]) // HASM-DAG: [[P3:[0-9]+]]: backend, {[[P2]]}, assembler, (host-[[T]]) +// HASM-NOT: device // // Test two gpu architectures with complete compilation in host-only @@ -173,6 +192,7 @@ // HBIN2-DAG: [[P3:[0-9]+]]: backend, {[[P2]]}, assembler, (host-[[T]]) // HBIN2-DAG: [[P4:[0-9]+]]: assembler, {[[P3]]}, object, (host-[[T]]) // HBIN2-DAG: [[P5:[0-9]+]]: linker, {[[P4]]}, image, (host-[[T]]) +// HBIN2-NOT: device // // Test two gpu architectures up to the assemble phase in host-only @@ -189,6 +209,7 @@ // HASM2-DAG: [[P1:[0-9]+]]: preprocessor, {[[P0]]}, [[T]]-cpp-output, (host-[[T]]) // HASM2-DAG: [[P2:[0-9]+]]: compiler, {[[P1]]}, ir, (host-[[T]]) // HASM2-DAG: [[P3:[0-9]+]]: backend, {[[P2]]}, assembler, (host-[[T]]) +// HASM2-NOT: device // // Test single gpu architecture with complete compilation in device-only @@ -207,7 +228,7 @@ // DBIN_NV-DAG: [[P3:[0-9]+]]: backend, {[[P2]]}, assembler, (device-[[T]], [[ARCH]]) // DBIN_NV-DAG: [[P4:[0-9]+]]: assembler, {[[P3]]}, object, (device-[[T]], [[ARCH]]) // DBIN_NV-DAG: [[P5:[0-9]+]]: offload, "device-[[T]] (nvptx64-nvidia-cuda:[[ARCH]])" {[[P4]]}, object - +// DBIN-NOT: host // // Test single gpu architecture up to the assemble phase in device-only // compilation mode. @@ -224,6 +245,7 @@ // DASM-DAG: [[P2:[0-9]+]]: compiler, {[[P1]]}, ir, (device-[[T]], [[ARCH]]) // DASM_NV-DAG: [[P3:[0-9]+]]: backend, {[[P2]]}, assembler, (device-[[T]], [[ARCH]]) // DASM_NV-DAG: [[P4:[0-9]+]]: offload, "device-[[T]] ([[TRIPLE:nvptx64-nvidia-cuda|amdgcn-amd-amdhsa]]:[[ARCH]])" {[[P3]]}, assembler +// DASM-NOT: host // // Test two gpu architectures with complete compilation in device-only @@ -248,7 +270,7 @@ // DBIN2_NV-DAG: [[P9:[0-9]+]]: backend, {[[P8]]}, assembler, (device-[[T]], [[ARCH2]]) // DBIN2_NV-DAG: [[P10:[0-9]+]]: assembler, {[[P9]]}, object, (device-[[T]], [[ARCH2]]) // DBIN2_NV-DAG: [[P11:[0-9]+]]: offload, "device-[[T]] ([[TRIPLE]]:[[ARCH2]])" {[[P10]]}, object - +// DBIN2-NOT: host // // Test two gpu architectures up to the assemble phase in device-only // compilation mode. @@ -271,3 +293,4 @@ // DASM2-DAG: [[P7:[0-9]+]]: compiler, {[[P6]]}, ir, (device-[[T]], [[ARCH2]]) // DASM2_NV-DAG: [[P8:[0-9]+]]: backend, {[[P7]]}, assembler, (device-[[T]], [[ARCH2]]) // DASM2_NV-DAG: [[P9:[0-9]+]]: offload, "device-[[T]] ([[TRIPLE]]:[[ARCH2]])" {[[P8]]}, assembler +// DASM2-NOT: host diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c index 3c339a117d..5198ef057b 100644 --- a/test/Driver/darwin-ld.c +++ b/test/Driver/darwin-ld.c @@ -341,10 +341,22 @@ // RUN: FileCheck -check-prefix=PROFILE_EXPORT %s < %t.log // PROFILE_EXPORT: "-exported_symbol" "___llvm_profile_filename" "-exported_symbol" "___llvm_profile_raw_version" "-exported_symbol" "_lprofCurFilename" // -// RUN: %clang -target x86_64-apple-darwin12 -fprofile-instr-generate -### %t.o 2> %t.log +// RUN: %clang -target x86_64-apple-darwin12 -fprofile-instr-generate --coverage -### %t.o 2> %t.log // RUN: FileCheck -check-prefix=NO_PROFILE_EXPORT %s < %t.log // NO_PROFILE_EXPORT-NOT: "-exported_symbol" // +// RUN: %clang -target x86_64-apple-darwin12 --coverage -exported_symbols_list /dev/null -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=GCOV_EXPORT %s < %t.log +// RUN: %clang -target x86_64-apple-darwin12 -fprofile-arcs -Wl,-exported_symbols_list,/dev/null -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=GCOV_EXPORT %s < %t.log +// RUN: %clang -target x86_64-apple-darwin12 -fprofile-arcs -Wl,-exported_symbol,foo -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=GCOV_EXPORT %s < %t.log +// RUN: %clang -target x86_64-apple-darwin12 -fprofile-arcs -Xlinker -exported_symbol -Xlinker foo -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=GCOV_EXPORT %s < %t.log +// RUN: %clang -target x86_64-apple-darwin12 -fprofile-arcs -Xlinker -exported_symbols_list -Xlinker /dev/null -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=GCOV_EXPORT %s < %t.log +// GCOV_EXPORT: "-exported_symbol" "___gcov_flush" +// // Check that we can pass the outliner down to the linker. // RUN: env IPHONEOS_DEPLOYMENT_TARGET=7.0 \ // RUN: %clang -target arm64-apple-darwin -moutline -### %t.o 2> %t.log diff --git a/test/Driver/darwin-stdlib.cpp b/test/Driver/darwin-stdlib.cpp index 26cbf2bde3..3da92a26ee 100644 --- a/test/Driver/darwin-stdlib.cpp +++ b/test/Driver/darwin-stdlib.cpp @@ -2,19 +2,20 @@ // than the platform default. (see https://llvm.org/bugs/show_bug.cgi?id=30548) // XFAIL: default-cxx-stdlib-set -// RUN: %clang -target x86_64-apple-darwin -arch arm64 -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX -// RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.8 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX -// RUN: %clang -target x86_64-apple-darwin -mmacosx-version-min=10.9 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX -// RUN: %clang -target x86_64-apple-darwin -arch armv7s -miphoneos-version-min=6.1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX -// RUN: %clang -target x86_64-apple-darwin -arch armv7s -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX -// RUN: %clang -target x86_64-apple-darwin -arch armv7k %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX +// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch arm64 -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX +// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.8 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX +// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -mmacosx-version-min=10.9 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX +// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=6.1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBSTDCXX +// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7s -miphoneos-version-min=7.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX +// RUN: %clang -target x86_64-apple-darwin -ccc-install-dir %S/Inputs/darwin_toolchain_tree/bin/ -arch armv7k %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LIBCXX // The purpose of this test is that the libc++ headers should be found -// properly. At the moment this is done by passing -stdlib=libc++ down to the -// cc1 invocation. If and when we change to finding them in the driver this test -// should reflect that. +// properly. We also pass -stdlib=libc++ to make sure the logic to add the +// optional absolute include for libc++ from InitHeaderSearch.cpp also fires. -// CHECK-LIBCXX: -stdlib=libc++ +// CHECK-LIBCXX: "-stdlib=libc++" +// CHECK-LIBCXX: "-internal-isystem" "{{[^"]*}}{{/|\\\\}}Inputs{{/|\\\\}}darwin_toolchain_tree{{/|\\\\}}bin{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" // CHECK-LIBSTDCXX-NOT: -stdlib=libc++ // CHECK-LIBSTDCXX-NOT: -stdlib=libstdc++ +// CHECK-LIBSTDCXX-NOT: -internal-isystem diff --git a/test/Driver/debug-options.c b/test/Driver/debug-options.c index ea9b7e7346..58269cbb29 100644 --- a/test/Driver/debug-options.c +++ b/test/Driver/debug-options.c @@ -64,6 +64,14 @@ // RUN: %clang -### -c -g %s -target x86_64-pc-freebsd10.0 2>&1 \ // RUN: | FileCheck -check-prefix=G_GDB %s +// Windows. +// RUN: %clang -### -c -g %s -target x86_64-w64-windows-gnu 2>&1 \ +// RUN: | FileCheck -check-prefix=G_GDB %s +// RUN: %clang -### -c -g %s -target x86_64-windows-msvc 2>&1 \ +// RUN: | FileCheck -check-prefix=G_NOTUNING %s +// RUN: %clang_cl -### -c -Z7 -target x86_64-windows-msvc -- %s 2>&1 \ +// RUN: | FileCheck -check-prefix=G_NOTUNING %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 \ @@ -149,6 +157,17 @@ // RUN: %clang -### -c -O3 -ffunction-sections -grecord-gcc-switches %s 2>&1 \ // | FileCheck -check-prefix=GRECORD_OPT %s // +// RUN: %clang -### -c -grecord-command-line %s 2>&1 \ +// | FileCheck -check-prefix=GRECORD %s +// RUN: %clang -### -c -gno-record-command-line %s 2>&1 \ +// | FileCheck -check-prefix=GNO_RECORD %s +// RUN: %clang -### -c -grecord-command-line -gno-record-command-line %s 2>&1 \ +// | FileCheck -check-prefix=GNO_RECORD %s/ +// RUN: %clang -### -c -grecord-command-line -o - %s 2>&1 \ +// | FileCheck -check-prefix=GRECORD_O %s +// RUN: %clang -### -c -O3 -ffunction-sections -grecord-command-line %s 2>&1 \ +// | FileCheck -check-prefix=GRECORD_OPT %s +// // RUN: %clang -### -c -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \ // RUN: | FileCheck -check-prefix=GIGNORE %s // @@ -165,6 +184,10 @@ // RUN: %clang -### -c -gsplit-dwarf %s 2>&1 | FileCheck -check-prefix=GPUB %s // RUN: %clang -### -c -gsplit-dwarf -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s // +// RUN: %clang -### -c -fdebug-ranges-base-address %s 2>&1 | FileCheck -check-prefix=RNGBSE %s +// RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s +// RUN: %clang -### -c -fdebug-ranges-base-address -fno-debug-ranges-base-address %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s +// // RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=GPUB %s // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s // @@ -200,7 +223,7 @@ // RUN: %clang -### -gmodules -gline-tables-only %s 2>&1 \ // RUN: | FileCheck -check-prefix=GLTO_ONLY %s // -// RUN: %clang -### -gmodules -gline-directives-only %s 2>&1 \ +// RUN: %clang -### -target %itanium_abi_triple -gmodules -gline-directives-only %s 2>&1 \ // RUN: | FileCheck -check-prefix=GLIO_ONLY %s // // G: "-cc1" @@ -255,6 +278,9 @@ // G_LLDB: "-debugger-tuning=lldb" // G_SCE: "-debugger-tuning=sce" // +// G_NOTUNING: "-cc1" +// G_NOTUNING-NOT: "-debugger-tuning=" +// // This tests asserts that "-gline-tables-only" "-g0" disables debug info. // GLTO_NO: "-cc1" // GLTO_NO-NOT: -debug-info-kind= @@ -282,6 +308,9 @@ // // PUB: -gpubnames // +// RNGBSE: -fdebug-ranges-base-address +// NORNGBSE-NOT: -fdebug-ranges-base-address +// // GARANGE: -generate-arange-section // // FDTS: "-mllvm" "-generate-type-units" @@ -294,7 +323,8 @@ // // NOCI-NOT: "-dwarf-column-info" // -// GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj" "-debug-info-kind={{standalone|limited}}" +// GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj" +// GEXTREFS: "-debug-info-kind={{standalone|limited}}" // RUN: not %clang -cc1 -debug-info-kind=watkind 2>&1 | FileCheck -check-prefix=BADSTRING1 %s // BADSTRING1: error: invalid value 'watkind' in '-debug-info-kind=watkind' diff --git a/test/Driver/embed-bitcode.s b/test/Driver/embed-bitcode.s new file mode 100644 index 0000000000..71a3e9c2fb --- /dev/null +++ b/test/Driver/embed-bitcode.s @@ -0,0 +1,12 @@ +// REQUIRES: arm-registered-target + +// RUN: %clang -c -target armv7-apple-ios10 %s -fembed-bitcode -### 2>&1 | FileCheck %s -check-prefix=CHECK-AS +// RUN: %clang -c -target armv7-apple-ios10 %s -fembed-bitcode-marker -### 2>&1 | FileCheck %s -check-prefix=CHECK-AS-MARKER +// CHECK-AS: -cc1as +// CHECK-AS: -fembed-bitcode=all +// CHECK-AS-MARKER: -fembed-bitcode=marker + +// RUN: %clang -c -target armv7-apple-ios10 %s -fembed-bitcode -o %t.o +// RUN: llvm-readobj -section-headers %t.o | FileCheck --check-prefix=CHECK-SECTION %s +// CHECK-SECTION: Name: __asm +// CHECK-SECTION-NEXT: Segment: __LLVM diff --git a/test/Driver/fopenmp.c b/test/Driver/fopenmp.c index ac0f1b44cb..63334ba49a 100644 --- a/test/Driver/fopenmp.c +++ b/test/Driver/fopenmp.c @@ -10,6 +10,9 @@ // RUN: %clang -target x86_64-netbsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // // CHECK-CC1-OPENMP: "-cc1" // CHECK-CC1-OPENMP: "-fopenmp" @@ -49,6 +52,14 @@ // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5MD +// +// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5MD +// // CHECK-LD-OMP: "{{.*}}ld{{(.exe)?}}" // CHECK-LD-OMP: "-lomp" // @@ -60,6 +71,9 @@ // CHECK-LD-IOMP5: "{{.*}}ld{{(.exe)?}}" // CHECK-LD-IOMP5: "-liomp5" // +// CHECK-LD-IOMP5MD: "{{.*}}ld{{(.exe)?}}" +// CHECK-LD-IOMP5MD: "-liomp5md" +// // CHECK-NO-OMP: "{{.*}}ld{{(.exe)?}}" // CHECK-NO-OMP-NOT: "-lomp" // @@ -69,6 +83,9 @@ // CHECK-NO-IOMP5: "{{.*}}ld{{(.exe)?}}" // CHECK-NO-IOMP5-NOT: "-liomp5" // +// CHECK-NO-IOMP5MD: "{{.*}}ld{{(.exe)?}}" +// CHECK-NO-IOMP5MD-NOT: "-liomp5md" +// // We'd like to check that the default is sane, but until we have the ability // to *always* semantically analyze OpenMP without always generating runtime // calls (in the event of an unsupported runtime), we don't have a good way to @@ -79,6 +96,10 @@ // RUN: %clang -target x86_64-darwin -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY // RUN: %clang -target x86_64-freebsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY // RUN: %clang -target x86_64-netbsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY +// RUN: %clang -target x86_64-windows-gnu -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANYMD // // CHECK-LD-ANY: "{{.*}}ld{{(.exe)?}}" // CHECK-LD-ANY: "-l{{(omp|gomp|iomp5)}}" +// +// CHECK-LD-ANYMD: "{{.*}}ld{{(.exe)?}}" +// CHECK-LD-ANYMD: "-l{{(omp|gomp|iomp5md)}}" diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c index 9f77c7929d..9411b68dab 100644 --- a/test/Driver/fsanitize.c +++ b/test/Driver/fsanitize.c @@ -17,9 +17,11 @@ // RUN: %clang -target i386-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32 // RUN: %clang -target i386-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32 --check-prefix=CHECK-UNDEFINED-WIN-CXX // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64 +// RUN: %clang -target x86_64-w64-mingw32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64-MINGW // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64 --check-prefix=CHECK-UNDEFINED-WIN-CXX // CHECK-UNDEFINED-WIN32: "--dependent-lib={{[^"]*}}ubsan_standalone-i386.lib" // CHECK-UNDEFINED-WIN64: "--dependent-lib={{[^"]*}}ubsan_standalone-x86_64.lib" +// CHECK-UNDEFINED-WIN64-MINGW: "--dependent-lib={{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a" // CHECK-UNDEFINED-WIN-CXX: "--dependent-lib={{[^"]*}}ubsan_standalone_cxx{{[^"]*}}.lib" // CHECK-UNDEFINED-WIN-SAME: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute),?){18}"}} @@ -29,22 +31,52 @@ // CHECK-COVERAGE-WIN64: "--dependent-lib={{[^"]*}}ubsan_standalone-x86_64.lib" // RUN: %clang -target x86_64-linux-gnu -fsanitize=integer %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INTEGER -implicit-check-not="-fsanitize-address-use-after-scope" -// CHECK-INTEGER: "-fsanitize={{((signed-integer-overflow|unsigned-integer-overflow|integer-divide-by-zero|shift-base|shift-exponent|implicit-integer-truncation),?){6}"}} +// CHECK-INTEGER: "-fsanitize={{((signed-integer-overflow|unsigned-integer-overflow|integer-divide-by-zero|shift-base|shift-exponent|implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){8}"}} // RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-conversion %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-conversion,CHECK-implicit-conversion-RECOVER // RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-conversion -fsanitize-recover=implicit-conversion %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-conversion,CHECK-implicit-conversion-RECOVER // RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-conversion -fno-sanitize-recover=implicit-conversion %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-conversion,CHECK-implicit-conversion-NORECOVER // RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-conversion -fsanitize-trap=implicit-conversion %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-conversion,CHECK-implicit-conversion-TRAP -// CHECK-implicit-conversion: "-fsanitize={{((implicit-integer-truncation),?){1}"}} -// CHECK-implicit-conversion-RECOVER: "-fsanitize-recover={{((implicit-integer-truncation),?){1}"}} -// CHECK-implicit-conversion-RECOVER-NOT: "-fno-sanitize-recover={{((implicit-integer-truncation),?){1}"}} -// CHECK-implicit-conversion-RECOVER-NOT: "-fsanitize-trap={{((implicit-integer-truncation),?){1}"}} -// CHECK-implicit-conversion-NORECOVER-NOT: "-fno-sanitize-recover={{((implicit-integer-truncation),?){1}"}} // ??? -// CHECK-implicit-conversion-NORECOVER-NOT: "-fsanitize-recover={{((implicit-integer-truncation),?){1}"}} -// CHECK-implicit-conversion-NORECOVER-NOT: "-fsanitize-trap={{((implicit-integer-truncation),?){1}"}} -// CHECK-implicit-conversion-TRAP: "-fsanitize-trap={{((implicit-integer-truncation),?){1}"}} -// CHECK-implicit-conversion-TRAP-NOT: "-fsanitize-recover={{((implicit-integer-truncation),?){1}"}} -// CHECK-implicit-conversion-TRAP-NOT: "-fno-sanitize-recover={{((implicit-integer-truncation),?){1}"}} +// CHECK-implicit-conversion: "-fsanitize={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){3}"}} +// CHECK-implicit-conversion-RECOVER: "-fsanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){3}"}} +// CHECK-implicit-conversion-RECOVER-NOT: "-fno-sanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){3}"}} +// CHECK-implicit-conversion-RECOVER-NOT: "-fsanitize-trap={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){3}"}} +// CHECK-implicit-conversion-NORECOVER-NOT: "-fno-sanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){3}"}} // ??? +// CHECK-implicit-conversion-NORECOVER-NOT: "-fsanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){3}"}} +// CHECK-implicit-conversion-NORECOVER-NOT: "-fsanitize-trap={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){3}"}} +// CHECK-implicit-conversion-TRAP: "-fsanitize-trap={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){3}"}} +// CHECK-implicit-conversion-TRAP-NOT: "-fsanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){3}"}} +// CHECK-implicit-conversion-TRAP-NOT: "-fno-sanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation|implicit-integer-sign-change),?){3}"}} + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-integer-arithmetic-value-change %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-integer-arithmetic-value-change,CHECK-implicit-integer-arithmetic-value-change-RECOVER +// RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-integer-arithmetic-value-change -fsanitize-recover=implicit-integer-arithmetic-value-change %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-integer-arithmetic-value-change,CHECK-implicit-integer-arithmetic-value-change-RECOVER +// RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-integer-arithmetic-value-change -fno-sanitize-recover=implicit-integer-arithmetic-value-change %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-integer-arithmetic-value-change,CHECK-implicit-integer-arithmetic-value-change-NORECOVER +// RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-integer-arithmetic-value-change -fsanitize-trap=implicit-integer-arithmetic-value-change %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-integer-arithmetic-value-change,CHECK-implicit-integer-arithmetic-value-change-TRAP +// CHECK-implicit-integer-arithmetic-value-change: "-fsanitize={{((implicit-signed-integer-truncation|implicit-integer-sign-change),?){2}"}} +// CHECK-implicit-integer-arithmetic-value-change-RECOVER: "-fsanitize-recover={{((implicit-signed-integer-truncation|implicit-integer-sign-change),?){2}"}} +// CHECK-implicit-integer-arithmetic-value-change-RECOVER-NOT: "-fno-sanitize-recover={{((implicit-signed-integer-truncation|implicit-integer-sign-change),?){2}"}} +// CHECK-implicit-integer-arithmetic-value-change-RECOVER-NOT: "-fsanitize-trap={{((implicit-signed-integer-truncation|implicit-integer-sign-change),?){2}"}} +// CHECK-implicit-integer-arithmetic-value-change-NORECOVER-NOT: "-fno-sanitize-recover={{((implicit-signed-integer-truncation|implicit-integer-sign-change),?){2}"}} // ??? +// CHECK-implicit-integer-arithmetic-value-change-NORECOVER-NOT: "-fsanitize-recover={{((implicit-signed-integer-truncation|implicit-integer-sign-change),?){2}"}} +// CHECK-implicit-integer-arithmetic-value-change-NORECOVER-NOT: "-fsanitize-trap={{((implicit-signed-integer-truncation|implicit-integer-sign-change),?){2}"}} +// CHECK-implicit-integer-arithmetic-value-change-TRAP: "-fsanitize-trap={{((implicit-signed-integer-truncation|implicit-integer-sign-change),?){2}"}} +// CHECK-implicit-integer-arithmetic-value-change-TRAP-NOT: "-fsanitize-recover={{((implicit-signed-integer-truncation|implicit-integer-sign-change),?){2}"}} +// CHECK-implicit-integer-arithmetic-value-change-TRAP-NOT: "-fno-sanitize-recover={{((implicit-signed-integer-truncation|implicit-integer-sign-change),?){2}"}} + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-integer-truncation %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-integer-truncation,CHECK-implicit-integer-truncation-RECOVER +// RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-integer-truncation -fsanitize-recover=implicit-integer-truncation %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-integer-truncation,CHECK-implicit-integer-truncation-RECOVER +// RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-integer-truncation -fno-sanitize-recover=implicit-integer-truncation %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-integer-truncation,CHECK-implicit-integer-truncation-NORECOVER +// RUN: %clang -target x86_64-linux-gnu -fsanitize=implicit-integer-truncation -fsanitize-trap=implicit-integer-truncation %s -### 2>&1 | FileCheck %s --check-prefixes=CHECK-implicit-integer-truncation,CHECK-implicit-integer-truncation-TRAP +// CHECK-implicit-integer-truncation: "-fsanitize={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation),?){2}"}} +// CHECK-implicit-integer-truncation-RECOVER: "-fsanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation),?){2}"}} +// CHECK-implicit-integer-truncation-RECOVER-NOT: "-fno-sanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation),?){2}"}} +// CHECK-implicit-integer-truncation-RECOVER-NOT: "-fsanitize-trap={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation),?){2}"}} +// CHECK-implicit-integer-truncation-NORECOVER-NOT: "-fno-sanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation),?){2}"}} // ??? +// CHECK-implicit-integer-truncation-NORECOVER-NOT: "-fsanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation),?){2}"}} +// CHECK-implicit-integer-truncation-NORECOVER-NOT: "-fsanitize-trap={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation),?){2}"}} +// CHECK-implicit-integer-truncation-TRAP: "-fsanitize-trap={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation),?){2}"}} +// CHECK-implicit-integer-truncation-TRAP-NOT: "-fsanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation),?){2}"}} +// CHECK-implicit-integer-truncation-TRAP-NOT: "-fno-sanitize-recover={{((implicit-unsigned-integer-truncation|implicit-signed-integer-truncation),?){2}"}} // RUN: %clang -fsanitize=bounds -### -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix=CHECK-BOUNDS // CHECK-BOUNDS: "-fsanitize={{((array-bounds|local-bounds),?){2}"}} @@ -191,6 +223,24 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-WITHOUT-USE-AFTER-SCOPE // CHECK-ASAN-WITHOUT-USE-AFTER-SCOPE: -cc1{{.*}}address-use-after-scope +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-poison-custom-array-cookie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE +// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fsanitize-address-poison-custom-array-cookie -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE +// CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE: -cc1{{.*}}-fsanitize-address-poison-custom-array-cookie + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-sanitize-address-poison-custom-array-cookie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE-OFF +// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fno-sanitize-address-poison-custom-array-cookie -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE-OFF +// CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE-OFF-NOT: -cc1{{.*}}address-poison-custom-array-cookie + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-sanitize-address-poison-custom-array-cookie -fsanitize-address-poison-custom-array-cookie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE-BOTH +// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fno-sanitize-address-poison-custom-array-cookie -fsanitize-address-poison-custom-array-cookie -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE-BOTH +// CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE-BOTH: -cc1{{.*}}-fsanitize-address-poison-custom-array-cookie + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-poison-custom-array-cookie -fno-sanitize-address-poison-custom-array-cookie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE-BOTH-OFF +// CHECK-POISON-CUSTOM-ARRAY-NEW-COOKIE-BOTH-OFF-NOT: -cc1{{.*}}address-poison-custom-array-cookie + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-WITHOUT-POISON-CUSTOM-ARRAY-NEW-COOKIE +// CHECK-ASAN-WITHOUT-POISON-CUSTOM-ARRAY-NEW-COOKIE-NOT: -cc1{{.*}}address-poison-custom-array-cookie + // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-globals-dead-stripping %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-GLOBALS // RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ASAN-GLOBALS // RUN: %clang_cl --target=x86_64-windows-msvc -fsanitize=address -fsanitize-address-globals-dead-stripping -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-GLOBALS @@ -198,6 +248,24 @@ // CHECK-ASAN-GLOBALS: -cc1{{.*}}-fsanitize-address-globals-dead-stripping // CHECK-NO-ASAN-GLOBALS-NOT: -cc1{{.*}}-fsanitize-address-globals-dead-stripping +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-use-odr-indicator %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR +// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fsanitize-address-use-odr-indicator -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR +// CHECK-ASAN-ODR-INDICATOR: -cc1{{.*}}-fsanitize-address-use-odr-indicator + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-sanitize-address-use-odr-indicator %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-OFF +// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fno-sanitize-address-use-odr-indicator -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-OFF +// CHECK-ASAN-ODR-INDICATOR-OFF-NOT: -cc1{{.*}}address-generate-odr-globals + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-sanitize-address-use-odr-indicator -fsanitize-address-use-odr-indicator %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-BOTH +// RUN: %clang_cl --target=x86_64-windows -fsanitize=address -fno-sanitize-address-use-odr-indicator -fsanitize-address-use-odr-indicator -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-BOTH +// CHECK-ASAN-ODR-INDICATOR-BOTH: -cc1{{.*}}-fsanitize-address-use-odr-indicator + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-use-odr-indicator -fno-sanitize-address-use-odr-indicator %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-ODR-INDICATOR-BOTH-OFF +// CHECK-ASAN-ODR-INDICATOR-BOTH-OFF-NOT: -cc1{{.*}}address-generate-odr-globals + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-WITHOUT-ODR-INDICATOR +// CHECK-ASAN-WITHOUT-ODR-INDICATOR-NOT: -cc1{{.*}}address-generate-odr-globals + // RUN: %clang -target x86_64-linux-gnu -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-TRACK-ORIGINS // CHECK-ONLY-TRACK-ORIGINS: warning: argument unused during compilation: '-fsanitize-memory-track-origins' @@ -717,6 +785,10 @@ // CHECK-CFI-NOICALL-MINIMAL: "-fsanitize-trap=cfi-derived-cast,cfi-mfcall,cfi-unrelated-cast,cfi-nvcall,cfi-vcall" // CHECK-CFI-NOICALL-MINIMAL: "-fsanitize-minimal-runtime" +// RUN: %clang -target x86_64-linux-gnu -fsanitize=shadow-call-stack -fsanitize-minimal-runtime %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SCS-MINIMAL +// CHECK-SCS-MINIMAL: "-fsanitize=shadow-call-stack" +// CHECK-SCS-MINIMAL: "-fsanitize-minimal-runtime" + // RUN: %clang -target aarch64-linux-gnu -fsanitize=scudo %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO // RUN: %clang -target arm-linux-androideabi -fsanitize=scudo %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO // RUN: %clang -target x86_64-linux-gnu -fsanitize=scudo %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SCUDO diff --git a/test/Driver/fuchsia.c b/test/Driver/fuchsia.c index f4bf003994..9c3ea53009 100644 --- a/test/Driver/fuchsia.c +++ b/test/Driver/fuchsia.c @@ -10,6 +10,7 @@ // CHECK: "--mrelax-relocations" // CHECK: "-munwind-tables" // CHECK: "-fuse-init-array" +// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" // CHECK: "-fsanitize=safe-stack" @@ -25,8 +26,8 @@ // CHECK-NOT: crti.o // CHECK-NOT: crtbegin.o // CHECK: "-L[[SYSROOT]]{{/|\\\\}}lib" -// CHECK-X86_64: "{{.*[/\\]}}libclang_rt.builtins.a" -// CHECK-AARCH64: "{{.*[/\\]}}libclang_rt.builtins.a" +// CHECK-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.builtins.a" +// CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.builtins.a" // CHECK: "-lc" // CHECK-NOT: crtend.o // CHECK-NOT: crtn.o @@ -57,8 +58,9 @@ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-SAFESTACK +// CHECK-SAFESTACK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-SAFESTACK: "-fsanitize=safe-stack" -// CHECK-SAFESTACK-NOT: "{{.*[/\\]}}libclang_rt.safestack.a" +// CHECK-SAFESTACK-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.safestack.a" // CHECK-SAFESTACK-NOT: "__safestack_init" // RUN: %clang %s -### --target=x86_64-fuchsia \ @@ -66,74 +68,106 @@ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-ASAN-X86 +// CHECK-ASAN-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-ASAN-X86: "-fsanitize=address" // CHECK-ASAN-X86: "-fsanitize-address-globals-dead-stripping" // CHECK-ASAN-X86: "-dynamic-linker" "asan/ld.so.1" -// CHECK-ASAN-X86: "{{.*[/\\]}}libclang_rt.asan.so" -// CHECK-ASAN-X86: "{{.*[/\\]}}libclang_rt.asan-preinit.a" +// CHECK-ASAN-X86: "-L[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}asan" +// CHECK-ASAN-X86: "-L[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib" +// CHECK-ASAN-X86: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.asan.so" +// CHECK-ASAN-X86: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.asan-preinit.a" // RUN: %clang %s -### --target=aarch64-fuchsia \ // RUN: -fsanitize=address 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-ASAN-AARCH64 +// CHECK-ASAN-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-ASAN-AARCH64: "-fsanitize=address" // CHECK-ASAN-AARCH64: "-fsanitize-address-globals-dead-stripping" // CHECK-ASAN-AARCH64: "-dynamic-linker" "asan/ld.so.1" -// CHECK-ASAN-AARCH64: "{{.*[/\\]}}libclang_rt.asan.so" -// CHECK-ASAN-AARCH64: "{{.*[/\\]}}libclang_rt.asan-preinit.a" +// CHECK-ASAN-AARCH64: "-L[[RESOURCE_DIR]]{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}lib{{/|\\\\}}asan" +// CHECK-ASAN-AARCH64: "-L[[RESOURCE_DIR]]{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}lib" +// CHECK-ASAN-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.asan.so" +// CHECK-ASAN-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.asan-preinit.a" // RUN: %clang %s -### --target=x86_64-fuchsia \ // RUN: -fsanitize=address -fPIC -shared 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-ASAN-SHARED +// CHECK-ASAN-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-ASAN-SHARED: "-fsanitize=address" // CHECK-ASAN-SHARED: "-fsanitize-address-globals-dead-stripping" -// CHECK-ASAN-SHARED: "{{.*[/\\]}}libclang_rt.asan.so" -// CHECK-ASAN-SHARED-NOT: "{{.*[/\\]}}libclang_rt.asan-preinit.a" +// CHECK-ASAN-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.asan.so" +// CHECK-ASAN-SHARED-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.asan-preinit.a" // RUN: %clang %s -### --target=x86_64-fuchsia \ // RUN: -fsanitize=fuzzer 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-X86 +// CHECK-FUZZER-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-FUZZER-X86: "-fsanitize=fuzzer,fuzzer-no-link,safe-stack" -// CHECK-FUZZER-X86: "{{.*[/\\]}}libclang_rt.fuzzer.a" +// CHECK-FUZZER-X86: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.fuzzer.a" // RUN: %clang %s -### --target=aarch64-fuchsia \ // RUN: -fsanitize=fuzzer 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-AARCH64 +// CHECK-FUZZER-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-FUZZER-AARCH64: "-fsanitize=fuzzer,fuzzer-no-link,safe-stack" -// CHECK-FUZZER-AARCH64: "{{.*[/\\]}}libclang_rt.fuzzer.a" +// CHECK-FUZZER-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.fuzzer.a" // RUN: %clang %s -### --target=x86_64-fuchsia \ // RUN: -fsanitize=scudo 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-X86 +// CHECK-SCUDO-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-SCUDO-X86: "-fsanitize=safe-stack,scudo" // CHECK-SCUDO-X86: "-pie" -// CHECK-SCUDO-X86: "{{.*[/\\]}}libclang_rt.scudo.so" +// CHECK-SCUDO-X86: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.scudo.so" // RUN: %clang %s -### --target=aarch64-fuchsia \ // RUN: -fsanitize=scudo 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-AARCH64 +// CHECK-SCUDO-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-SCUDO-AARCH64: "-fsanitize=safe-stack,scudo" // CHECK-SCUDO-AARCH64: "-pie" -// CHECK-SCUDO-AARCH64: "{{.*[/\\]}}libclang_rt.scudo.so" +// CHECK-SCUDO-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.scudo.so" // RUN: %clang %s -### --target=x86_64-fuchsia \ // RUN: -fsanitize=scudo -fPIC -shared 2>&1 \ // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: -fuse-ld=lld \ // RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-SHARED +// CHECK-SCUDO-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-SCUDO-SHARED: "-fsanitize=safe-stack,scudo" -// CHECK-SCUDO-SHARED: "{{.*[/\\]}}libclang_rt.scudo.so" +// CHECK-SCUDO-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.scudo.so" + +// RUN: %clang %s -### --target=x86_64-fuchsia \ +// RUN: -fxray-instrument -fxray-modes=xray-basic \ +// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ +// RUN: -fuse-ld=lld 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-XRAY-X86 +// CHECK-XRAY-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" +// CHECK-XRAY-X86: "-fxray-instrument" +// CHECK-XRAY-X86: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.xray.a" +// CHECK-XRAY-X86: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.xray-basic.a" + +// RUN: %clang %s -### --target=aarch64-fuchsia \ +// RUN: -fxray-instrument -fxray-modes=xray-basic \ +// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ +// RUN: -fuse-ld=lld 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-XRAY-AARCH64 +// CHECK-XRAY-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" +// CHECK-XRAY-AARCH64: "-fxray-instrument" +// CHECK-XRAY-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.xray.a" +// CHECK-XRAY-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.xray-basic.a" // RUN: %clang %s -### --target=aarch64-fuchsia \ // RUN: -O3 -flto -mcpu=cortex-a53 2>&1 \ @@ -149,3 +183,8 @@ // CHECK-THINLTO: "-plugin-opt=mcpu=x86-64" // CHECK-THINLTO: "-plugin-opt=thinlto" // CHECK-THINLTO: "-plugin-opt=jobs=8" + +// RUN: %clang %s -### --target=x86_64-fuchsia \ +// RUN: -gsplit-dwarf -c %s 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-SPLIT-DWARF +// CHECK-SPLIT-DWARF: "-split-dwarf-file" "fuchsia.dwo" diff --git a/test/Driver/fuchsia.cpp b/test/Driver/fuchsia.cpp index dad16e412e..2c80ad0703 100644 --- a/test/Driver/fuchsia.cpp +++ b/test/Driver/fuchsia.cpp @@ -1,8 +1,10 @@ -// RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \ +// RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-fuchsia \ +// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \ // RUN: --sysroot=%S/platform -fuse-ld=lld 2>&1 | FileCheck %s // CHECK: {{.*}}clang{{.*}}" "-cc1" // CHECK: "-triple" "x86_64-fuchsia" // CHECK: "-fuse-init-array" +// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}c++{{/|\\\\}}v1" // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" @@ -15,8 +17,12 @@ // CHECK-NOT: crti.o // CHECK-NOT: crtbegin.o // CHECK: "-L[[SYSROOT]]{{/|\\\\}}lib" -// CHECK: "-lc++" "-lm" -// CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a" +// CHECK: "--push-state" +// CHECK: "--as-needed" +// CHECK: "-lc++" +// CHECK: "-lm" +// CHECK: "--pop-state" +// CHECK: "[[RESOURCE_DIR]]{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}lib{{/|\\\\}}libclang_rt.builtins.a" // CHECK: "-lc" // CHECK-NOT: crtend.o // CHECK-NOT: crtn.o @@ -29,8 +35,11 @@ // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -static-libstdc++ \ // RUN: -fuse-ld=lld 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-STATIC +// CHECK-STATIC: "--push-state" +// CHECK-STATIC: "--as-needed" // CHECK-STATIC: "-Bstatic" // CHECK-STATIC: "-lc++" // CHECK-STATIC: "-Bdynamic" // CHECK-STATIC: "-lm" +// CHECK-STATIC: "--pop-state" // CHECK-STATIC: "-lc" diff --git a/test/Driver/gcodeview-ghash.c b/test/Driver/gcodeview-ghash.c new file mode 100644 index 0000000000..c45c829660 --- /dev/null +++ b/test/Driver/gcodeview-ghash.c @@ -0,0 +1,19 @@ +// 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. + +// GHASH: "-gcodeview-ghash" +// NO_GHASH-NOT: "-gcodeview-ghash" + +// default +// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s +// enabled +// RUN: %clang_cl /Z7 -gcodeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=GHASH %s +// disabled +// RUN: %clang_cl /Z7 -gcodeview-ghash -gno-codeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s + +// enabled, no /Z7 +// RUN: %clang_cl -gcodeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s + +// GCC-style driver +// RUN: %clang -g -gcodeview -gcodeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=GHASH %s +// RUN: %clang -g -gcodeview -gcodeview-ghash -gno-codeview-ghash -### -- %s 2>&1 | FileCheck -check-prefix=NO_GHASH %s diff --git a/test/Driver/header-module.cpp b/test/Driver/header-module.cpp index 2302c495f1..9a6ba5b108 100644 --- a/test/Driver/header-module.cpp +++ b/test/Driver/header-module.cpp @@ -7,7 +7,18 @@ // CHECK-PRECOMPILE-SAME: -fno-implicit-modules // CHECK-PRECOMPILE-SAME: -fmodule-name=foobar // CHECK-PRECOMPILE-SAME: -o {{.*}}.pcm -// CHECK-PRECOMPILE-SAME: -x c++ +// CHECK-PRECOMPILE-SAME: -x c++-header // CHECK-PRECOMPILE-SAME: header1.h // CHECK-PRECOMPILE-SAME: header2.h // CHECK-PRECOMPILE-SAME: header3.h +// +// RUN: %clang -fmodules-ts -fmodule-name=foobar -x c++-header -fsyntax-only %S/Inputs/header1.h %S/Inputs/header2.h %S/Inputs/header3.h -v 2>&1 | FileCheck %s --check-prefix=CHECK-SYNTAX-ONLY +// CHECK-SYNTAX-ONLY: -cc1 {{.*}} -fsyntax-only +// CHECK-SYNTAX-ONLY-SAME: -fmodules-ts +// CHECK-SYNTAX-ONLY-SAME: -fno-implicit-modules +// CHECK-SYNTAX-ONLY-SAME: -fmodule-name=foobar +// CHECK-SYNTAX-ONLY-NOT: -o{{ }} +// CHECK-SYNTAX-ONLY-SAME: -x c++-header +// CHECK-SYNTAX-ONLY-SAME: header1.h +// CHECK-SYNTAX-ONLY-SAME: header2.h +// CHECK-SYNTAX-ONLY-SAME: header3.h diff --git a/test/Driver/hexagon-hvx.c b/test/Driver/hexagon-hvx.c index 70699ce3df..4642aef81a 100644 --- a/test/Driver/hexagon-hvx.c +++ b/test/Driver/hexagon-hvx.c @@ -2,6 +2,10 @@ // Tests for the hvx features and warnings. // ----------------------------------------------------------------------------- +// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv66 -mhvx \ +// RUN: 2>&1 | FileCheck -check-prefix=CHECKHVX166 %s +// CHECKHVX166: "-target-feature" "+hvxv66" + // RUN: %clang -c %s -### -target hexagon-unknown-elf -mv65 -mhvx \ // RUN: 2>&1 | FileCheck -check-prefix=CHECKHVX165 %s // CHECKHVX165: "-target-feature" "+hvxv65" @@ -69,6 +73,9 @@ // RUN: %clang -c %s -### -target hexagon-unknown-elf -mv60 -mhvx \ // RUN: -mhvx-length=64B 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-64B %s // CHECK-HVXLENGTH-64B: "-target-feature" "+hvx{{.*}}" "-target-feature" "+hvx-length64b" +// The default mode on v66 and future archs is 128B. +// RUN: %clang -c %s -### -target hexagon-unknown-elf -mv66 -mhvx \ +// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-128B %s // RUN: %clang -c %s -### -target hexagon-unknown-elf -mv62 -mhvx -mhvx-length=128B\ // RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVXLENGTH-128B %s // CHECK-HVXLENGTH-128B: "-target-feature" "+hvx{{.*}}" "-target-feature" "+hvx-length128b" diff --git a/test/Driver/hexagon-toolchain-elf.c b/test/Driver/hexagon-toolchain-elf.c index a15c0f3434..a7eeca0fdb 100644 --- a/test/Driver/hexagon-toolchain-elf.c +++ b/test/Driver/hexagon-toolchain-elf.c @@ -59,19 +59,11 @@ // ----------------------------------------------------------------------------- // 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=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/Tools/bin \ // RUN: -mcpu=hexagonv5 \ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK021 %s // CHECK021: "-cc1" {{.*}} "-target-cpu" "hexagonv5" -// CHECK021: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v5/crt0 +// CHECK021: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v5/crt0 // RUN: %clang -### -target hexagon-unknown-elf \ // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ @@ -79,7 +71,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK022 %s // CHECK022: "-cc1" {{.*}} "-target-cpu" "hexagonv55" -// CHECK022: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v55/crt0 +// CHECK022: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v55/crt0 // RUN: %clang -### -target hexagon-unknown-elf \ // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ @@ -87,7 +79,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK023 %s // CHECK023: "-cc1" {{.*}} "-target-cpu" "hexagonv60" -// CHECK023: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0 +// CHECK023: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0 // RUN: %clang -### -target hexagon-unknown-elf \ // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ @@ -95,7 +87,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK024 %s // CHECK024: "-cc1" {{.*}} "-target-cpu" "hexagonv62" -// CHECK024: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v62/crt0 +// CHECK024: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v62/crt0 // RUN: %clang -### -target hexagon-unknown-elf \ // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ @@ -103,23 +95,31 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK025 %s // CHECK025: "-cc1" {{.*}} "-target-cpu" "hexagonv65" -// CHECK025: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v65/crt0 +// CHECK025: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v65/crt0 // RUN: %clang -### -target hexagon-unknown-elf \ // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ -// RUN: -O3 \ +// RUN: -mcpu=hexagonv66 \ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK026 %s -// CHECK026-NOT: "-ffp-contract=fast" -// CHECK026: hexagon-link +// CHECK026: "-cc1" {{.*}} "-target-cpu" "hexagonv66" +// CHECK026: {{hexagon-link|ld}}{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v66/crt0 // RUN: %clang -### -target hexagon-unknown-elf \ // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ -// RUN: -O3 -ffp-contract=off \ +// RUN: -O3 \ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK027 %s // CHECK027-NOT: "-ffp-contract=fast" -// CHECK027: hexagon-link +// CHECK027: {{hexagon-link|ld}} + +// RUN: %clang -### -target hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -O3 -ffp-contract=off \ +// RUN: %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK028 %s +// CHECK028-NOT: "-ffp-contract=fast" +// CHECK028: {{hexagon-link|ld}} // ----------------------------------------------------------------------------- // Test Linker related args @@ -134,7 +134,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK030 %s // CHECK030: "-cc1" -// CHECK030-NEXT: hexagon-link +// CHECK030: {{hexagon-link|ld}} // CHECK030-NOT: "-static" // CHECK030-NOT: "-shared" // CHECK030: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" @@ -155,7 +155,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK031 %s // CHECK031: "-cc1" -// CHECK031-NEXT: hexagon-link +// CHECK031: {{hexagon-link|ld}} // CHECK031-NOT: "-static" // CHECK031-NOT: "-shared" // CHECK031: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" @@ -178,7 +178,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK032 %s // CHECK032: "-cc1" -// CHECK032-NEXT: hexagon-link +// CHECK032: {{hexagon-link|ld}} // CHECK032-NOT: "-static" // CHECK032-NOT: "-shared" // CHECK032: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" @@ -201,7 +201,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK033 %s // CHECK033: "-cc1" -// CHECK033-NEXT: hexagon-link +// CHECK033: {{hexagon-link|ld}} // 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" @@ -219,7 +219,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK034 %s // CHECK034: "-cc1" -// CHECK034-NEXT: hexagon-link +// CHECK034: {{hexagon-link|ld}} // CHECK034: "-shared" "-call_shared" // CHECK034-NOT: crt0_standalone.o // CHECK034-NOT: crt0.o @@ -243,7 +243,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK035 %s // CHECK035: "-cc1" -// CHECK035-NEXT: hexagon-link +// CHECK035: {{hexagon-link|ld}} // CHECK035: "-shared" "-call_shared" "-static" // CHECK035-NOT: crt0_standalone.o // CHECK035-NOT: crt0.o @@ -269,7 +269,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK036 %s // CHECK036: "-cc1" -// CHECK036-NEXT: hexagon-link +// CHECK036: {{hexagon-link|ld}} // CHECK036-NOT: crt0_standalone.o // CHECK036-NOT: crt0.o // CHECK036-NOT: init.o @@ -292,7 +292,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK037 %s // CHECK037: "-cc1" -// CHECK037-NEXT: hexagon-link +// CHECK037: {{hexagon-link|ld}} // CHECK037-NOT: crt0_standalone.o // CHECK037-NOT: crt0.o // CHECK037-NOT: init.o @@ -315,7 +315,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK038 %s // CHECK038: "-cc1" -// CHECK038-NEXT: hexagon-link +// CHECK038: {{hexagon-link|ld}} // 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" @@ -341,7 +341,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK039 %s // CHECK039: "-cc1" -// CHECK039-NEXT: hexagon-link +// CHECK039: {{hexagon-link|ld}} // CHECK039-NOT: "-static" // CHECK039-NOT: "-shared" // CHECK039-NOT: crt0_standalone.o @@ -363,7 +363,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK03A %s // CHECK03A: "-cc1" -// CHECK03A-NEXT: hexagon-link +// CHECK03A: {{hexagon-link|ld}} // CHECK03A-NOT: "-static" // CHECK03A-NOT: "-shared" // CHECK03A: "{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v60/crt0_standalone.o" @@ -392,7 +392,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK03B %s // CHECK03B: "-cc1" -// CHECK03B-NEXT: hexagon-link +// CHECK03B: {{hexagon-link|ld}} // 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" @@ -416,7 +416,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK040 %s // CHECK040: "-cc1" -// CHECK040-NEXT: hexagon-link +// CHECK040: {{hexagon-link|ld}} // CHECK040-NOT: "-G{{[0-9]+}}" // RUN: %clang -### -target hexagon-unknown-elf \ @@ -435,7 +435,7 @@ // CHECK041-NOT: "-mrelocation-model" "static" // CHECK041: "-pic-level" "{{[12]}}" // CHECK041: "-mllvm" "-hexagon-small-data-threshold=0" -// CHECK041-NEXT: hexagon-link +// CHECK041: {{hexagon-link|ld}} // CHECK041: "-G0" // RUN: %clang -### -target hexagon-unknown-elf -fno-integrated-as \ @@ -461,7 +461,7 @@ // CHECK042: "-mllvm" "-hexagon-small-data-threshold=8" // CHECK042-NEXT: llvm-mc // CHECK042: "-gpsize=8" -// CHECK042-NEXT: hexagon-link +// CHECK042: {{hexagon-link|ld}} // CHECK042: "-G8" // ----------------------------------------------------------------------------- @@ -474,7 +474,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK050 %s // CHECK050: "-cc1" -// CHECK050-NEXT: hexagon-link +// CHECK050: {{hexagon-link|ld}} // CHECK050: "-pie" // RUN: %clang -### -target hexagon-unknown-elf \ @@ -484,7 +484,7 @@ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK051 %s // CHECK051: "-cc1" -// CHECK051-NEXT: hexagon-link +// CHECK051 {{hexagon-link|ld}} // CHECK051-NOT: "-pie" // ----------------------------------------------------------------------------- @@ -501,7 +501,7 @@ // CHECK060: "-cc1" // CHECK060-NEXT: llvm-mc // CHECK060: "--noexecstack" "--trap" "--keep-locals" -// CHECK060-NEXT: hexagon-link +// CHECK060 {{hexagon-link|ld}} // ----------------------------------------------------------------------------- // ffixed-r19 diff --git a/test/Driver/hip-device-libs.hip b/test/Driver/hip-device-libs.hip index 04afab1b73..3a7e7fd7df 100644 --- a/test/Driver/hip-device-libs.hip +++ b/test/Driver/hip-device-libs.hip @@ -21,7 +21,8 @@ // COM: [[LLVM_LINK:"*.llvm-link"]] -// COM-SAME: {{.*}} "{{.*}}ocml.amdgcn.bc" "{{.*}}ockl.amdgcn.bc" "{{.*}}irif.amdgcn.bc" +// COM-SAME: "{{.*}}hip.amdgcn.bc" "{{.*}}opencl.amdgcn.bc" +// COM-SAME: "{{.*}}ocml.amdgcn.bc" "{{.*}}ockl.amdgcn.bc" // FLUSHD-SAME: {{.*}} "{{.*}}oclc_daz_opt_on.amdgcn.bc" // NOFLUSHD-SAME: {{.*}} "{{.*}}oclc_daz_opt_off.amdgcn.bc" // COM-SAME: {{.*}} "-o" "{{.*}}-gfx900-linked-{{.*bc}}" diff --git a/test/Driver/hip-output-file-name.hip b/test/Driver/hip-output-file-name.hip index 65887f44d4..cce9f76406 100644 --- a/test/Driver/hip-output-file-name.hip +++ b/test/Driver/hip-output-file-name.hip @@ -2,7 +2,7 @@ // REQUIRES: x86-registered-target // REQUIRES: amdgpu-registered-target -// RUN: %clang -### -c -target x86_64-linux-gnu \ +// RUN: %clang -### -c -target x86_64-linux-gnu -fgpu-rdc \ // RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \ // RUN: 2>&1 | FileCheck %s diff --git a/test/Driver/hip-toolchain-no-rdc.hip b/test/Driver/hip-toolchain-no-rdc.hip new file mode 100644 index 0000000000..4f31a39a72 --- /dev/null +++ b/test/Driver/hip-toolchain-no-rdc.hip @@ -0,0 +1,158 @@ +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: amdgpu-registered-target + +// RUN: %clang -### -target x86_64-linux-gnu -fno-gpu-rdc \ +// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ +// RUN: --hip-device-lib=lib1.bc --hip-device-lib=lib2.bc \ +// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \ +// RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \ +// RUN: -fuse-ld=lld \ +// RUN: %S/Inputs/hip_multiple_inputs/a.cu \ +// RUN: %S/Inputs/hip_multiple_inputs/b.hip \ +// RUN: 2>&1 | FileCheck -check-prefixes=CHECK %s + +// +// Compile device code in a.cu to code object for gfx803. +// + +// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" +// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" +// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803" +// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden" +// CHECK-SAME: {{.*}} "-o" [[A_BC_803:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]] + +// CHECK: [[LLVM_LINK:"*.llvm-link"]] [[A_BC_803]] +// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc" +// CHECK-SAME: "-o" [[LINKED_BC_DEV_A_803:".*-gfx803-linked-.*bc"]] + +// CHECK: [[OPT:".*opt"]] [[LINKED_BC_DEV_A_803]] "-mtriple=amdgcn-amd-amdhsa" +// CHECK-SAME: "-mcpu=gfx803" +// CHECK-SAME: "-o" [[OPT_BC_DEV_A_803:".*-gfx803-optimized.*bc"]] + +// CHECK: [[LLC: ".*llc"]] [[OPT_BC_DEV_A_803]] "-mtriple=amdgcn-amd-amdhsa" +// CHECK-SAME: "-filetype=obj" +// CHECK-SAME: "-mattr=-code-object-v3" +// CHECK-SAME: "-mcpu=gfx803" "-o" [[OBJ_DEV_A_803:".*-gfx803-.*o"]] + +// CHECK: [[LLD: ".*lld"]] "-flavor" "gnu" "--no-undefined" "-shared" +// CHECK-SAME: "-o" "[[IMG_DEV_A_803:.*out]]" [[OBJ_DEV_A_803]] + +// +// Compile device code in a.cu to code object for gfx900. +// + +// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" +// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" +// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900" +// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden" +// CHECK-SAME: {{.*}} "-o" [[A_BC_900:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} [[A_SRC]] + +// CHECK: [[LLVM_LINK:"*.llvm-link"]] [[A_BC_900]] +// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc" +// CHECK-SAME: "-o" [[LINKED_BC_DEV_A_900:".*-gfx900-linked-.*bc"]] + +// CHECK: [[OPT:".*opt"]] [[LINKED_BC_DEV_A_900]] "-mtriple=amdgcn-amd-amdhsa" +// CHECK-SAME: "-mcpu=gfx900" +// CHECK-SAME: "-o" [[OPT_BC_DEV_A_900:".*-gfx900-optimized.*bc"]] + +// CHECK: [[LLC: ".*llc"]] [[OPT_BC_DEV_A_900]] "-mtriple=amdgcn-amd-amdhsa" +// CHECK-SAME: "-filetype=obj" +// CHECK-SAME: "-mattr=-code-object-v3" +// CHECK-SAME: "-mcpu=gfx900" "-o" [[OBJ_DEV_A_900:".*-gfx900-.*o"]] + +// CHECK: [[LLD: ".*lld"]] "-flavor" "gnu" "--no-undefined" "-shared" +// CHECK-SAME: "-o" "[[IMG_DEV_A_900:.*out]]" [[OBJ_DEV_A_900]] + +// +// Bundle and embed device code in host object for a.cu. +// + +// CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o" +// CHECK-SAME: "-targets={{.*}},hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900" +// CHECK-SAME: "-inputs={{.*}},[[IMG_DEV_A_803]],[[IMG_DEV_A_900]]" "-outputs=[[BUNDLE_A:.*hipfb]]" + +// CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu" +// CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa" "-emit-obj" +// CHECK-SAME: {{.*}} "-main-file-name" "a.cu" +// CHECK-SAME: {{.*}} "-o" [[A_OBJ_HOST:".*o"]] "-x" "hip" +// CHECK-SAME: {{.*}} [[A_SRC]] +// CHECK-SAME: {{.*}} "-fcuda-include-gpubinary" "[[BUNDLE_A]]" + +// +// Compile device code in b.hip to code object for gfx803. +// + +// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" +// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" +// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803" +// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden" +// CHECK-SAME: {{.*}} "-o" [[B_BC_803:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]] + +// CHECK: [[LLVM_LINK:"*.llvm-link"]] [[B_BC_803]] +// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc" +// CHECK-SAME: "-o" [[LINKED_BC_DEV_B_803:".*-gfx803-linked-.*bc"]] + +// CHECK: [[OPT:".*opt"]] [[LINKED_BC_DEV_B_803]] "-mtriple=amdgcn-amd-amdhsa" +// CHECK-SAME: "-mcpu=gfx803" +// CHECK-SAME: "-o" [[OPT_BC_DEV_B_803:".*-gfx803-optimized.*bc"]] + +// CHECK: [[LLC: ".*llc"]] [[OPT_BC_DEV_B_803]] "-mtriple=amdgcn-amd-amdhsa" +// CHECK-SAME: "-filetype=obj" +// CHECK-SAME: "-mattr=-code-object-v3" +// CHECK-SAME: "-mcpu=gfx803" "-o" [[OBJ_DEV_B_803:".*-gfx803-.*o"]] + +// CHECK: [[LLD: ".*lld"]] "-flavor" "gnu" "--no-undefined" "-shared" +// CHECK-SAME: "-o" "[[IMG_DEV_B_803:.*out]]" [[OBJ_DEV_B_803]] + +// +// Compile device code in b.hip to code object for gfx900. +// + +// CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" +// CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" +// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900" +// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden" +// CHECK-SAME: {{.*}} "-o" [[B_BC_900:".*bc"]] "-x" "hip" +// CHECK-SAME: {{.*}} [[B_SRC]] + +// CHECK: [[LLVM_LINK:"*.llvm-link"]] [[B_BC_900]] +// CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc" +// CHECK-SAME: "-o" [[LINKED_BC_DEV_B_900:".*-gfx900-linked-.*bc"]] + +// CHECK: [[OPT:".*opt"]] [[LINKED_BC_DEV_B_900]] "-mtriple=amdgcn-amd-amdhsa" +// CHECK-SAME: "-mcpu=gfx900" +// CHECK-SAME: "-o" [[OPT_BC_DEV_B_900:".*-gfx900-optimized.*bc"]] + +// CHECK: [[LLC: ".*llc"]] [[OPT_BC_DEV_B_900]] "-mtriple=amdgcn-amd-amdhsa" +// CHECK-SAME: "-filetype=obj" +// CHECK-SAME: "-mattr=-code-object-v3" +// CHECK-SAME: "-mcpu=gfx900" "-o" [[OBJ_DEV_B_900:".*-gfx900-.*o"]] + +// CHECK: [[LLD: ".*lld"]] "-flavor" "gnu" "--no-undefined" "-shared" +// CHECK-SAME: "-o" "[[IMG_DEV_B_900:.*out]]" [[OBJ_DEV_B_900]] + +// +// Bundle and embed device code in host object for b.hip. +// + +// CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o" +// CHECK-SAME: "-targets={{.*}},hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900" +// CHECK-SAME: "-inputs={{.*}},[[IMG_DEV_B_803]],[[IMG_DEV_B_900]]" "-outputs=[[BUNDLE_A:.*hipfb]]" + +// CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu" +// CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa" "-emit-obj" +// CHECK-SAME: {{.*}} "-main-file-name" "b.hip" +// CHECK-SAME: {{.*}} "-o" [[B_OBJ_HOST:".*o"]] "-x" "hip" +// CHECK-SAME: {{.*}} [[B_SRC]] +// CHECK-SAME: {{.*}} "-fcuda-include-gpubinary" "[[BUNDLE_A]]" + +// +// Link host objects. +// + +// CHECK: [[LD:".*ld.*"]] {{.*}} [[A_OBJ_HOST]] [[B_OBJ_HOST]] +// CHECK-NOT: "-T" "{{.*}}.lk" diff --git a/test/Driver/hip-toolchain.hip b/test/Driver/hip-toolchain-rdc.hip index 8bdce487b1..5f3fd9250b 100644 --- a/test/Driver/hip-toolchain.hip +++ b/test/Driver/hip-toolchain-rdc.hip @@ -7,7 +7,7 @@ // RUN: --hip-device-lib=lib1.bc --hip-device-lib=lib2.bc \ // RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \ // RUN: --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \ -// RUN: -fuse-ld=lld \ +// RUN: -fuse-ld=lld -fgpu-rdc \ // RUN: %S/Inputs/hip_multiple_inputs/a.cu \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ // RUN: 2>&1 | FileCheck %s @@ -15,14 +15,14 @@ // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" // CHECK-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803" -// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden" +// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fvisibility" "hidden" // CHECK-SAME: {{.*}} "-o" [[A_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]] // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" // CHECK-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803" -// CHECK-SAME: "-fcuda-is-device" "-fvisibility" "hidden" +// CHECK-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fvisibility" "hidden" // CHECK-SAME: {{.*}} "-o" [[B_BC:".*bc"]] "-x" "hip" // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]] @@ -35,7 +35,9 @@ // CHECK-SAME: "-o" [[OPT_BC_DEV1:".*-gfx803-optimized.*bc"]] // CHECK: [[LLC: ".*llc"]] [[OPT_BC_DEV1]] "-mtriple=amdgcn-amd-amdhsa" -// CHECK-SAME: "-filetype=obj" "-mcpu=gfx803" "-o" [[OBJ_DEV1:".*-gfx803-.*o"]] +// CHECK-SAME: "-filetype=obj" +// CHECK-SAME: "-mattr=-code-object-v3" +// CHECK-SAME: "-mcpu=gfx803" "-o" [[OBJ_DEV1:".*-gfx803-.*o"]] // CHECK: [[LLD: ".*lld"]] "-flavor" "gnu" "--no-undefined" "-shared" // CHECK-SAME: "-o" "[[IMG_DEV1:.*out]]" [[OBJ_DEV1]] @@ -61,7 +63,9 @@ // CHECK-SAME: "-o" [[OPT_BC_DEV2:".*-gfx900-optimized.*bc"]] // CHECK: [[LLC]] [[OPT_BC_DEV2]] "-mtriple=amdgcn-amd-amdhsa" -// CHECK-SAME: "-filetype=obj" "-mcpu=gfx900" "-o" [[OBJ_DEV2:".*-gfx900-.*o"]] +// CHECK-SAME: "-filetype=obj" +// CHECK-SAME: "-mattr=-code-object-v3" +// CHECK-SAME: "-mcpu=gfx900" "-o" [[OBJ_DEV2:".*-gfx900-.*o"]] // CHECK: [[LLD]] "-flavor" "gnu" "--no-undefined" "-shared" // CHECK-SAME: "-o" "[[IMG_DEV2:.*out]]" [[OBJ_DEV2]] @@ -80,7 +84,7 @@ // CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o" // CHECK-SAME: "-targets={{.*}},hip-amdgcn-amd-amdhsa-gfx803,hip-amdgcn-amd-amdhsa-gfx900" -// CHECK-SAME: "-inputs={{.*}},[[IMG_DEV1]],[[IMG_DEV2]]" "-outputs=[[BUNDLE:.*o]]" +// CHECK-SAME: "-inputs={{.*}},[[IMG_DEV1]],[[IMG_DEV2]]" "-outputs=[[BUNDLE:.*hipfb]]" // CHECK: [[LD:".*ld.*"]] {{.*}} [[A_OBJ_HOST]] [[B_OBJ_HOST]] // CHECK-SAME: {{.*}} "-T" "{{.*}}.lk" diff --git a/test/Driver/hurd.c b/test/Driver/hurd.c new file mode 100644 index 0000000000..a6ca8ea337 --- /dev/null +++ b/test/Driver/hurd.c @@ -0,0 +1,62 @@ +// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \ +// RUN: --target=i386-pc-gnu \ +// RUN: --sysroot=%S/Inputs/basic_hurd_tree \ +// RUN: | FileCheck --check-prefix=CHECK %s +// CHECK-NOT: warning: +// CHECK: "-cc1" +// CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// CHECK: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/i386-gnu" +// CHECK: "-internal-externc-isystem" "[[SYSROOT]]/include" +// CHECK: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" +// CHECK: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK: "-dynamic-linker" "/lib/ld.so" +// CHECK: "crtbegin.o" +// CHECK: "-L[[SYSROOT]]/lib/i386-gnu" +// CHECK: "-L[[SYSROOT]]/lib/../lib32" +// CHECK: "-L[[SYSROOT]]/usr/lib/i386-gnu" +// CHECK: "-L[[SYSROOT]]/usr/lib/../lib32" +// CHECK: "-L[[SYSROOT]]/lib" +// CHECK: "-L[[SYSROOT]]/usr/lib" + +// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \ +// RUN: --target=i386-pc-gnu -static \ +// RUN: --sysroot=%S/Inputs/basic_hurd_tree \ +// RUN: | FileCheck --check-prefix=CHECK-STATIC %s +// CHECK-STATIC-NOT: warning: +// CHECK-STATIC: "-cc1" +// CHECK-STATIC: "-static-define" +// CHECK-STATIC: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-STATIC: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// CHECK-STATIC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/i386-gnu" +// CHECK-STATIC: "-internal-externc-isystem" "[[SYSROOT]]/include" +// CHECK-STATIC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" +// CHECK-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-STATIC: "-static" +// CHECK-STATIC: "crtbeginT.o" +// CHECK-STATIC: "-L[[SYSROOT]]/lib/i386-gnu" +// CHECK-STATIC: "-L[[SYSROOT]]/lib/../lib32" +// CHECK-STATIC: "-L[[SYSROOT]]/usr/lib/i386-gnu" +// CHECK-STATIC: "-L[[SYSROOT]]/usr/lib/../lib32" +// CHECK-STATIC: "-L[[SYSROOT]]/lib" +// CHECK-STATIC: "-L[[SYSROOT]]/usr/lib" + +// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \ +// RUN: --target=i386-pc-gnu -shared \ +// RUN: --sysroot=%S/Inputs/basic_hurd_tree \ +// RUN: | FileCheck --check-prefix=CHECK-SHARED %s +// CHECK-SHARED-NOT: warning: +// CHECK-SHARED: "-cc1" +// CHECK-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-SHARED: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// CHECK-SHARED: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/i386-gnu" +// CHECK-SHARED: "-internal-externc-isystem" "[[SYSROOT]]/include" +// CHECK-SHARED: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" +// CHECK-SHARED: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-SHARED: "crtbeginS.o" +// CHECK-SHARED: "-L[[SYSROOT]]/lib/i386-gnu" +// CHECK-SHARED: "-L[[SYSROOT]]/lib/../lib32" +// CHECK-SHARED: "-L[[SYSROOT]]/usr/lib/i386-gnu" +// CHECK-SHARED: "-L[[SYSROOT]]/usr/lib/../lib32" +// CHECK-SHARED: "-L[[SYSROOT]]/lib" +// CHECK-SHARED: "-L[[SYSROOT]]/usr/lib" diff --git a/test/Driver/indirect-tls-seg-refs.c b/test/Driver/indirect-tls-seg-refs.c new file mode 100644 index 0000000000..b3f6932985 --- /dev/null +++ b/test/Driver/indirect-tls-seg-refs.c @@ -0,0 +1,8 @@ +// REQUIRES: clang-driver, x86-registered-target + +// RUN: %clang -### -target x86_64-unknown-linux %s 2>&1 | FileCheck %s -check-prefix=TLSDIRECT +// RUN: %clang -### -target x86_64-unknown-linux -mno-tls-direct-seg-refs -mtls-direct-seg-refs %s 2>&1 | FileCheck %s -check-prefix=TLSDIRECT +// RUN: %clang -### -target x86_64-unknown-linux -mtls-direct-seg-refs -mno-tls-direct-seg-refs %s 2>&1 | FileCheck %s -check-prefix=NO-TLSDIRECT + +// NO-TLSDIRECT: -mno-tls-direct-seg-refs +// TLSDIRECT-NOT: -mno-tls-direct-seg-refs diff --git a/test/Driver/integrated-as.s b/test/Driver/integrated-as.s index 1dcd4f611a..3ad0860b90 100644 --- a/test/Driver/integrated-as.s +++ b/test/Driver/integrated-as.s @@ -50,3 +50,9 @@ // RUN: %clang -### -target x86_64--- -x assembler -c -fPIC -integrated-as %s 2>&1 | FileCheck --check-prefix=PIC %s // PIC: "-mrelocation-model" "pic" + +// RUN: %clang -### -target x86_64--- -c -integrated-as %s -Wa,-fdebug-compilation-dir,. 2>&1 | FileCheck --check-prefix=WA_DEBUGDIR %s +// WA_DEBUGDIR: "-fdebug-compilation-dir" "." + +// RUN: %clang -### -target x86_64--- -c -integrated-as %s -Xassembler -fdebug-compilation-dir -Xassembler . 2>&1 | FileCheck --check-prefix=XA_DEBUGDIR %s +// XA_DEBUGDIR: "-fdebug-compilation-dir" "." diff --git a/test/Driver/linux-as.c b/test/Driver/linux-as.c index 68cf403d97..a9335ebf71 100644 --- a/test/Driver/linux-as.c +++ b/test/Driver/linux-as.c @@ -3,129 +3,160 @@ // RUN: %clang -target arm-linux -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM %s -// CHECK-ARM: as{{(.exe)?}}" "-mfloat-abi=soft" +// CHECK-ARM: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" // // RUN: %clang -target arm-linux -mcpu=cortex-a8 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-MCPU %s -// CHECK-ARM-MCPU: as{{(.exe)?}}" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// CHECK-ARM-MCPU: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-mcpu=cortex-a8" // // RUN: %clang -target arm-linux -mfpu=neon -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-MFPU %s -// CHECK-ARM-MFPU: as{{(.exe)?}}" "-mfloat-abi=soft" "-mfpu=neon" +// CHECK-ARM-MFPU: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-mfpu=neon" // // RUN: %clang -target arm-linux -march=armv7-a -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-MARCH %s -// CHECK-ARM-MARCH: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=armv7-a" +// CHECK-ARM-MARCH: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-march=armv7-a" +// +// RUN: %clang -target armeb-linux -mlittle-endian -mcpu=cortex-a8 -mfpu=neon -march=armv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARM-ALL %s +// CHECK-ARM-ALL: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-march=armv7-a" "-mcpu=cortex-a8" "-mfpu=neon" // // RUN: %clang -target arm-linux -mcpu=cortex-a8 -mfpu=neon -march=armv7-a -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-ALL %s -// CHECK-ARM-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=armv7-a" "-mcpu=cortex-a8" "-mfpu=neon" // -// RUN: %clang -target arm-linux -mcpu=cortex-a8 -mfpu=neon -march=armebv7-a -### \ +// RUN: %clang -target armeb-linux -mlittle-endian -mcpu=cortex-a8 -mfpu=neon -march=armv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARM-ALL %s +// +// RUN: %clang -target armeb-linux -mcpu=cortex-a8 -mfpu=neon -march=armebv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARMEB-ALL %s +// CHECK-ARMEB-ALL: as{{(.exe)?}}" "-EB" "-mfloat-abi=soft" "-march=armebv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// +// RUN: %clang -target arm-linux -mcpu=cortex-a8 -mfpu=neon -march=armebv7-a -mbig-endian -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARMEB-ALL %s -// CHECK-ARMEB-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=armebv7-a" "-mcpu=cortex-a8" "-mfpu=neon" // // RUN: %clang -target thumb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbv7-a -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-THUMB-ALL %s -// CHECK-THUMB-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=thumbv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// CHECK-THUMB-ALL: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" "-march=thumbv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// +// RUN: %clang -target thumbeb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbv7-a -mlittle-endian -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMB-ALL %s // -// RUN: %clang -target thumb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbebv7-a -### \ +// RUN: %clang -target thumbeb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbebv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMBEB-ALL %s +// CHECK-THUMBEB-ALL: as{{(.exe)?}}" "-EB" "-mfloat-abi=soft" "-march=thumbebv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// +// RUN: %clang -target thumb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbebv7-a -mbig-endian -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-THUMBEB-ALL %s -// CHECK-THUMBEB-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=thumbebv7-a" "-mcpu=cortex-a8" "-mfpu=neon" // // RUN: %clang -target armv7-linux -mcpu=cortex-a8 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-TARGET %s -// CHECK-ARM-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// CHECK-ARM-TARGET: as{{(.exe)?}}" "-EL" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" // // RUN: %clang -target armebv7-linux -mcpu=cortex-a8 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARMEB-TARGET %s -// CHECK-ARMEB-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// CHECK-ARMEB-TARGET: as{{(.exe)?}}" "-EB" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" // // RUN: %clang -target thumbv7-linux -mcpu=cortex-a8 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-THUMB-TARGET %s -// CHECK-THUMB-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// CHECK-THUMB-TARGET: as{{(.exe)?}}" "-EL" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" // // RUN: %clang -target thumbebv7-linux -mcpu=cortex-a8 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-THUMBEB-TARGET %s -// CHECK-THUMBEB-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// CHECK-THUMBEB-TARGET: as{{(.exe)?}}" "-EB" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" // // RUN: %clang -target armv8-linux -mcpu=cortex-a53 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-TARGET-V8 %s -// CHECK-ARM-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" +// CHECK-ARM-TARGET-V8: as{{(.exe)?}}" "-EL" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" // // RUN: %clang -target armebv8-linux -mcpu=cortex-a53 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARMEB-TARGET-V8 %s -// CHECK-ARMEB-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" +// CHECK-ARMEB-TARGET-V8: as{{(.exe)?}}" "-EB" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" // // RUN: %clang -target thumbv8-linux -mcpu=cortex-a53 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-THUMB-TARGET-V8 %s -// CHECK-THUMB-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" +// CHECK-THUMB-TARGET-V8: as{{(.exe)?}}" "-EL" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" // // RUN: %clang -target thumbebv8-linux -mcpu=cortex-a53 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-THUMBEB-TARGET-V8 %s -// CHECK-THUMBEB-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" +// CHECK-THUMBEB-TARGET-V8: as{{(.exe)?}}" "-EB" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" // // RUN: %clang -target arm-linux -mfloat-abi=hard -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-MFLOAT-ABI %s -// CHECK-ARM-MFLOAT-ABI: as{{(.exe)?}}" "-mfloat-abi=hard" +// CHECK-ARM-MFLOAT-ABI: as{{(.exe)?}}" "-EL" "-mfloat-abi=hard" // // RUN: %clang -target arm-linux-androideabi -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-ANDROID %s -// CHECK-ARM-ANDROID: as{{(.exe)?}}" "-mfloat-abi=soft" +// CHECK-ARM-ANDROID: as{{(.exe)?}}" "-EL" "-mfloat-abi=soft" // // RUN: %clang -target arm-linux-androideabi -march=armv7-a -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-ANDROID-SOFTFP %s -// CHECK-ARM-ANDROID-SOFTFP: as{{(.exe)?}}" "-mfloat-abi=softfp" "-march=armv7-a" +// CHECK-ARM-ANDROID-SOFTFP: as{{(.exe)?}}" "-EL" "-mfloat-abi=softfp" "-march=armv7-a" // // RUN: %clang -target arm-linux-eabi -mhard-float -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-HARDFP %s -// CHECK-ARM-HARDFP: as{{(.exe)?}}" "-mfloat-abi=hard" +// CHECK-ARM-HARDFP: as{{(.exe)?}}" "-EL" "-mfloat-abi=hard" // // RUN: %clang -target aarch64-linux-gnu -mcpu=cortex-a53 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM64-MCPU %s -// CHECK-ARM64-MCPU: as{{(.exe)?}}" "-mcpu=cortex-a53" +// CHECK-ARM64-MCPU: as{{(.exe)?}}" "-EL" "-mcpu=cortex-a53" // // RUN: %clang -target aarch64-linux-gnu -march=armv8-a -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM64-MARCH %s -// CHECK-ARM64-MARCH: as{{(.exe)?}}" "-march=armv8-a" +// CHECK-ARM64-MARCH: as{{(.exe)?}}" "-EL" "-march=armv8-a" // // RUN: %clang -target aarch64-linux-gnu -mcpu=cortex-a53 -march=armv8-a -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM64-ALL %s -// CHECK-ARM64-ALL: as{{(.exe)?}}" "-march=armv8-a" "-mcpu=cortex-a53" +// CHECK-ARM64-ALL: as{{(.exe)?}}" "-EL" "-march=armv8-a" "-mcpu=cortex-a53" +// +// RUN: %clang -target aarch64_be-linux-gnu -mcpu=cortex-a53 -march=armv8-a -mlittle-endian -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARM64-ALL %s // // RUN: %clang -target aarch64_be-linux-gnu -mcpu=cortex-a53 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-ARM64-MCPU %s +// RUN: | FileCheck -check-prefix=CHECK-ARM64BE-MCPU %s +// CHECK-ARM64BE-MCPU: as{{(.exe)?}}" "-EB" "-mcpu=cortex-a53" // // RUN: %clang -target aarch64_be-linux-gnu -march=armv8-a -### \ // RUN: -no-integrated-as -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-ARM64-MARCH %s +// RUN: | FileCheck -check-prefix=CHECK-ARM64BE-MARCH %s +// CHECK-ARM64BE-MARCH: as{{(.exe)?}}" "-EB" "-march=armv8-a" // // RUN: %clang -target aarch64_be-linux-gnu -mcpu=cortex-a53 -march=armv8-a -### \ // RUN: -no-integrated-as -c %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-ARM64-ALL %s +// RUN: | FileCheck -check-prefix=CHECK-ARM64BE-ALL %s +// CHECK-ARM64BE-ALL: as{{(.exe)?}}" "-EB" "-march=armv8-a" "-mcpu=cortex-a53" +// +// RUN: %clang -target aarch64-linux-gnu -mcpu=cortex-a53 -march=armv8-a -mbig-endian -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARM64BE-ALL %s // // RUN: %clang -target ppc-linux -mcpu=invalid-cpu -### \ // RUN: -no-integrated-as -c %s 2>&1 \ diff --git a/test/Driver/linux-header-search.cpp b/test/Driver/linux-header-search.cpp index b4118f9c42..03502423c1 100644 --- a/test/Driver/linux-header-search.cpp +++ b/test/Driver/linux-header-search.cpp @@ -517,3 +517,15 @@ // CHECK-OE-AARCH64: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-OE-AARCH64: "-internal-isystem" "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0/../../../include/c++/6.3.0" // CHECK-OE-AARCH64: "-internal-isystem" "[[SYSROOT]]/usr/lib64/aarch64-oe-linux/6.3.0/../../../include/c++/6.3.0/backward" + +// Check header search with Cray's gcc package. +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target x86_64-unknown-linux-gnu -stdlib=libstdc++ \ +// RUN: --sysroot=%S/Inputs/cray_suse_gcc_tree \ +// RUN: --gcc-toolchain="%S/Inputs/cray_suse_gcc_tree/opt/gcc/8.2.0/snos" \ +// RUN: | FileCheck --check-prefix=CHECK-CRAY-X86 %s + +// CHECK-CRAY-X86: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-CRAY-X86: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-CRAY-X86: "-internal-isystem" "[[SYSROOT]]/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/../../../../include/g++" +// CHECK-CRAY-X86: "-internal-isystem" "[[SYSROOT]]/opt/gcc/8.2.0/snos/lib/gcc/x86_64-suse-linux/8.2.0/../../../../include/g++/backward" diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index 030753cb2b..dc2f775abe 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -879,7 +879,7 @@ // RUN: %clang %s -### -o %t.o 2>&1 \ // RUN: --target=hexagon-linux-gnu \ // RUN: | FileCheck --check-prefix=CHECK-HEXAGON %s -// CHECK-HEXAGON: "{{.*}}hexagon-link{{(.exe)?}}" +// CHECK-HEXAGON: "{{.*}}{{hexagon-link|ld}}{{(.exe)?}}" // CHECK-HEXAGON-NOT: "--hash-style={{gnu|both}}" // // Check that we do not pass --hash-style=gnu and --hash-style=both to linker @@ -975,6 +975,34 @@ // CHECK-MIPS64EL-REDHAT: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld.so.1" // CHECK-MIPS64EL-REDHAT-NOT: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld-musl-mipsel.so.1" // CHECK-MIPS64EL-REDHAT-NOT: "--hash-style={{gnu|both}}" + +// Check that we pass --hash-style=both for pre-M Android versions and +// --hash-style=gnu for newer Android versions. +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=armv7-linux-android21 \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-HASH-STYLE-L %s +// CHECK-ANDROID-HASH-STYLE-L: "{{.*}}ld{{(.exe)?}}" +// CHECK-ANDROID-HASH-STYLE-L: "--hash-style=both" +// +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=armv7-linux-android23 \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-HASH-STYLE-M %s +// CHECK-ANDROID-HASH-STYLE-M: "{{.*}}ld{{(.exe)?}}" +// CHECK-ANDROID-HASH-STYLE-M: "--hash-style=gnu" +// +// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64-linux-gnuabin32 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-GNUABIN32 %s +// CHECK-MIPS64EL-GNUABIN32: "{{.*}}ld{{(.exe)?}}" +// CHECK-MIPS64EL-GNUABIN32: "-m" "elf32btsmipn32" +// CHECK-MIPS64EL-GNUABIN32: "-dynamic-linker" "{{.*}}/lib{{(32)?}}/ld.so.1" +// CHECK-MIPS64EL-GNUABIN32-NOT: "--hash-style={{gnu|both}}" +// +// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64-linux-gnuabi64 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-GNUABI64 %s +// CHECK-MIPS64EL-GNUABI64: "{{.*}}ld{{(.exe)?}}" +// CHECK-MIPS64EL-GNUABI64: "-m" "elf64btsmip" +// CHECK-MIPS64EL-GNUABI64: "-dynamic-linker" "{{.*}}/lib{{(64)?}}/ld.so.1" +// CHECK-MIPS64EL-GNUABI64-NOT: "--hash-style={{gnu|both}}" // // RUN: %clang %s -### -o %t.o 2>&1 \ // RUN: --target=sparc-unknown-linux-gnu \ @@ -1241,6 +1269,8 @@ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-ANDROID %s // CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-ANDROID: "-z" "now" +// CHECK-ANDROID: "-z" "relro" // CHECK-ANDROID: "--enable-new-dtags" // CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o" // CHECK-ANDROID: "-L[[SYSROOT]]/usr/lib" @@ -1743,6 +1773,7 @@ // RUN: | FileCheck --check-prefix=CHECK-ARMEB %s // CHECK-ARMEB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" // CHECK-ARMEB-NOT: "--be8" +// CHECK-ARMEB: "-EB" // CHECK-ARMEB: "-m" "armelfb_linux_eabi" // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ @@ -1752,16 +1783,88 @@ // RUN: | FileCheck --check-prefix=CHECK-ARMV7EB %s // CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" // CHECK-ARMV7EB: "--be8" +// CHECK-ARMV7EB: "-EB" // CHECK-ARMV7EB: "-m" "armelfb_linux_eabi" // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=armv7-unknown-linux \ +// RUN: -mbig-endian \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7EB %s + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=armebv7-unknown-linux \ +// RUN: -mbig-endian \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7EB %s + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=armv7-unknown-linux \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7EL %s +// CHECK-ARMV7EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-ARMV7EL-NOT: "--be8" +// CHECK-ARMV7EL: "-EL" +// CHECK-ARMV7EL: "-m" "armelf_linux_eabi" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=armebv7-unknown-linux \ +// RUN: -mlittle-endian \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7EL %s + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=armv7-unknown-linux \ +// RUN: -mlittle-endian \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-ARMV7EL %s + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=aarch64_be-unknown-linux \ // RUN: --gcc-toolchain="" \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-AARCH64BE %s // CHECK-AARCH64BE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-AARCH64BE-NOT: "--be8" +// CHECK-AARCH64BE: "-EB" // CHECK-AARCH64BE: "-m" "aarch64linuxb" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=aarch64-unknown-linux \ +// RUN: -mbig-endian \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-AARCH64BE %s + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=aarch64_be-unknown-linux \ +// RUN: -mbig-endian \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-AARCH64BE %s + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=aarch64-unknown-linux \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-AARCH64LE %s +// CHECK-AARCH64LE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-AARCH64LE-NOT: "--be8" +// CHECK-AARCH64LE: "-EL" +// CHECK-AARCH64LE: "-m" "aarch64linux" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=aarch64_be-unknown-linux \ +// RUN: -mlittle-endian \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-AARCH64LE %s + // Check dynamic-linker for musl-libc // RUN: %clang %s -### -o %t.o 2>&1 \ // RUN: --target=i386-pc-linux-musl \ diff --git a/test/Driver/mingw-lto.c b/test/Driver/mingw-lto.c new file mode 100644 index 0000000000..8bb4aedefd --- /dev/null +++ b/test/Driver/mingw-lto.c @@ -0,0 +1,4 @@ +// The default linker doesn't support LLVM bitcode +// RUN: not %clang -target i686-pc-windows-gnu %s -flto -fuse-ld=bfd +// When using lld, this is allowed though. +// RUN: %clang -target i686-pc-windows-gnu -### %s -flto -fuse-ld=lld diff --git a/test/Driver/mingw-sanitizers.c b/test/Driver/mingw-sanitizers.c new file mode 100644 index 0000000000..09f28fea8a --- /dev/null +++ b/test/Driver/mingw-sanitizers.c @@ -0,0 +1,11 @@ +// RUN: %clang -target i686-windows-gnu %s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-I686 %s +// ASAN-I686: "{{.*}}libclang_rt.asan_dynamic-i386.dll.a" +// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk-i386.a" +// ASAN-I686: "--require-defined" "___asan_seh_interceptor" +// ASAN-I686: "--whole-archive" "{{.*}}libclang_rt.asan_dynamic_runtime_thunk-i386.a" "--no-whole-archive" + +// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-X86_64 %s +// ASAN-X86_64: "{{.*}}libclang_rt.asan_dynamic-x86_64.dll.a" +// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk-x86_64.a" +// ASAN-X86_64: "--require-defined" "__asan_seh_interceptor" +// ASAN-X86_64: "--whole-archive" "{{.*}}libclang_rt.asan_dynamic_runtime_thunk-x86_64.a" "--no-whole-archive" diff --git a/test/Driver/mips-abi.c b/test/Driver/mips-abi.c index 066b81bd95..63ffd99b52 100644 --- a/test/Driver/mips-abi.c +++ b/test/Driver/mips-abi.c @@ -164,7 +164,7 @@ // MIPS-ARCH-UNKNOWN: error: unknown target CPU 'unknown' // Check adjusting of target triple accordingly to `-mabi` option. -// RUN: %clang -target mips64-linux-gnu -mabi=32 -### %s 2>&1 \ +// RUN: %clang -target mips64-linux-gnuabi64 -mabi=32 -### %s 2>&1 \ // RUN: | FileCheck -check-prefix=TARGET-O32 %s // TARGET-O32: "-triple" "mips-unknown-linux-gnu" // TARGET-O32: "-target-cpu" "mips32r2" @@ -174,7 +174,7 @@ // RUN: %clang -target mips-linux-gnu -mabi=n32 -### %s 2>&1 \ // RUN: | FileCheck -check-prefix=TARGET-N32 %s -// TARGET-N32: "-triple" "mips64-unknown-linux-gnu" +// TARGET-N32: "-triple" "mips64-unknown-linux-gnuabin32" // TARGET-N32: "-target-cpu" "mips64r2" // TARGET-N32: "-target-abi" "n32" // TARGET-N32: ld{{(.exe)?}}" @@ -182,7 +182,7 @@ // RUN: %clang -target mips-linux-gnu -mabi=64 -### %s 2>&1 \ // RUN: | FileCheck -check-prefix=TARGET-N64 %s -// TARGET-N64: "-triple" "mips64-unknown-linux-gnu" +// TARGET-N64: "-triple" "mips64-unknown-linux-gnuabi64" // TARGET-N64: "-target-cpu" "mips64r2" // TARGET-N64: "-target-abi" "n64" // TARGET-N64: ld{{(.exe)?}}" diff --git a/test/Driver/mips-abicalls-error.c b/test/Driver/mips-abicalls-error.c index 10f7201bdb..03ef68b02d 100644 --- a/test/Driver/mips-abicalls-error.c +++ b/test/Driver/mips-abicalls-error.c @@ -1,2 +1,2 @@ // RUN: not %clang -c -target mips64-linux-gnu -fPIC -mno-abicalls %s 2>&1 | FileCheck %s -// CHECK: error: position-independent code requires ‘-mabicalls’ +// CHECK: error: position-independent code requires '-mabicalls' diff --git a/test/Driver/objc-convert-messages-to-runtime-calls.m b/test/Driver/objc-convert-messages-to-runtime-calls.m new file mode 100644 index 0000000000..ed7be571eb --- /dev/null +++ b/test/Driver/objc-convert-messages-to-runtime-calls.m @@ -0,0 +1,7 @@ +// RUN: %clang %s -### -o %t.o 2>&1 -fsyntax-only -fobjc-convert-messages-to-runtime-calls -fno-objc-convert-messages-to-runtime-calls -target x86_64-apple-macosx10.10.0 | FileCheck %s --check-prefix=DISABLE +// RUN: %clang %s -### -o %t.o 2>&1 -fsyntax-only -fno-objc-convert-messages-to-runtime-calls -fobjc-convert-messages-to-runtime-calls -target x86_64-apple-macosx10.10.0 | FileCheck %s --check-prefix=ENABLE + +// Check that we pass fobjc-convert-messages-to-runtime-calls only when supported, and not explicitly disabled. + +// DISABLE: "-fno-objc-convert-messages-to-runtime-calls" +// ENABLE-NOT: "-fno-objc-convert-messages-to-runtime-calls" diff --git a/test/Driver/openbsd.c b/test/Driver/openbsd.c index d3846b7acf..182c4d49d6 100644 --- a/test/Driver/openbsd.c +++ b/test/Driver/openbsd.c @@ -1,18 +1,18 @@ // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-LD %s // CHECK-LD: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-LD: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o" +// CHECK-LD: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" // Check for --eh-frame-hdr being passed with static linking // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-LD-STATIC-EH %s // CHECK-LD-STATIC-EH: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-LD-STATIC-EH: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bstatic" "-o" "a.out" "{{.*}}rcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o" +// CHECK-LD-STATIC-EH: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bstatic" "-o" "a.out" "{{.*}}rcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" // RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pg -pthread %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG %s // CHECK-PG: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lgcc" "-lpthread_p" "-lc_p" "-lgcc" "{{.*}}crtend.o" +// CHECK-PG: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-nopie" "-o" "a.out" "{{.*}}gcrt0.o" "{{.*}}crtbegin.o" "{{.*}}.o" "-lcompiler_rt" "-lpthread_p" "-lc_p" "-lcompiler_rt" "{{.*}}crtend.o" // Check CPU type for MIPS64 // RUN: %clang -target mips64-unknown-openbsd -### -c %s 2>&1 \ @@ -36,17 +36,17 @@ // RUN: %clang -no-canonical-prefixes -target mips64el-unknown-openbsd %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-LD %s // CHECK-LD-R: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-LD-R: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-r" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o" +// CHECK-LD-R: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-r" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" // CHECK-LD-S: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-LD-S: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-s" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o" +// CHECK-LD-S: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-s" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" // CHECK-LD-T: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-LD-T: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-t" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o" +// CHECK-LD-T: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-t" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" // CHECK-LD-Z: clang{{.*}}" "-cc1" "-triple" "i686-pc-openbsd" -// CHECK-LD-Z: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-Z" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o" +// CHECK-LD-Z: ld{{.*}}" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "-Z" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" // CHECK-MIPS64-LD: clang{{.*}}" "-cc1" "-triple" "mips64-unknown-openbsd" -// CHECK-MIPS64-LD: ld{{.*}}" "-EB" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o" +// CHECK-MIPS64-LD: ld{{.*}}" "-EB" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" // CHECK-MIPS64EL-LD: clang{{.*}}" "-cc1" "-triple" "mips64el-unknown-openbsd" -// CHECK-MIPS64EL-LD: ld{{.*}}" "-EL" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "{{.*}}.o" "-lgcc" "-lc" "-lgcc" "{{.*}}crtend.o" +// CHECK-MIPS64EL-LD: ld{{.*}}" "-EL" "-e" "__start" "--eh-frame-hdr" "-Bdynamic" "-dynamic-linker" "{{.*}}ld.so" "-o" "a.out" "{{.*}}crt0.o" "{{.*}}crtbegin.o" "-L{{.*}}" "{{.*}}.o" "-lcompiler_rt" "-lc" "-lcompiler_rt" "{{.*}}crtend.o" // Check passing options to the assembler for various OpenBSD targets // RUN: %clang -target amd64-pc-openbsd -m32 -### -no-integrated-as -c %s 2>&1 \ @@ -112,3 +112,8 @@ // RUN: | FileCheck -check-prefix=CHECK-ARM-FLOAT-ABI %s // CHECK-ARM-FLOAT-ABI-NOT: "-target-feature" "+soft-float" // CHECK-ARM-FLOAT-ABI: "-target-feature" "+soft-float-abi" + +// Check PowerPC for Secure PLT +// RUN: %clang -target powerpc-unknown-openbsd -### -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-POWERPC-SECUREPLT %s +// CHECK-POWERPC-SECUREPLT: "-target-feature" "+secure-plt" diff --git a/test/Driver/openbsd.cpp b/test/Driver/openbsd.cpp new file mode 100644 index 0000000000..9293148680 --- /dev/null +++ b/test/Driver/openbsd.cpp @@ -0,0 +1,19 @@ +// RUN: %clangxx %s -### -o %t.o -target amd64-pc-openbsd 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CXX %s +// RUN: %clangxx %s -### -o %t.o -target i686-pc-openbsd 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CXX %s +// RUN: %clangxx %s -### -o %t.o -target aarch64-unknown-openbsd 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CXX %s +// RUN: %clangxx %s -### -o %t.o -target arm-unknown-openbsd 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CXX %s +// CHECK-CXX: "-lc++" "-lc++abi" "-lm" + +// RUN: %clangxx %s -### -pg -o %t.o -target amd64-pc-openbsd 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s +// RUN: %clangxx %s -### -pg -o %t.o -target i686-pc-openbsd 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s +// RUN: %clangxx %s -### -pg -o %t.o -target aarch64-unknown-openbsd 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s +// RUN: %clangxx %s -### -pg -o %t.o -target arm-unknown-openbsd 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s +// CHECK-PG-CXX: "-lc++_p" "-lc++abi_p" "-lm_p" diff --git a/test/Driver/openmp-offload-gpu.c b/test/Driver/openmp-offload-gpu.c index 940828b82b..dfdc79b5f7 100644 --- a/test/Driver/openmp-offload-gpu.c +++ b/test/Driver/openmp-offload-gpu.c @@ -190,29 +190,35 @@ // CHK-BCLIB-WARN: No library 'libomptarget-nvptx-sm_20.bc' found in the default clang lib directory or in LIBRARY_PATH. Expect degraded performance due to no inlining of runtime functions on target devices. /// Check that debug info is emitted in dwarf-2 -// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 \ -// RUN: | FileCheck -check-prefix=NO_DEBUG %s +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O1 --no-cuda-noopt-device-debug 2>&1 \ +// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 2>&1 \ -// RUN: | FileCheck -check-prefix=NO_DEBUG %s +// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O3 --no-cuda-noopt-device-debug 2>&1 \ -// RUN: | FileCheck -check-prefix=NO_DEBUG %s +// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g0 2>&1 \ // RUN: | FileCheck -check-prefix=NO_DEBUG %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb0 -O3 --cuda-noopt-device-debug 2>&1 \ // RUN: | FileCheck -check-prefix=NO_DEBUG %s -// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-tables-only 2>&1 \ -// RUN: | FileCheck -check-prefix=NO_DEBUG -check-prefix=LINE_TABLE %s -// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \ -// RUN: | FileCheck -check-prefix=NO_DEBUG -check-prefix=LINE_TABLE %s +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-directives-only 2>&1 \ +// RUN: | FileCheck -check-prefix=DEBUG_DIRECTIVES %s -// LINE_TABLE-NOT: warning: debug +// DEBUG_DIRECTIVES-NOT: warning: debug // NO_DEBUG-NOT: warning: debug +// NO_DEBUG: "-fopenmp-is-device" +// NO_DEBUG-NOT: "-debug-info-kind= // NO_DEBUG: ptxas -// LINE_TABLE: "-lineinfo" +// DEBUG_DIRECTIVES: "-triple" "nvptx64-nvidia-cuda" +// DEBUG_DIRECTIVES-SAME: "-debug-info-kind=line-directives-only" +// DEBUG_DIRECTIVES-SAME: "-fopenmp-is-device" +// DEBUG_DIRECTIVES: ptxas +// DEBUG_DIRECTIVES: "-lineinfo" // NO_DEBUG-NOT: "-g" // NO_DEBUG: nvlink // NO_DEBUG-NOT: "-g" +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --no-cuda-noopt-device-debug 2>&1 \ +// RUN: | FileCheck -check-prefix=HAS_DEBUG %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g 2>&1 \ // RUN: | FileCheck -check-prefix=HAS_DEBUG %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -g -O0 --cuda-noopt-device-debug 2>&1 \ @@ -227,9 +233,14 @@ // RUN: | FileCheck -check-prefix=HAS_DEBUG %s // RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb3 -O2 --cuda-noopt-device-debug 2>&1 \ // RUN: | FileCheck -check-prefix=HAS_DEBUG %s +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -gline-tables-only 2>&1 \ +// RUN: | FileCheck -check-prefix=HAS_DEBUG %s +// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_60 %s -ggdb1 -O2 --cuda-noopt-device-debug 2>&1 \ +// RUN: | FileCheck -check-prefix=HAS_DEBUG %s // HAS_DEBUG-NOT: warning: debug // HAS_DEBUG: "-triple" "nvptx64-nvidia-cuda" +// HAS_DEBUG-SAME: "-debug-info-kind={{limited|line-tables-only}}" // HAS_DEBUG-SAME: "-dwarf-version=2" // HAS_DEBUG-SAME: "-fopenmp-is-device" // HAS_DEBUG: ptxas diff --git a/test/Driver/print-multi-directory.c b/test/Driver/print-multi-directory.c index c98715d71e..5fb6a118e1 100644 --- a/test/Driver/print-multi-directory.c +++ b/test/Driver/print-multi-directory.c @@ -1,6 +1,6 @@ // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>/dev/null \ // RUN: -target i386-none-linux \ -// RUN: -B%S/Inputs/multilib_64bit_linux_tree/usr \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree/usr \ // RUN: -print-multi-directory \ // RUN: | FileCheck --match-full-lines --check-prefix=CHECK-X86-MULTILIBS %s @@ -9,7 +9,7 @@ // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>/dev/null \ // RUN: -target i386-none-linux -m64 \ -// RUN: -B%S/Inputs/multilib_64bit_linux_tree/usr \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree/usr \ // RUN: -print-multi-directory \ // RUN: | FileCheck --match-full-lines --check-prefix=CHECK-X86_64-MULTILIBS %s diff --git a/test/Driver/pth.c b/test/Driver/pth.c deleted file mode 100644 index e56c34c93b..0000000000 --- a/test/Driver/pth.c +++ /dev/null @@ -1,12 +0,0 @@ -// Test transparent PTH support. - -// RUN: %clang -no-canonical-prefixes -ccc-pch-is-pth -x c-header %s -o %t.h.pth -### 2> %t.log -// RUN: FileCheck -check-prefix CHECK1 -input-file %t.log %s - -// CHECK1: "{{.*[/\\]}}clang{{.*}}" "-cc1" {{.*}} "-o" "{{.*}}.h.pth" "-x" "c-header" "{{.*}}pth.c" - -// RUN: touch %t.h.pth -// RUN: %clang -no-canonical-prefixes -ccc-pch-is-pth -E -include %t.h %s -### 2> %t.log -// RUN: FileCheck -check-prefix CHECK2 -input-file %t.log %s - -// CHECK2: "{{.*[/\\]}}clang{{.*}}" "-cc1" {{.*}}"-include-pth" "{{.*}}.h.pth" {{.*}}"-x" "c" "{{.*}}pth.c" diff --git a/test/Driver/rewrite-legacy-objc.m b/test/Driver/rewrite-legacy-objc.m index 37b829e5e5..6461aecfe5 100644 --- a/test/Driver/rewrite-legacy-objc.m +++ b/test/Driver/rewrite-legacy-objc.m @@ -10,4 +10,4 @@ // 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" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fobjc-runtime=macosx-fragile" "-fobjc-subscripting-legacy-runtime" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" -// TEST2: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fobjc-runtime=macosx-fragile" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" +// TEST2: "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fobjc-runtime=macosx-fragile" "-fobjc-subscripting-legacy-runtime" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" diff --git a/test/Driver/sanitizer-ld.c b/test/Driver/sanitizer-ld.c index ca16932f07..9ce05996fd 100644 --- a/test/Driver/sanitizer-ld.c +++ b/test/Driver/sanitizer-ld.c @@ -588,7 +588,7 @@ // RUN: %clang -fsanitize=shadow-call-stack %s -### -o %t.o 2>&1 \ // RUN: -fsanitize=safe-stack -target x86_64-unknown-linux -fuse-ld=ld \ // RUN: | FileCheck --check-prefix=CHECK-SHADOWCALLSTACK-SAFESTACK %s -// CHECK-SHADOWCALLSTACK-SAFESTACK: error: invalid argument '-fsanitize=shadow-call-stack' not allowed with '-fsanitize=safe-stack' +// CHECK-SHADOWCALLSTACK-SAFESTACK-NOT: error: // RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \ // RUN: -target x86_64-unknown-linux -fuse-ld=ld \ diff --git a/test/Driver/split-debug.c b/test/Driver/split-debug.c index 212c12f539..0ac206395e 100644 --- a/test/Driver/split-debug.c +++ b/test/Driver/split-debug.c @@ -5,6 +5,21 @@ // // CHECK-ACTIONS: "-split-dwarf-file" "split-debug.dwo" +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-ACTIONS < %t %s +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=split -c -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-ACTIONS < %t %s + +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=single -c -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-ACTIONS-SINGLE-SPLIT < %t %s +// +// CHECK-ACTIONS-SINGLE-SPLIT: "-enable-split-dwarf=single" +// CHECK-ACTIONS-SINGLE-SPLIT: "-split-dwarf-file" "split-debug.o" + +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=single -c -### -o %tfoo.o %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-SINGLE-SPLIT-FILENAME < %t %s +// +// CHECK-SINGLE-SPLIT-FILENAME: "-split-dwarf-file" "{{.*}}foo.o" // RUN: %clang -target x86_64-macosx -gsplit-dwarf -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s diff --git a/test/Driver/split-debug.s b/test/Driver/split-debug.s index 6e6f8c5b80..ece64cc0ad 100644 --- a/test/Driver/split-debug.s +++ b/test/Driver/split-debug.s @@ -5,6 +5,13 @@ // // CHECK-ACTIONS: "-split-dwarf-file" "split-debug.dwo" +// Check we pass -split-dwarf-file to `as` if -gsplit-dwarf=split. +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=split -c -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-ACTIONS < %t %s + +// Check we do not pass any -split-dwarf* commands to `as` if -gsplit-dwarf=single. +// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf=single -c -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s // RUN: %clang -target x86_64-macosx -gsplit-dwarf -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-NO-ACTIONS < %t %s diff --git a/test/Driver/unknown-std.c b/test/Driver/unknown-std.c index 9ef70a4227..8651550651 100644 --- a/test/Driver/unknown-std.c +++ b/test/Driver/unknown-std.c @@ -14,8 +14,8 @@ // CHECK-NEXT: note: use 'gnu99' for 'ISO C 1999 with GNU extensions' standard // CHECK-NEXT: note: use 'c11' or 'iso9899:2011' for 'ISO C 2011' standard // CHECK-NEXT: note: use 'gnu11' for 'ISO C 2011 with GNU extensions' standard -// CHECK-NEXT: note: use 'c17' or 'iso9899:2017' for 'ISO C 2017' standard -// CHECK-NEXT: note: use 'gnu17' for 'ISO C 2017 with GNU extensions' standard +// CHECK-NEXT: note: use 'c17', 'iso9899:2017', 'c18', or 'iso9899:2018' for 'ISO C 2017' standard +// CHECK-NEXT: note: use 'gnu17' or 'gnu18' for 'ISO C 2017 with GNU extensions' standard // Make sure that no other output is present. // CHECK-NOT: {{^.+$}} diff --git a/test/Driver/x86-march.c b/test/Driver/x86-march.c index d0cd5b61d9..bc1194ff73 100644 --- a/test/Driver/x86-march.c +++ b/test/Driver/x86-march.c @@ -48,6 +48,10 @@ // RUN: | FileCheck %s -check-prefix=skx // skx: "-target-cpu" "skx" // +// RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=cascadelake 2>&1 \ +// RUN: | FileCheck %s -check-prefix=cascadelake +// cascadelake: "-target-cpu" "cascadelake" +// // RUN: %clang -target x86_64-unknown-unknown -c -### %s -march=knl 2>&1 \ // RUN: | FileCheck %s -check-prefix=knl // knl: "-target-cpu" "knl" |