https://gcc.gnu.org/g:9f106c7dfafb89c17f65d2128d738cf7d9962307

commit r16-1303-g9f106c7dfafb89c17f65d2128d738cf7d9962307
Author: Daniel King <dmk...@adacore.com>
Date:   Thu Feb 27 14:11:16 2025 +0000

    ada: Fix bindings for CHERI Set_Bounds and Set_Exact_Bounds intrinsics.
    
    gcc/ada/ChangeLog:
    
            * libgnat/i-cheri.ads
            (Set_Bounds, Set_Exact_Bounds): Remove wrong intrinsic binding.
            * libgnat/i-cheri.adb
            (Set_Bounds, Set_Exact_Bounds): New subprogram bodies.

Diff:
---
 gcc/ada/libgnat/i-cheri.adb | 24 ++++++++++++++++++++++++
 gcc/ada/libgnat/i-cheri.ads |  6 ++----
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/libgnat/i-cheri.adb b/gcc/ada/libgnat/i-cheri.adb
index 37e5c3d28889..157570577168 100644
--- a/gcc/ada/libgnat/i-cheri.adb
+++ b/gcc/ada/libgnat/i-cheri.adb
@@ -31,6 +31,30 @@
 
 package body Interfaces.CHERI is
 
+   ----------------
+   -- Set_Bounds --
+   ----------------
+
+   procedure Set_Bounds
+     (Cap    : in out Capability;
+      Length :        Bounds_Length)
+   is
+   begin
+      Cap := Capability_With_Bounds (Cap, Length);
+   end Set_Bounds;
+
+   ----------------------
+   -- Set_Exact_Bounds --
+   ----------------------
+
+   procedure Set_Exact_Bounds
+     (Cap    : in out Capability;
+      Length :        Bounds_Length)
+   is
+   begin
+      Cap := Capability_With_Exact_Bounds (Cap, Length);
+   end Set_Exact_Bounds;
+
    ----------------------------
    -- Set_Address_And_Bounds --
    ----------------------------
diff --git a/gcc/ada/libgnat/i-cheri.ads b/gcc/ada/libgnat/i-cheri.ads
index ed26e55c7972..4186b6d47a9a 100644
--- a/gcc/ada/libgnat/i-cheri.ads
+++ b/gcc/ada/libgnat/i-cheri.ads
@@ -273,8 +273,7 @@ is
      (Cap    : in out Capability;
       Length :        Bounds_Length)
    with
-     Import, Convention => Intrinsic,
-     External_Name => "__builtin_cheri_bounds_set";
+     Inline;
    --  Narrow the bounds of a capability so that the lower bound is the
    --  current address and the upper bound is suitable for the Length.
    --
@@ -287,8 +286,7 @@ is
      (Cap    : in out Capability;
       Length :        Bounds_Length)
    with
-     Import, Convention => Intrinsic,
-     External_Name => "__builtin_cheri_bounds_set_exact";
+     Inline;
    --  Narrow the bounds of a capability so that the lower bound is the
    --  current address and the upper bound is suitable for the Length.
    --

Reply via email to