1 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard=tls %s 2>&1 | \ 2 // RUN: FileCheck -check-prefix=CHECK-TLS %s 3 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard=global %s 2>&1 | \ 4 // RUN: FileCheck -check-prefix=CHECK-GLOBAL %s 5 // RUN: not %clang -### --target=x86_64-unknown-unknown -mstack-protector-guard=local %s 2>&1 | \ 6 // RUN: FileCheck -check-prefix=INVALID-VALUE %s 7 8 // CHECK-TLS: "-cc1" {{.*}}"-mstack-protector-guard=tls" 9 // CHECK-GLOBAL: "-cc1" {{.*}}"-mstack-protector-guard=global" 10 // INVALID-VALUE: error: invalid value 'local' in 'mstack-protector-guard=', expected one of: tls global 11 12 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard-reg=fs %s 2>&1 | \ 13 // RUN: FileCheck -check-prefix=CHECK-FS %s 14 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard-reg=gs %s 2>&1 | \ 15 // RUN: FileCheck -check-prefix=CHECK-GS %s 16 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard-symbol=sym %s 2>&1 | \ 17 // RUN: FileCheck -check-prefix=CHECK-SYM %s 18 19 // Invalid arch 20 // RUN: not %clang -target mipsel-linux-gnu -mstack-protector-guard=tls %s 2>&1 | \ 21 // RUN: FileCheck -check-prefix=INVALID-ARCH %s 22 // INVALID-ARCH: unsupported option '-mstack-protector-guard=tls' for target 23 24 // RUN: not %clang -target mipsel-linux-gnu -mstack-protector-guard-reg=fs %s 2>&1 | \ 25 // RUN: FileCheck -check-prefix=INVALID-ARCH2 %s 26 // INVALID-ARCH2: unsupported option '-mstack-protector-guard-reg=fs' for target 27 28 // RUN: not %clang -target mipsel-linux-gnu -mstack-protector-guard-offset=10 %s 2>&1 | \ 29 // RUN: FileCheck -check-prefix=INVALID-ARCH3 %s 30 // INVALID-ARCH3: unsupported option '-mstack-protector-guard-offset=10' for target 31 32 // Invalid option value 33 // RUN: not %clang -target x86_64-unknown-unknown -c -mstack-protector-guard-reg=cs %s 2>&1 | \ 34 // RUN: FileCheck -check-prefix=INVALID-REG %s 35 // RUN: not %clang -target x86_64-unknown-unknown -c -mstack-protector-guard-reg=ds %s 2>&1 | \ 36 // RUN: FileCheck -check-prefix=INVALID-REG %s 37 // RUN: not %clang -target x86_64-unknown-unknown -c -mstack-protector-guard-symbol=2s %s 2>&1 | \ 38 // RUN: FileCheck -check-prefix=INVALID-SYM %s 39 // RUN: not %clang -target x86_64-unknown-unknown -c -mstack-protector-guard-symbol= %s 2>&1 | \ 40 // RUN: FileCheck -check-prefix=INVALID-SYM %s 41 42 // CHECK-FS: "-cc1" {{.*}}"-mstack-protector-guard-reg=fs" 43 // CHECK-GS: "-cc1" {{.*}}"-mstack-protector-guard-reg=gs" 44 // INVALID-REG: error: invalid value {{.*}} in 'mstack-protector-guard-reg=', expected one of: fs gs 45 // CHECK-SYM: "-cc1" {{.*}}"-mstack-protector-guard-symbol=sym" 46 // INVALID-SYM: error: invalid argument 'mstack-protector-guard-symbol=' only allowed with 'legal symbol name' 47 48 // RUN: not %clang -target arm-eabi-c -mstack-protector-guard=tls %s 2>&1 | \ 49 // RUN: FileCheck -check-prefix=MISSING-OFFSET %s 50 // MISSING-OFFSET: error: '-mstack-protector-guard=tls' is used without '-mstack-protector-guard-offset', and there is no default 51 52 // RUN: not %clang -target arm-eabi-c -mstack-protector-guard-offset=1048576 %s 2>&1 | \ 53 // RUN: FileCheck -check-prefix=INVALID-OFFSET %s 54 // INVALID-OFFSET: invalid integral value '1048576' in 'mstack-protector-guard-offset=' 55 56 // RUN: not %clang -target arm-eabi-c -mstack-protector-guard=sysreg %s 2>&1 | \ 57 // RUN: FileCheck -check-prefix=INVALID-VALUE2 %s 58 // INVALID-VALUE2: error: invalid value 'sysreg' in 'mstack-protector-guard=', expected one of: tls global 59 60 // RUN: not %clang -target thumbv6-eabi-c -mthumb -mstack-protector-guard=tls -mstack-protector-guard-offset=0 %s 2>&1 | \ 61 // RUN: FileCheck -check-prefix=INVALID-ARCH4 %s 62 // INVALID-ARCH4: error: hardware TLS register is not supported for the thumbv6 sub-architecture 63 64 // RUN: not %clang -target thumbv7-eabi-c -mtp=soft -mstack-protector-guard=tls -mstack-protector-guard-offset=0 %s 2>&1 | \ 65 // RUN: FileCheck -check-prefix=INVALID-TP %s 66 // INVALID-TP: error: invalid argument '-mtp=soft' not allowed with '-mstack-protector-guard=tls' 67 68 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard-offset=30 %s 2>&1 | \ 69 // RUN: FileCheck -check-prefix=CHECK-OFFSET %s 70 71 // CHECK-OFFSET: "-cc1" {{.*}}"-mstack-protector-guard-offset=30" 72 73 // RUN: %clang -### -target aarch64-linux-gnu -mstack-protector-guard=sysreg \ 74 // RUN: -mstack-protector-guard-reg=sp_el0 \ 75 // RUN: -mstack-protector-guard-offset=0 %s 2>&1 | \ 76 // RUN: FileCheck -check-prefix=CHECK-AARCH64 %s 77 // RUN: not %clang -### --target=aarch64-linux-gnu \ 78 // RUN: -mstack-protector-guard=tls %s 2>&1 | \ 79 // RUN: FileCheck -check-prefix=INVALID-VALUE-AARCH64 %s 80 // RUN: not %clang -### --target=aarch64-linux-gnu -mstack-protector-guard=sysreg \ 81 // RUN: -mstack-protector-guard-reg=foo \ 82 // RUN: -mstack-protector-guard-offset=0 %s 2>&1 | \ 83 // RUN: FileCheck -check-prefix=INVALID-REG-AARCH64 %s 84 85 // CHECK-AARCH64: "-cc1" {{.*}}"-mstack-protector-guard=sysreg" "-mstack-protector-guard-offset=0" "-mstack-protector-guard-reg=sp_el0" 86 // INVALID-VALUE-AARCH64: error: invalid value 'tls' in 'mstack-protector-guard=', expected one of: sysreg global 87 // INVALID-REG-AARCH64: error: invalid value 'foo' in 'mstack-protector-guard-reg=' 88 89 // RUN: %clang -### -target riscv64-unknown-elf -mstack-protector-guard=tls -mstack-protector-guard-offset=24 -mstack-protector-guard-reg=tp %s 2>&1 | \ 90 // RUN: FileCheck -v -check-prefix=CHECK-TLS-RISCV %s 91 // RUN: %clang -### -target riscv64-unknown-elf -mstack-protector-guard=global %s 2>&1 | \ 92 // RUN: FileCheck -check-prefix=CHECK-GLOBAL %s 93 94 // CHECK-TLS-RISCV: "-cc1" {{.*}}"-mstack-protector-guard=tls" "-mstack-protector-guard-offset=24" "-mstack-protector-guard-reg=tp" 95 96 // RUN: not %clang -target riscv64-unknown-elf -mstack-protector-guard=tls %s 2>&1 | \ 97 // RUN: FileCheck -check-prefix=MISSING-OFFSET %s 98 99 // RUN: not %clang -target riscv64-unknown-elf -mstack-protector-guard=sysreg %s 2>&1 | \ 100 // RUN: FileCheck -check-prefix=INVALID-VALUE2 %s 101 102 // RUN: not %clang -target riscv64-unknown-elf -mstack-protector-guard=tls \ 103 // RUN: -mstack-protector-guard-offset=20 -mstack-protector-guard-reg=sp %s 2>&1 | \ 104 // RUN: FileCheck -check-prefix=INVALID-REG-RISCV %s 105 106 // INVALID-REG-RISCV: error: invalid value 'sp' in 'mstack-protector-guard-reg=', expected one of: tp 107 108 // RUN: %clang -### -target powerpc64-unknown-elf -mstack-protector-guard=tls -mstack-protector-guard-offset=24 -mstack-protector-guard-reg=r13 %s 2>&1 | \ 109 // RUN: FileCheck -v -check-prefix=CHECK-TLS-POWERPC64 %s 110 // RUN: %clang -### -target powerpc64-unknown-linux-gnu -mstack-protector-guard=global %s 2>&1 | \ 111 // RUN: FileCheck -check-prefix=CHECK-GLOBAL %s 112 113 // RUN: not %clang -target powerpc64-unknown-linux-gnu -mstack-protector-guard=tls %s 2>&1 | \ 114 // RUN: FileCheck -check-prefix=MISSING-OFFSET %s 115 116 // RUN: not %clang -target powerpc64-unknown-elf -mstack-protector-guard=sysreg %s 2>&1 | \ 117 // RUN: FileCheck -check-prefix=INVALID-VALUE2 %s 118 119 // RUN: not %clang -target powerpc64-unknown-elf -mstack-protector-guard=tls \ 120 // RUN: -mstack-protector-guard-offset=20 -mstack-protector-guard-reg=r12 %s 2>&1 | \ 121 // RUN: FileCheck -check-prefix=INVALID-REG-POWERPC64 %s 122 123 // CHECK-TLS-POWERPC64: "-cc1" {{.*}}"-mstack-protector-guard=tls" "-mstack-protector-guard-offset=24" "-mstack-protector-guard-reg=r13" 124 // INVALID-REG-POWERPC64: error: invalid value 'r12' in 'mstack-protector-guard-reg=', expected one of: r13 125 126 // RUN: %clang -### -target powerpc64le-unknown-elf -mstack-protector-guard=tls -mstack-protector-guard-offset=24 -mstack-protector-guard-reg=r13 %s 2>&1 | \ 127 // RUN: FileCheck -v -check-prefix=CHECK-TLS-POWERPC64 %s 128 // RUN: %clang -### -target powerpc64le-unknown-elf -mstack-protector-guard=global %s 2>&1 | \ 129 // RUN: FileCheck -check-prefix=CHECK-GLOBAL %s 130 131 // RUN: not %clang -target powerpc64le-unknown-elf -mstack-protector-guard=tls %s 2>&1 | \ 132 // RUN: FileCheck -check-prefix=MISSING-OFFSET %s 133 134 // RUN: not %clang -target powerpc64le-unknown-elf -mstack-protector-guard=sysreg %s 2>&1 | \ 135 // RUN: FileCheck -check-prefix=INVALID-VALUE2 %s 136 137 // RUN: not %clang -target powerpc64le-unknown-elf -mstack-protector-guard=tls \ 138 // RUN: -mstack-protector-guard-offset=20 -mstack-protector-guard-reg=r12 %s 2>&1 | \ 139 // RUN: FileCheck -check-prefix=INVALID-REG-POWERPC64 %s 140 141 // RUN: %clang -### -target ppc32-unknown-elf -mstack-protector-guard=tls -mstack-protector-guard-offset=24 -mstack-protector-guard-reg=r2 %s 2>&1 | \ 142 // RUN: FileCheck -v -check-prefix=CHECK-TLS-POWERPC32 %s 143 // RUN: %clang -### -target ppc32-unknown-elf -mstack-protector-guard=global %s 2>&1 | \ 144 // RUN: FileCheck -check-prefix=CHECK-GLOBAL %s 145 146 // RUN: not %clang -target ppc32-unknown-elf -mstack-protector-guard=tls %s 2>&1 | \ 147 // RUN: FileCheck -check-prefix=MISSING-OFFSET %s 148 149 // RUN: not %clang -target ppc32-unknown-elf -mstack-protector-guard=sysreg %s 2>&1 | \ 150 // RUN: FileCheck -check-prefix=INVALID-VALUE2 %s 151 152 // RUN: not %clang -target ppc32-unknown-elf -mstack-protector-guard=tls \ 153 // RUN: -mstack-protector-guard-offset=20 -mstack-protector-guard-reg=r3 %s 2>&1 | \ 154 // RUN: FileCheck -check-prefix=INVALID-REG-POWERPC32 %s 155 156 // CHECK-TLS-POWERPC32: "-cc1" {{.*}}"-mstack-protector-guard=tls" "-mstack-protector-guard-offset=24" "-mstack-protector-guard-reg=r2" 157 // INVALID-REG-POWERPC32: error: invalid value 'r3' in 'mstack-protector-guard-reg=', expected one of: r2 158