aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat/s-dwalin.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-07-24 15:02:25 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-08-03 14:07:36 +0200
commit5825635336fec18a26cd17cf47ccf97ed8eb2756 (patch)
treef6fcd218003a53e362b7faaa6c86d4af67871b19 /gcc/ada/libgnat/s-dwalin.adb
parent46c8c225455273ce7f7da7cc5707aed54f23e78d (diff)
downloadgcc-5825635336fec18a26cd17cf47ccf97ed8eb2756.zip
gcc-5825635336fec18a26cd17cf47ccf97ed8eb2756.tar.gz
gcc-5825635336fec18a26cd17cf47ccf97ed8eb2756.tar.bz2
ada: Adjust again address arithmetics in System.Dwarf_Lines
Using the operator of System.Storage_Elements has introduced a range check that may be tripped on, so this removes the intermediate conversion to the Storage_Count subtype that is responsible for it. gcc/ada/ * libgnat/s-dwalin.adb ("-"): New subtraction operator. (Enable_Cache): Use it to compute the offset. (Symbolic_Address): Likewise.
Diffstat (limited to 'gcc/ada/libgnat/s-dwalin.adb')
-rw-r--r--gcc/ada/libgnat/s-dwalin.adb8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/libgnat/s-dwalin.adb b/gcc/ada/libgnat/s-dwalin.adb
index d35d03a..405b5d3 100644
--- a/gcc/ada/libgnat/s-dwalin.adb
+++ b/gcc/ada/libgnat/s-dwalin.adb
@@ -46,6 +46,10 @@ package body System.Dwarf_Lines is
subtype Offset is Object_Reader.Offset;
+ function "-" (Left, Right : Address) return uint32;
+ pragma Import (Intrinsic, "-");
+ -- Return the difference between two addresses as an unsigned offset
+
function Get_Load_Displacement (C : Dwarf_Context) return Storage_Offset;
-- Return the displacement between the load address present in the binary
-- and the run-time address at which it is loaded (i.e. non-zero for PIE).
@@ -1542,7 +1546,7 @@ package body System.Dwarf_Lines is
exit when Ar_Start = Null_Address and Ar_Len = 0;
Len := uint32 (Ar_Len);
- Start := uint32 (Storage_Count'(Ar_Start - C.Low));
+ Start := uint32'(Ar_Start - C.Low);
-- Search START in the array
@@ -1762,7 +1766,7 @@ package body System.Dwarf_Lines is
if C.Cache /= null then
declare
- Off : constant uint32 := uint32 (Storage_Count'(Addr - C.Low));
+ Off : constant uint32 := uint32'(Addr - C.Low);
First, Last, Mid : Natural;
begin