brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · 146add2 Raw
59 lines · c
1// Check the -msign-return-address= option, which has a required argument to2// select scope.3// RUN: %clang --target=aarch64 -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=GCS-OFF --check-prefix=WARN5 6// RUN: %clang --target=aarch64 -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=GCS-OFF --check-prefix=WARN8 9// RUN: %clang --target=aarch64 -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=GCS-OFF --check-prefix=WARN11 12// -mbranch-protection with standard13// RUN: %clang --target=aarch64 -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=GCS-ON --check-prefix=WARN15 16// If the -msign-return-address and -mbranch-protection are both used, the17// right-most one controls return address signing.18// RUN: %clang --target=aarch64 -c %s -### -msign-return-address=non-leaf -mbranch-protection=none     2>&1 | \19// RUN: FileCheck %s --check-prefix=CONFLICT --check-prefix=WARN20 21// RUN: %clang --target=aarch64 -c %s -### -mbranch-protection=pac-ret -msign-return-address=none     2>&1 | \22// RUN: FileCheck %s --check-prefix=CONFLICT --check-prefix=WARN23 24// RUN: not %clang --target=aarch64 -c %s -### -msign-return-address=foo     2>&1 | \25// RUN: FileCheck %s --check-prefix=BAD-RA-PROTECTION --check-prefix=WARN26 27// RUN: not %clang --target=aarch64 -c %s -### -mbranch-protection=bar     2>&1 | \28// RUN: FileCheck %s --check-prefix=BAD-BP-PROTECTION --check-prefix=WARN29 30// RUN: %clang --target=aarch64 -### -o /dev/null -mbranch-protection=standard /dev/null 2>&1 | \31// RUN: FileCheck --allow-empty %s --check-prefix=LINKER-DRIVER32 33// WARN-NOT: warning: ignoring '-mbranch-protection=' option because the 'aarch64' architecture does not support it [-Wbranch-protection]34 35// RA-OFF: "-msign-return-address=none"36// RA-NON-LEAF: "-msign-return-address=non-leaf"37// RA-ALL: "-msign-return-address=all"38 39// KEY-A: "-msign-return-address-key=a_key"40// KEY-NOT: "-msign-return-address-key"41 42// BTE-OFF-NOT: "-mbranch-target-enforce"43// BTE-ON: "-mbranch-target-enforce"44 45// GCS-OFF-NOT: "-mguarded-control-stack"46// GCS-ON: "-mguarded-control-stack"47 48// CONFLICT: "-msign-return-address=none"49 50// BAD-RA-PROTECTION: unsupported argument 'foo' to option '-msign-return-address='51// BAD-BP-PROTECTION: unsupported argument 'bar' to option '-mbranch-protection='52 53// BAD-B-KEY-COMBINATION: unsupported argument 'b-key' to option '-mbranch-protection='54// BAD-LEAF-COMBINATION: unsupported argument 'leaf' to option '-mbranch-protection='55 56// Check that the linker driver doesn't warn about -mbranch-protection=standard57// as an unused option.58// LINKER-DRIVER-NOT: warning: argument unused during compilation: '-mbranch-protection=standard'59