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: %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 17 // Invalid arch 18 // RUN: not %clang -target powerpc64le-linux-gnu -mstack-protector-guard=tls %s 2>&1 | \ 19 // RUN: FileCheck -check-prefix=INVALID-ARCH %s 20 // INVALID-ARCH: unsupported option '-mstack-protector-guard=tls' for target 21 22 // RUN: not %clang -target powerpc64le-linux-gnu -mstack-protector-guard-reg=fs %s 2>&1 | \ 23 // RUN: FileCheck -check-prefix=INVALID-ARCH2 %s 24 // INVALID-ARCH2: unsupported option '-mstack-protector-guard-reg=fs' for target 25 26 // RUN: not %clang -target powerpc64le-linux-gnu -mstack-protector-guard-offset=10 %s 2>&1 | \ 27 // RUN: FileCheck -check-prefix=INVALID-ARCH3 %s 28 // INVALID-ARCH3: unsupported option '-mstack-protector-guard-offset=10' for target 29 30 // Invalid option value 31 // RUN: not %clang -target x86_64-unknown-unknown -c -mstack-protector-guard-reg=cs %s 2>&1 | \ 32 // RUN: FileCheck -check-prefix=INVALID-REG %s 33 // RUN: not %clang -target x86_64-unknown-unknown -c -mstack-protector-guard-reg=ds %s 2>&1 | \ 34 // RUN: FileCheck -check-prefix=INVALID-REG %s 35 36 // CHECK-FS: "-cc1" {{.*}}"-mstack-protector-guard-reg=fs" 37 // CHECK-GS: "-cc1" {{.*}}"-mstack-protector-guard-reg=gs" 38 // INVALID-REG: error: invalid value {{.*}} in 'mstack-protector-guard-reg=', expected one of: fs gs 39 40 // RUN: not %clang -target arm-eabi-c -mstack-protector-guard=tls %s 2>&1 | \ 41 // RUN: FileCheck -check-prefix=MISSING-OFFSET %s 42 // MISSING-OFFSET: error: '-mstack-protector-guard=tls' is used without '-mstack-protector-guard-offset', and there is no default 43 44 // RUN: not %clang -target arm-eabi-c -mstack-protector-guard-offset=1048576 %s 2>&1 | \ 45 // RUN: FileCheck -check-prefix=INVALID-OFFSET %s 46 // INVALID-OFFSET: invalid integral value '1048576' in 'mstack-protector-guard-offset=' 47 48 // RUN: not %clang -target arm-eabi-c -mstack-protector-guard=sysreg %s 2>&1 | \ 49 // RUN: FileCheck -check-prefix=INVALID-VALUE2 %s 50 // INVALID-VALUE2: error: invalid value 'sysreg' in 'mstack-protector-guard=', expected one of: tls global 51 52 // RUN: not %clang -target thumbv6-eabi-c -mthumb -mstack-protector-guard=tls -mstack-protector-guard-offset=0 %s 2>&1 | \ 53 // RUN: FileCheck -check-prefix=INVALID-ARCH4 %s 54 // INVALID-ARCH4: error: hardware TLS register is not supported for the thumbv6 sub-architecture 55 56 // RUN: not %clang -target thumbv7-eabi-c -mtp=soft -mstack-protector-guard=tls -mstack-protector-guard-offset=0 %s 2>&1 | \ 57 // RUN: FileCheck -check-prefix=INVALID-TP %s 58 // INVALID-TP: error: invalid argument '-mtp=soft' not allowed with '-mstack-protector-guard=tls' 59 60 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard-offset=30 %s 2>&1 | \ 61 // RUN: FileCheck -check-prefix=CHECK-OFFSET %s 62 63 // CHECK-OFFSET: "-cc1" {{.*}}"-mstack-protector-guard-offset=30" 64 65 // RUN: %clang -### -target aarch64-linux-gnu -mstack-protector-guard=sysreg \ 66 // RUN: -mstack-protector-guard-reg=sp_el0 \ 67 // RUN: -mstack-protector-guard-offset=0 %s 2>&1 | \ 68 // RUN: FileCheck -check-prefix=CHECK-AARCH64 %s 69 // RUN: %clang -### -target aarch64-linux-gnu \ 70 // RUN: -mstack-protector-guard=tls %s 2>&1 | \ 71 // RUN: FileCheck -check-prefix=INVALID-VALUE-AARCH64 %s 72 // RUN: %clang -### -target aarch64-linux-gnu -mstack-protector-guard=sysreg \ 73 // RUN: -mstack-protector-guard-reg=foo \ 74 // RUN: -mstack-protector-guard-offset=0 %s 2>&1 | \ 75 // RUN: FileCheck -check-prefix=INVALID-REG-AARCH64 %s 76 77 // CHECK-AARCH64: "-cc1" {{.*}}"-mstack-protector-guard=sysreg" "-mstack-protector-guard-offset=0" "-mstack-protector-guard-reg=sp_el0" 78 // INVALID-VALUE-AARCH64: error: invalid value 'tls' in 'mstack-protector-guard=', expected one of: sysreg global 79 // INVALID-REG-AARCH64: error: invalid value 'foo' in 'mstack-protector-guard-reg=' 80