]> git.ipfire.org Git - people/ms/gcc.git/commitdiff
[PATCH 4/15] arm: Add testsuite library support for PACBTI target
authorAndrea Corallo <andrea.corallo@arm.com>
Mon, 6 Dec 2021 10:39:35 +0000 (11:39 +0100)
committerAndrea Corallo <andrea.corallo@arm.com>
Mon, 23 Jan 2023 10:25:47 +0000 (11:25 +0100)
Add targeting-checking entities for PACBTI in testsuite
framework.

Pre-approved with the requested changes here
<https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586331.html>.

gcc/testsuite/ChangeLog

* lib/target-supports.exp:
(check_effective_target_arm_pacbti_hw): New.

gcc/ChangeLog:
* doc/sourcebuild.texi: Document arm_pacbti_hw.

Co-Authored-By: Tejas Belagod <tbelagod@arm.com>
gcc/doc/sourcebuild.texi
gcc/testsuite/lib/target-supports.exp

index e605707a61caad9295b0102f193d0fd8b5e4619a..be4318221cc70fcf0a8159efc865802f6d1ee0bd 100644 (file)
@@ -2195,6 +2195,10 @@ ARM target supports options to generate instructions from ARMv8.1-M with
 the Custom Datapath Extension (CDE) and M-Profile Vector Extension (MVE).
 Some multilibs may be incompatible with these options.
 
+@item arm_pacbti_hw
+Test system supports executing Pointer Authentication and Branch Target
+Identification instructions.
+
 @item arm_prefer_ldrd_strd
 ARM target prefers @code{LDRD} and @code{STRD} instructions over
 @code{LDM} and @code{STM} instructions.
@@ -2284,6 +2288,12 @@ ARM target generates Thumb-2 code for @code{-mthumb} but does not
 support executing the Armv8.1-M Mainline Low Overhead Loop
 instructions @code{DLS} and @code{LE}.
 
+@item mbranch_protection_ok
+ARM target supporting @code{-mbranch-protection=standard}.
+
+@item arm_pacbti_hw
+Test system supports for executing non nop pacbti instructions.
+
 @end table
 
 @subsubsection AArch64-specific attributes
index 38b9514511758eea8c9f54265b07af96bdfc8a08..a9ee288dab5b732e58962ffac2228f8299f2a066 100644 (file)
@@ -5218,6 +5218,22 @@ proc check_effective_target_arm_cmse_clear_ok {} {
     } "-mcmse"];
 }
 
+# Return 1 if the target supports executing PACBTI instructions, 0
+# otherwise.
+
+proc check_effective_target_arm_pacbti_hw {} {
+    return [check_runtime arm_pacbti_hw_available {
+       __attribute__ ((naked)) int
+       main (void)
+       {
+         asm ("pac r12, lr, sp");
+         asm ("mov r0, #0");
+         asm ("autg r12, lr, sp");
+         asm ("bx lr");
+       }
+    } "-march=armv8.1-m.main+pacbti+fp -mbranch-protection=standard -mthumb -mfloat-abi=hard"]
+}
+
 # Return 1 if this compilation turns on string_ops_prefer_neon on.
 
 proc check_effective_target_arm_tune_string_ops_prefer_neon { } {