xref: /llvm-project/clang/test/Driver/arm-execute-only.c (revision 97189492a1a75d39c09b0a54982f2a028c9bd652)
1 // RUN: %clang --sysroot=%S/Inputs -c -fdriver-only -Werror --target=arm-arm-none-eabi \
2 // RUN:   -march=armv6-m -mexecute-only %s 2>&1 | count 0
3 
4 // RUN: not %clang -### -c --target=arm-arm-none-eabi -march=armv6 -mexecute-only %s 2>&1 |    \
5 // RUN:   FileCheck --check-prefix CHECK-EXECUTE-ONLY-NOT-SUPPORTED %s
6 // CHECK-EXECUTE-ONLY-NOT-SUPPORTED: error: execute only is not supported for the armv6 sub-architecture
7 
8 // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv8-m.main -mexecute-only -mno-movt %s 2>&1 \
9 // RUN:    | FileCheck %s -check-prefix CHECK-EXECUTE-ONLY-NO-MOVT
10 // CHECK-EXECUTE-ONLY-NO-MOVT: error: option '-mexecute-only' cannot be specified with '-mno-movt'
11 
12 // RUN: %clang -### --target=arm-arm-none-eabi -march=armv7-m -x assembler -mexecute-only %s -c -### 2>&1 \
13 // RUN:    | FileCheck %s --check-prefix=CHECK-NO-EXECUTE-ONLY-ASM
14 // CHECK-NO-EXECUTE-ONLY-ASM: warning: argument unused during compilation: '-mexecute-only'
15 
16 // -mpure-code flag for GCC compatibility
17 // RUN: not %clang -### -c --target=arm-arm-none-eabi -march=armv6 -mpure-code %s 2>&1 | \
18 // RUN:   FileCheck --check-prefix CHECK-EXECUTE-ONLY-NOT-SUPPORTED %s
19 
20 // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv8-m.main -mpure-code -mno-movt %s 2>&1 \
21 // RUN:    | FileCheck %s -check-prefix CHECK-PURE-CODE-NO-MOVT
22 // RUN: echo "-DABC"  > %t.cfg
23 // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv8-m.main -mpure-code -mno-movt --config %t.cfg %s 2>&1 \
24 // RUN:    | FileCheck %s -check-prefix CHECK-PURE-CODE-NO-MOVT
25 // CHECK-PURE-CODE-NO-MOVT: error: option '-mpure-code' cannot be specified with '-mno-movt'
26 
27 // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv6-m -mexecute-only -fropi %s 2>&1 \
28 // RUN:    | FileCheck %s -check-prefix CHECK-NO-EXECUTE-ROPI
29 // CHECK-NO-EXECUTE-ROPI: error: option '-mexecute-only' cannot be specified with '-fropi' for the thumbv6m sub-architecture
30 
31 // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv6-m -mexecute-only -frwpi %s 2>&1 \
32 // RUN:    | FileCheck %s -check-prefix CHECK-NO-EXECUTE-RWPI
33 // CHECK-NO-EXECUTE-RWPI: error: option '-mexecute-only' cannot be specified with '-frwpi' for the thumbv6m sub-architecture
34 
35 // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv6-m -mexecute-only -fpic %s 2>&1 \
36 // RUN:    | FileCheck %s -check-prefix CHECK-NO-EXECUTE-PIC
37 // CHECK-NO-EXECUTE-PIC: error: option '-mexecute-only' cannot be specified with '-fpic' for the thumbv6m sub-architecture
38 
39 // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv6-m -mexecute-only -fpie %s 2>&1 \
40 // RUN:    | FileCheck %s -check-prefix CHECK-NO-EXECUTE-PIE
41 // CHECK-NO-EXECUTE-PIE: error: option '-mexecute-only' cannot be specified with '-fpie' for the thumbv6m sub-architecture
42 
43 // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv6-m -mexecute-only -fPIC %s 2>&1 \
44 // RUN:    | FileCheck %s -check-prefix CHECK-NO-EXECUTE-PIC2
45 // CHECK-NO-EXECUTE-PIC2: error: option '-mexecute-only' cannot be specified with '-fPIC' for the thumbv6m sub-architecture
46 
47 // RUN: not %clang -### --target=arm-arm-none-eabi -march=armv6-m -mexecute-only -fPIE %s 2>&1 \
48 // RUN:    | FileCheck %s -check-prefix CHECK-NO-EXECUTE-PIE2
49 // CHECK-NO-EXECUTE-PIE2: error: option '-mexecute-only' cannot be specified with '-fPIE' for the thumbv6m sub-architecture
50