diff options
Diffstat (limited to 'ortho/mcode')
-rw-r--r-- | ortho/mcode/binary_file-memory.adb | 23 | ||||
-rw-r--r-- | ortho/mcode/binary_file-memory.ads | 3 | ||||
-rw-r--r-- | ortho/mcode/ortho_code-decls.adb | 1 |
3 files changed, 14 insertions, 13 deletions
diff --git a/ortho/mcode/binary_file-memory.adb b/ortho/mcode/binary_file-memory.adb index c094e05..6e25f67 100644 --- a/ortho/mcode/binary_file-memory.adb +++ b/ortho/mcode/binary_file-memory.adb @@ -32,10 +32,18 @@ package body Binary_File.Memory is Set_Section (Sym, Sect_Abs); end Set_Symbol_Address; - procedure Write_Memory_Init + procedure Write_Memory_Init is + begin + Create_Section (Sect_Abs, "*ABS*", Section_Exec); + Sect_Abs.Vaddr := 0; + end Write_Memory_Init; + + procedure Write_Memory_Relocate (Error : out Boolean) is use SSE; Sect : Section_Acc; + Rel : Reloc_Acc; + N_Rel : Reloc_Acc; begin -- Relocate section in memory. Sect := Section_Chain; @@ -49,23 +57,12 @@ package body Binary_File.Memory is --Sect.Data := new Byte_Array (1 .. 0); end if; end if; - if Sect.Data_Max > 0 then + if Sect.Data_Max > 0 and Sect /= Sect_Abs then Sect.Vaddr := To_Integer (Sect.Data (0)'Address); end if; Sect := Sect.Next; end loop; - Create_Section (Sect_Abs, "*ABS*", Section_Exec); - Sect_Abs.Vaddr := 0; - end Write_Memory_Init; - - procedure Write_Memory_Relocate (Error : out Boolean) - is - use SSE; - Sect : Section_Acc; - Rel : Reloc_Acc; - N_Rel : Reloc_Acc; - begin -- Do all relocations. Sect := Section_Chain; Error := False; diff --git a/ortho/mcode/binary_file-memory.ads b/ortho/mcode/binary_file-memory.ads index 5238fa0..a205da5 100644 --- a/ortho/mcode/binary_file-memory.ads +++ b/ortho/mcode/binary_file-memory.ads @@ -16,7 +16,10 @@ -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. package Binary_File.Memory is + + -- Must be called before set_symbol_address. procedure Write_Memory_Init; procedure Set_Symbol_Address (Sym : Symbol; Addr : System.Address); + procedure Write_Memory_Relocate (Error : out Boolean); end Binary_File.Memory; diff --git a/ortho/mcode/ortho_code-decls.adb b/ortho/mcode/ortho_code-decls.adb index 44a2595..0a8b02c 100644 --- a/ortho/mcode/ortho_code-decls.adb +++ b/ortho/mcode/ortho_code-decls.adb @@ -322,6 +322,7 @@ package body Ortho_Code.Decls is procedure New_Const_Value (Cst : O_Dnode; Val : O_Cnode) is begin if Dnodes.Table (Cst).Info2 /= 0 then + -- Value was already set. raise Syntax_Error; end if; Dnodes.Table (Cst).Info2 := Int32 (Val); |