aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho/mcode/macho.ads
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2016-01-05 06:44:53 +0100
committerTristan Gingold <gingold@adacore.com>2016-01-06 18:38:37 +0100
commitb5797a5cef6d25817da7998f6263afa53e196d25 (patch)
treead3b67a93d16e8a06fab2d7a8c4d8993ff101b8a /src/ortho/mcode/macho.ads
parent955e964b024de556c4c0db8fd745c6abdb8052fe (diff)
downloadghdl-b5797a5cef6d25817da7998f6263afa53e196d25.tar.gz
ghdl-b5797a5cef6d25817da7998f6263afa53e196d25.tar.bz2
ghdl-b5797a5cef6d25817da7998f6263afa53e196d25.zip
mcode: add support for x86-64
Diffstat (limited to 'src/ortho/mcode/macho.ads')
-rw-r--r--src/ortho/mcode/macho.ads58
1 files changed, 57 insertions, 1 deletions
diff --git a/src/ortho/mcode/macho.ads b/src/ortho/mcode/macho.ads
index e080a430f..d4630d3f5 100644
--- a/src/ortho/mcode/macho.ads
+++ b/src/ortho/mcode/macho.ads
@@ -29,11 +29,26 @@ package Macho is
Flags : Unsigned_32;
end record;
+ type Header_64 is record
+ Magic : Unsigned_32;
+ Cputype : Unsigned_32;
+ Cpusubtype : Unsigned_32;
+ Filetype : Unsigned_32;
+ Ncmds : Unsigned_32;
+ Sizeofcmds : Unsigned_32;
+ Flags : Unsigned_32;
+ Reserved : Unsigned_32;
+ end record;
+
-- Size of Filehdr.
Header_32_Size : constant Natural := Header_32'Size / Storage_Unit;
+ Header_64_Size : constant Natural := Header_64'Size / Storage_Unit;
-- Magic numbers.
- Magic : constant Unsigned_32 := 16#feed_face#;
+ Magic_32 : constant Unsigned_32 := 16#feed_face#;
+ Magic_64 : constant Unsigned_32 := 16#feed_facf#;
+
+ Cpu_Arch_64 : constant Unsigned_32 := 16#0100_0000#;
Cputype_I386 : constant Unsigned_32 := 7;
Cpusubtype_I386_All : constant Unsigned_32 := 3;
@@ -77,6 +92,37 @@ package Macho is
end record;
Section_32_Size : constant Natural := Section_32'Size / Storage_Unit;
+ Lc_Segment_64 : constant Unsigned_32 := 16#19#;
+ type Segment_Command_64 is record
+ Segname : String (1 .. 16);
+ Vmaddr : Unsigned_64;
+ Vmsize : Unsigned_64;
+ Fileoff : Unsigned_64;
+ Filesize : Unsigned_64;
+ Maxprot : Unsigned_32;
+ Initprot : Unsigned_32;
+ Nsects : Unsigned_32;
+ Flags : Unsigned_32;
+ end record;
+ Segment_Command_64_Size : constant Natural :=
+ Segment_Command_64'Size / Storage_Unit;
+
+ type Section_64 is record
+ Sectname : String (1 .. 16);
+ Segname : String (1 .. 16);
+ Addr : Unsigned_64;
+ Size : Unsigned_64;
+ Offset : Unsigned_32;
+ Align : Unsigned_32;
+ Reloff : Unsigned_32;
+ Nreloc : Unsigned_32;
+ Flags : Unsigned_32;
+ Reserved1 : Unsigned_32;
+ Reserved2 : Unsigned_32;
+ Reserved3 : Unsigned_32;
+ end record;
+ Section_64_Size : constant Natural := Section_64'Size / Storage_Unit;
+
Lc_Symtab : constant Unsigned_32 := 2;
type Symtab_Command is record
Symoff : Unsigned_32;
@@ -97,6 +143,16 @@ package Macho is
Nlist_32_Size : constant Natural := Nlist_32'Size / Storage_Unit;
+ type Nlist_64 is record
+ N_Strx : Unsigned_32;
+ N_Type : Unsigned_8;
+ N_Sect : Unsigned_8;
+ N_Desc : Unsigned_16;
+ N_Value : Unsigned_64;
+ end record;
+
+ Nlist_64_Size : constant Natural := Nlist_64'Size / Storage_Unit;
+
N_Undf : constant Unsigned_8 := 16#00#;
N_Ext : constant Unsigned_8 := 16#01#;
N_Sect : constant Unsigned_8 := 16#0e#;