1 // Check the -msign-return-address= option, which has a required argument to 2 // select scope. 3 // RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=none 2>&1 | \ 4 // RUN: FileCheck %s --check-prefix=RA-OFF --check-prefix=KEY-A --check-prefix=BTE-OFF 5 6 // RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=non-leaf 2>&1 | \ 7 // RUN: FileCheck %s --check-prefix=RA-NON-LEAF --check-prefix=KEY-A --check-prefix=BTE-OFF 8 9 // RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=all 2>&1 | \ 10 // RUN: FileCheck %s --check-prefix=RA-ALL --check-prefix=KEY-A --check-prefix=BTE-OFF 11 12 // -mbranch-protection with standard 13 // RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=standard 2>&1 | \ 14 // RUN: FileCheck %s --check-prefix=RA-NON-LEAF --check-prefix=KEY-A --check-prefix=BTE-ON 15 16 // If the -msign-return-address and -mbranch-protection are both used, the 17 // right-most one controls return address signing. 18 // RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=non-leaf -mbranch-protection=none 2>&1 | \ 19 // RUN: FileCheck %s --check-prefix=CONFLICT 20 21 // RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=pac-ret -msign-return-address=none 2>&1 | \ 22 // RUN: FileCheck %s --check-prefix=CONFLICT 23 24 // RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=foo 2>&1 | \ 25 // RUN: FileCheck %s --check-prefix=BAD-RA-PROTECTION 26 27 // RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=bar 2>&1 | \ 28 // RUN: FileCheck %s --check-prefix=BAD-BP-PROTECTION 29 30 // RA-OFF: "-msign-return-address=none" 31 // RA-NON-LEAF: "-msign-return-address=non-leaf" 32 // RA-ALL: "-msign-return-address=all" 33 34 // KEY-A: "-msign-return-address-key=a_key" 35 36 // BTE-OFF-NOT: "-mbranch-target-enforce" 37 // BTE-ON: "-mbranch-target-enforce" 38 39 // CONFLICT: "-msign-return-address=none" 40 41 // BAD-RA-PROTECTION: invalid branch protection option 'foo' in '-msign-return-address={{.*}}' 42 // BAD-BP-PROTECTION: invalid branch protection option 'bar' in '-mbranch-protection={{.*}}' 43 44 // BAD-B-KEY-COMBINATION: invalid branch protection option 'b-key' in '-mbranch-protection={{.*}}' 45 // BAD-LEAF-COMBINATION: invalid branch protection option 'leaf' in '-mbranch-protection={{.*}}' 46