https://gcc.gnu.org/g:2825944ff0ad6c6d164d7e27a1b0576d4274a508

commit r15-4904-g2825944ff0ad6c6d164d7e27a1b0576d4274a508
Author: Daniel King <dmk...@adacore.com>
Date:   Mon Sep 23 10:50:13 2024 +0100

    ada: Refactor exception declarations from Interfaces.CHERI to separate 
package
    
    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.

Diff:
---
 gcc/ada/libgnat/i-cheri-exceptions.ads | 50 ++++++++++++++++++++++++++++++++++
 gcc/ada/libgnat/i-cheri.ads            | 16 -----------
 2 files changed, 50 insertions(+), 16 deletions(-)

diff --git a/gcc/ada/libgnat/i-cheri-exceptions.ads 
b/gcc/ada/libgnat/i-cheri-exceptions.ads
new file mode 100644
index 000000000000..88ecb1325c4d
--- /dev/null
+++ b/gcc/ada/libgnat/i-cheri-exceptions.ads
@@ -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;
diff --git a/gcc/ada/libgnat/i-cheri.ads b/gcc/ada/libgnat/i-cheri.ads
index 389583a012f8..9fbcb885284f 100644
--- a/gcc/ada/libgnat/i-cheri.ads
+++ b/gcc/ada/libgnat/i-cheri.ads
@@ -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;

Reply via email to