1 // Check the -msign-return-address= option, which has a required argument to
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 --check-prefix=BTE-OFF --check-prefix=WARN
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 --check-prefix=WARN
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 --check-prefix=WARN
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 --check-prefix=WARN
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 --check-prefix=WARN
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 --check-prefix=WARN
24 // RUN: %clang -target aarch64--none-eabi -c %s -### -msign-return-address=foo 2>&1 | \
25 // RUN: FileCheck %s --check-prefix=BAD-RA-PROTECTION --check-prefix=WARN
27 // RUN: %clang -target aarch64--none-eabi -c %s -### -mbranch-protection=bar 2>&1 | \
28 // RUN: FileCheck %s --check-prefix=BAD-BP-PROTECTION --check-prefix=WARN
30 // RUN: %clang -target aarch64--none-eabi -### -o /dev/null -mbranch-protection=standard /dev/null 2>&1 | \
31 // RUN: FileCheck --allow-empty %s --check-prefix=LINKER-DRIVER
33 // WARN-NOT: warning: ignoring '-mbranch-protection=' option because the 'aarch64' architecture does not support it [-Wbranch-protection]
35 // RA-OFF: "-msign-return-address=none"
36 // RA-NON-LEAF: "-msign-return-address=non-leaf"
37 // RA-ALL: "-msign-return-address=all"
39 // KEY-A: "-msign-return-address-key=a_key"
40 // KEY-NOT: "-msign-return-address-key"
42 // BTE-OFF-NOT: "-mbranch-target-enforce"
43 // BTE-ON: "-mbranch-target-enforce"
45 // CONFLICT: "-msign-return-address=none"
47 // BAD-RA-PROTECTION: unsupported argument 'foo' to option '-msign-return-address='
48 // BAD-BP-PROTECTION: unsupported argument 'bar' to option '-mbranch-protection='
50 // BAD-B-KEY-COMBINATION: unsupported argument 'b-key' to option '-mbranch-protection='
51 // BAD-LEAF-COMBINATION: unsupported argument 'leaf' to option '-mbranch-protection='
53 // Check that the linker driver doesn't warn about -mbranch-protection=standard
54 // as an unused option.
55 // LINKER-DRIVER-NOT: warning: argument unused during compilation: '-mbranch-protection=standard'