aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2023-06-28 01:36:53 -0300
committerMarc Poulhiès <poulhies@adacore.com>2023-07-10 14:41:38 +0200
commit92eeb32df4f134e96265631511b6b26609aa9c12 (patch)
treee8daefccb4c5cfd3722153fe16dacb8a8166a84d
parent63ae6bc60c0f67fb2791991bf4b6e7e0a907d420 (diff)
downloadgcc-92eeb32df4f134e96265631511b6b26609aa9c12.zip
gcc-92eeb32df4f134e96265631511b6b26609aa9c12.tar.gz
gcc-92eeb32df4f134e96265631511b6b26609aa9c12.tar.bz2
ada: Add leafy mode for zero-call-used-regs
Document leafy mode. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst (Register Scrubbing): Document leafy mode. * gnat_rm.texi: Regenerate.
-rw-r--r--gcc/ada/doc/gnat_rm/security_hardening_features.rst6
-rw-r--r--gcc/ada/gnat_rm.texi8
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ada/doc/gnat_rm/security_hardening_features.rst b/gcc/ada/doc/gnat_rm/security_hardening_features.rst
index ad165cd..1432859 100644
--- a/gcc/ada/doc/gnat_rm/security_hardening_features.rst
+++ b/gcc/ada/doc/gnat_rm/security_hardening_features.rst
@@ -34,6 +34,12 @@ subprograms.
pragma Machine_Attribute (Bar, "zero_call_used_regs", "all");
-- Before returning, Bar scrubs all call-clobbered registers.
+ function Baz return Integer;
+ pragma Machine_Attribute (Bar, "zero_call_used_regs", "leafy");
+ -- Before returning, Bar scrubs call-clobbered registers, either
+ -- those it uses itself, if it can be identified as a leaf
+ -- function, or all of them otherwise.
+
For usage and more details on the command-line option, on the
``zero_call_used_regs`` attribute, and on their use with other
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index b28e6eb..817ba0b 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -19,7 +19,7 @@
@copying
@quotation
-GNAT Reference Manual , Jul 04, 2023
+GNAT Reference Manual , Jul 10, 2023
AdaCore
@@ -29191,6 +29191,12 @@ pragma Machine_Attribute (Foo, "zero_call_used_regs", "used");
function Bar return Integer;
pragma Machine_Attribute (Bar, "zero_call_used_regs", "all");
-- Before returning, Bar scrubs all call-clobbered registers.
+
+function Baz return Integer;
+pragma Machine_Attribute (Bar, "zero_call_used_regs", "leafy");
+-- Before returning, Bar scrubs call-clobbered registers, either
+-- those it uses itself, if it can be identified as a leaf
+-- function, or all of them otherwise.
@end example
For usage and more details on the command-line option, on the