From: Daniel King <dmk...@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 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 37e5c3d2888..15757057716 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 ed26e55c797..4186b6d47a9 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.
    --
-- 
2.43.0

Reply via email to