aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDaniel King <dmking@adacore.com>2024-09-23 10:50:13 +0100
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-11-04 16:57:56 +0100
commit2825944ff0ad6c6d164d7e27a1b0576d4274a508 (patch)
tree392d64887cbbc935a77a6e2d45a7975569a490ed /gcc
parent758a95db8a9ee0048a5de5334b59027535e2ecbc (diff)
downloadgcc-2825944ff0ad6c6d164d7e27a1b0576d4274a508.zip
gcc-2825944ff0ad6c6d164d7e27a1b0576d4274a508.tar.gz
gcc-2825944ff0ad6c6d164d7e27a1b0576d4274a508.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/libgnat/i-cheri-exceptions.ads50
-rw-r--r--gcc/ada/libgnat/i-cheri.ads16
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 0000000..88ecb13
--- /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 389583a..9fbcb88 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;