1 /**
2  * Copyright: Copyright (c) 2010 Jacob Carlborg. All rights reserved.
3  * Authors: Jacob Carlborg
4  * Version: Initial created: Feb 20, 2010
5  * License: BSD style: $(LICENSE)
6  */
7 module rt.compiler.dmd.darwin.loader;
8 
9 version (darwin):
10 
11 struct mach_header
12 {
13 	uint magic;
14 	int cputype;
15 	int cpusubtype;
16 	uint filetype;
17 	uint ncmds;
18 	uint sizeofcmds;
19 	uint flags;
20 }
21 
22 struct mach_header_64
23 {
24 	uint magic;
25 	int cputype;
26 	int cpusubtype;
27 	uint filetype;
28 	uint ncmds;
29 	uint sizeofcmds;
30 	uint flags;
31 	uint reserved;
32 }
33 
34 enum : uint
35 {
36 	MH_MAGIC = 0xfeedface,
37 	MH_CIGAM = 0xcefaedfe,
38 	MH_MAGIC_64 = 0xfeedfacf,
39 	MH_CIGAM_64 = 0xcffaedfe,
40 }
41 
42 struct section
43 {
44 	char[16] sectname;
45 	char[16] segname;
46 	uint addr;
47 	uint size;
48 	uint offset;
49 	uint align_;
50 	uint reloff;
51 	uint nreloc;
52 	uint flags;
53 	uint reserved1;
54 	uint reserved2;
55 }
56 
57 struct section_64
58 {
59 	char[16] sectname;
60 	char[16] segname;
61 	long addr;
62 	long size;
63 	uint offset;
64 	uint align_;
65 	uint reloff;
66 	uint nreloc;
67 	uint flags;
68 	uint reserved1;
69 	uint reserved2;
70 	uint reserved3;
71 }