aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7>2009-08-13 03:57:24 +0000
committergingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7>2009-08-13 03:57:24 +0000
commit755b49ce34a14ff78d6065b1627248b1b9fac06b (patch)
treedd41ff93ca47e241d6b3d44abb3658ab85c1b821
parent95691d0545514352f6f8dde4558f51ce9345f748 (diff)
downloadghdl-755b49ce34a14ff78d6065b1627248b1b9fac06b.tar.gz
ghdl-755b49ce34a14ff78d6065b1627248b1b9fac06b.tar.bz2
ghdl-755b49ce34a14ff78d6065b1627248b1b9fac06b.zip
Allow to build in 64bits mode.
-rw-r--r--ortho/mcode/binary_file-memory.adb10
-rw-r--r--ortho/mcode/binary_file.adb26
-rw-r--r--ortho/mcode/binary_file.ads8
3 files changed, 21 insertions, 23 deletions
diff --git a/ortho/mcode/binary_file-memory.adb b/ortho/mcode/binary_file-memory.adb
index 6e25f670d..4d5f74024 100644
--- a/ortho/mcode/binary_file-memory.adb
+++ b/ortho/mcode/binary_file-memory.adb
@@ -22,12 +22,13 @@ package body Binary_File.Memory is
-- Absolute section.
Sect_Abs : Section_Acc;
+ function To_Pc_Type is new Ada.Unchecked_Conversion
+ (Source => System.Address, Target => Pc_Type);
+
procedure Set_Symbol_Address (Sym : Symbol; Addr : System.Address)
is
- function Conv is new Ada.Unchecked_Conversion
- (Source => System.Address, Target => Pc_Type);
begin
- Set_Symbol_Value (Sym, Conv (Addr));
+ Set_Symbol_Value (Sym, To_Pc_Type (Addr));
Set_Scope (Sym, Sym_Global);
Set_Section (Sym, Sect_Abs);
end Set_Symbol_Address;
@@ -40,7 +41,6 @@ package body Binary_File.Memory is
procedure Write_Memory_Relocate (Error : out Boolean)
is
- use SSE;
Sect : Section_Acc;
Rel : Reloc_Acc;
N_Rel : Reloc_Acc;
@@ -58,7 +58,7 @@ package body Binary_File.Memory is
end if;
end if;
if Sect.Data_Max > 0 and Sect /= Sect_Abs then
- Sect.Vaddr := To_Integer (Sect.Data (0)'Address);
+ Sect.Vaddr := To_Pc_Type (Sect.Data (0)'Address);
end if;
Sect := Sect.Next;
end loop;
diff --git a/ortho/mcode/binary_file.adb b/ortho/mcode/binary_file.adb
index 140742416..3890b7805 100644
--- a/ortho/mcode/binary_file.adb
+++ b/ortho/mcode/binary_file.adb
@@ -15,7 +15,7 @@
-- along with GCC; see the file COPYING. If not, write to the Free
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-- 02111-1307, USA.
-with System;
+with System.Storage_Elements;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Characters.Latin_1;
with Ada.Unchecked_Conversion;
@@ -805,10 +805,10 @@ package body Binary_File is
Gen_32 (V);
end Gen_Ppc_24;
- function Get_Symbol_Vaddr (Sym : Symbol) return Unsigned_32 is
+ function Get_Symbol_Vaddr (Sym : Symbol) return Pc_Type is
begin
- return Unsigned_32 (Get_Section (Sym).Vaddr)
- + Unsigned_32 (Get_Symbol_Value (Sym));
+ return Pc_Type (Get_Section (Sym).Vaddr)
+ + Pc_Type (Get_Symbol_Value (Sym));
end Get_Symbol_Vaddr;
procedure Write_Left_Be32 (Sect : Section_Acc;
@@ -833,8 +833,7 @@ package body Binary_File is
D : Unsigned_32;
Mask : Unsigned_32;
begin
- D := Get_Symbol_Vaddr (Sym) -
- (Unsigned_32 (Sect.Vaddr) + Unsigned_32 (Addr));
+ D := Unsigned_32 (Get_Symbol_Vaddr (Sym) - (Sect.Vaddr + Addr));
-- Check overflow.
Mask := Shift_Left (1, Size + 2) - 1;
if (D and Shift_Left (1, Size + 1)) = 0 then
@@ -860,23 +859,24 @@ package body Binary_File is
case Kind is
when Reloc_32 =>
- Add_Le32 (Sect, Addr, Get_Symbol_Vaddr (Sym));
+ Add_Le32 (Sect, Addr, Unsigned_32 (Get_Symbol_Vaddr (Sym)));
when Reloc_Pc32 =>
Add_Le32 (Sect, Addr,
- Get_Symbol_Vaddr (Sym) -
- (Unsigned_32 (Sect.Vaddr) + Unsigned_32 (Addr)));
-
+ Unsigned_32 (Get_Symbol_Vaddr (Sym)
+ - (Sect.Vaddr + Addr)));
when Reloc_Disp22 =>
Set_Wdisp (Sect, Addr, Sym, 22);
when Reloc_Disp30 =>
Set_Wdisp (Sect, Addr, Sym, 30);
when Reloc_Hi22 =>
- Write_Left_Be32 (Sect, Addr, 22, Get_Symbol_Vaddr (Sym) / 1024);
+ Write_Left_Be32 (Sect, Addr, 22,
+ Unsigned_32 (Get_Symbol_Vaddr (Sym) / 1024));
when Reloc_Lo10 =>
- Write_Left_Be32 (Sect, Addr, 10, Get_Symbol_Vaddr (Sym));
+ Write_Left_Be32 (Sect, Addr, 10,
+ Unsigned_32 (Get_Symbol_Vaddr (Sym)));
when Reloc_Ua_32 =>
- Write_Be32 (Sect, Addr, Get_Symbol_Vaddr (Sym));
+ Write_Be32 (Sect, Addr, Unsigned_32 (Get_Symbol_Vaddr (Sym)));
when Reloc_Ppc_Addr24 =>
raise Program_Error;
end case;
diff --git a/ortho/mcode/binary_file.ads b/ortho/mcode/binary_file.ads
index db31cb6c3..f81292678 100644
--- a/ortho/mcode/binary_file.ads
+++ b/ortho/mcode/binary_file.ads
@@ -15,11 +15,11 @@
-- along with GCC; see the file COPYING. If not, write to the Free
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-- 02111-1307, USA.
+with System;
with Interfaces; use Interfaces;
with Ada.Unchecked_Deallocation;
with Ortho_Ident; use Ortho_Ident;
with GNAT.Table;
-with System.Storage_Elements;
with Memsegs;
package Binary_File is
@@ -73,7 +73,7 @@ package Binary_File is
function Get_Symbol (Name : String) return Symbol;
-- Get the virtual address of a symbol.
- function Get_Symbol_Vaddr (Sym : Symbol) return Unsigned_32;
+ function Get_Symbol_Vaddr (Sym : Symbol) return Pc_Type;
pragma Inline (Get_Symbol_Vaddr);
-- Set the value of a symbol.
@@ -150,8 +150,6 @@ package Binary_File is
procedure Disp_Stats;
procedure Finish;
private
- package SSE renames System.Storage_Elements;
-
type Byte_Array_Base is array (Pc_Type range <>) of Byte;
subtype Byte_Array is Byte_Array_Base (Pc_Type);
type Byte_Array_Acc is access Byte_Array;
@@ -210,7 +208,7 @@ private
-- Section number (set and used by binary writer).
Number : Natural;
-- Virtual address, if set.
- Vaddr : SSE.Integer_Address;
+ Vaddr : Pc_Type; -- SSE.Integer_Address;
-- Memory for this segment.
Seg : Memsegs.Memseg_Type;
end record;