diff options
author | Javed Absar <javed.absar@arm.com> | 2019-05-21 14:21:26 +0000 |
---|---|---|
committer | Javed Absar <javed.absar@arm.com> | 2019-05-21 14:21:26 +0000 |
commit | 603a2bac05a8be513536c3742a6531fcf02888ed (patch) | |
tree | f9fd79a0ca466dd01b051658102092b24ea109e3 /clang/test/Preprocessor/arm-target-features.c | |
parent | e289e988378120e1a6f628f29745816b25e9c33f (diff) | |
download | bcm5719-llvm-603a2bac05a8be513536c3742a6531fcf02888ed.tar.gz bcm5719-llvm-603a2bac05a8be513536c3742a6531fcf02888ed.zip |
[ARM][CMSE] Add commandline option and feature macro
Defines macro ARM_FEATURE_CMSE to 1 for v8-M targets and introduces
-mcmse option which for v8-M targets sets ARM_FEATURE_CMSE to 3.
A diagnostic is produced when the option is given on architectures
without support for Security Extensions.
Reviewed By: dmgreen, snidertm
Differential Revision: https://reviews.llvm.org/D59879
llvm-svn: 361261
Diffstat (limited to 'clang/test/Preprocessor/arm-target-features.c')
-rw-r--r-- | clang/test/Preprocessor/arm-target-features.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/arm-target-features.c b/clang/test/Preprocessor/arm-target-features.c index 891093650e7..57b0aa9c69e 100644 --- a/clang/test/Preprocessor/arm-target-features.c +++ b/clang/test/Preprocessor/arm-target-features.c @@ -198,6 +198,7 @@ // V8M_BASELINE: #define __ARM_ARCH_ISA_THUMB 1 // V8M_BASELINE: #define __ARM_ARCH_PROFILE 'M' // V8M_BASELINE-NOT: __ARM_FEATURE_CRC32 +// V8M_BASELINE: #define __ARM_FEATURE_CMSE 1 // V8M_BASELINE-NOT: __ARM_FEATURE_DSP // V8M_BASELINE-NOT: __ARM_FP 0x{{.*}} // V8M_BASELINE-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 @@ -210,6 +211,7 @@ // V8M_MAINLINE: #define __ARM_ARCH_ISA_THUMB 2 // V8M_MAINLINE: #define __ARM_ARCH_PROFILE 'M' // V8M_MAINLINE-NOT: __ARM_FEATURE_CRC32 +// V8M_MAINLINE: #define __ARM_FEATURE_CMSE 1 // V8M_MAINLINE-NOT: __ARM_FEATURE_DSP // V8M_MAINLINE-NOT: #define __ARM_FP 0x // V8M_MAINLINE: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 @@ -675,6 +677,24 @@ // M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FP 0xe // M7-THUMB-ALLOW-FP-INSTR:#define __ARM_FPV5__ 1 +// Check that -mcmse (security extension) option works correctly for v8-M targets +// RUN: %clang -target armv8m.base-none-linux-gnu -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s +// RUN: %clang -target armv8m.main-none-linux-gnu -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s +// RUN: %clang -target arm-none-linux-gnu -mcpu=cortex-m33 -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s +// RUN: %clang -target arm -mcpu=cortex-m23 -mcmse -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=V8M_CMSE %s +// V8M_CMSE-NOT: __ARM_FEATURE_CMSE 1 +// V8M_CMSE: #define __ARM_FEATURE_CMSE 3 + +// Check that CMSE is not defined on architectures w/o support for security extension +// RUN: %clang -target arm-arm-none-gnueabi -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOTV8M_CMSE %s +// RUN: %clang -target armv8a-none-linux-gnu -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOTV8M_CMSE %s +// RUN: %clang -target armv8.1a-none-none-eabi -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=NOTV8M_CMSE %s +// NOTV8M_CMSE-NOT: __ARM_FEATURE_CMSE + +// Check that -mcmse option gives error on non v8-M targets +// RUN: not %clang -target arm-arm-none-eabi -mthumb -mcmse -mcpu=cortex-m7 -x c -E -dM %s -o - 2>&1 | FileCheck -match-full-lines --check-prefix=NOTV8MCMSE_OPT %s +// NOTV8MCMSE_OPT: error: -mcmse is not supported for cortex-m7 + // Test whether predefines are as expected when targeting v8m cores // RUN: %clang -target arm -mcpu=cortex-m23 -x c -E -dM %s -o - | FileCheck -match-full-lines --check-prefix=M23 %s // M23: #define __ARM_ARCH 8 |