]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Refactor exception declarations from Interfaces.CHERI to separate package
authorDaniel King <dmking@adacore.com>
Mon, 23 Sep 2024 09:50:13 +0000 (10:50 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 4 Nov 2024 15:57:56 +0000 (16:57 +0100)
Exception declarations require elaboration on the full run-time to
register the exceptions. The package Interfaces.CHERI, however, is
used on bare-metal targets during early initialization, before
elaboration and is therefore marked No_Elaboration_Code_All.
Refactoring the exception declarations to a separate package allows
the common CHERI bindings to be used in such contexts.

gcc/ada/ChangeLog:

* libgnat/i-cheri.ads: Remove exception declarations.
* libgnat/i-cheri-exceptions.ads: New file.

gcc/ada/libgnat/i-cheri-exceptions.ads [new file with mode: 0644]
gcc/ada/libgnat/i-cheri.ads

diff --git a/gcc/ada/libgnat/i-cheri-exceptions.ads b/gcc/ada/libgnat/i-cheri-exceptions.ads
new file mode 100644 (file)
index 0000000..88ecb13
--- /dev/null
@@ -0,0 +1,50 @@
+------------------------------------------------------------------------------
+--                                                                          --
+--                         GNAT COMPILER COMPONENTS                         --
+--                                                                          --
+--            I N T E R F A C E S . C H E R I . E X C E P T I O N S         --
+--                                                                          --
+--                                  S p e c                                 --
+--                                                                          --
+--                        Copyright (C) 2024, AdaCore                       --
+--                                                                          --
+-- GNAT is free software;  you can  redistribute it  and/or modify it under --
+-- terms of the  GNU General Public License as published  by the Free Soft- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
+-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
+--                                                                          --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
+--                                                                          --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
+--                                                                          --
+------------------------------------------------------------------------------
+
+--  This package defines exception types for CHERI-related errors
+
+package Interfaces.CHERI.Exceptions with
+  Preelaborate
+is
+
+   Capability_Bound_Error : exception;
+   --  An out-of-bounds access was attempted
+
+   Capability_Permission_Error : exception;
+   --  An attempted access exceeded the permissions granted by a capability
+
+   Capability_Sealed_Error : exception;
+   --  A sealed capability was dereferenced
+
+   Capability_Tag_Error : exception;
+   --  An invalid capability was dereferenced
+
+end Interfaces.CHERI.Exceptions;
index 389583a012f836f88c63e8a310bfa49392f0f738..9fbcb885284f6d4fed55490ff999e1cae6a25908 100644 (file)
@@ -467,20 +467,4 @@ is
      External_Name => "__builtin_cheri_stack_get";
    --  Get the Capability Stack Pointer (CSP)
 
-   ---------------------------
-   -- Capability Exceptions --
-   ---------------------------
-
-   Capability_Bound_Error : exception;
-   --  An out-of-bounds access was attempted
-
-   Capability_Permission_Error : exception;
-   --  An attempted access exceeded the permissions granted by a capability
-
-   Capability_Sealed_Error : exception;
-   --  A sealed capability was dereferenced
-
-   Capability_Tag_Error : exception;
-   --  An invalid capability was dereferenced
-
 end Interfaces.CHERI;