]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Add missing ACLE support for PAC-RET
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 2 Jul 2020 15:11:04 +0000 (16:11 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 16 Jul 2020 13:05:04 +0000 (14:05 +0100)
Define the __ARM_FEATURE_PAC_DEFAULT feature test
macro when PAC-RET branch protection is enabled.

2020-07-13  Szabolcs Nagy  <szabolcs.nagy@arm.com>

gcc/ChangeLog:

* config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Add
__ARM_FEATURE_PAC_DEFAULT support.

(cherry picked from commit a1faa8e2470b33e92f6274804bf7941fbb6e2d38)

gcc/config/aarch64/aarch64-c.c

index 6d5acb02fc6c0bdecde8561121d9469e85802d9b..f22ad437548475b8999357c52dda28b2e83685e3 100644 (file)
@@ -156,6 +156,18 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)
   aarch64_def_or_undef (TARGET_SM4, "__ARM_FEATURE_SM4", pfile);
   aarch64_def_or_undef (TARGET_F16FML, "__ARM_FEATURE_FP16_FML", pfile);
 
+  aarch64_def_or_undef (aarch64_bti_enabled (),
+                       "__ARM_FEATURE_BTI_DEFAULT", pfile);
+
+  cpp_undef (pfile, "__ARM_FEATURE_PAC_DEFAULT");
+  if (aarch64_ra_sign_scope != AARCH64_FUNCTION_NONE)
+    {
+      int v = 1;
+      if (aarch64_ra_sign_scope == AARCH64_FUNCTION_ALL)
+       v |= 4;
+      builtin_define_with_int_value ("__ARM_FEATURE_PAC_DEFAULT", v);
+    }
+
   /* Not for ACLE, but required to keep "float.h" correct if we switch
      target between implementations that do or do not support ARMv8.2-A
      16-bit floating-point extensions.  */