PageRenderTime 13ms CodeModel.GetById 2ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/src/core/sys/osx/mach/loader.d

http://github.com/AlexeyProkhin/druntime
D | 97 lines | 77 code | 9 blank | 11 comment | 0 complexity | 51250111ec49b410a0567d632487142d MD5 | raw file
 1/**
 2 * Copyright: Copyright Digital Mars 2010.
 3 * License:   <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
 4 * Authors:   Jacob Carlborg
 5 * Version: Initial created: Feb 20, 2010
 6 */
 7
 8/*          Copyright Digital Mars 2010.
 9 * Distributed under the Boost Software License, Version 1.0.
10 *    (See accompanying file LICENSE or copy at
11 *          http://www.boost.org/LICENSE_1_0.txt)
12 */
13module core.sys.osx.mach.loader;
14
15version (OSX):
16extern (C):
17
18struct mach_header
19{
20    uint magic;
21    int  cputype;
22    int  cpusubtype;
23    uint filetype;
24    uint ncmds;
25    uint sizeofcmds;
26    uint flags;
27}
28
29struct mach_header_64
30{
31    uint magic;
32    int  cputype;
33    int  cpusubtype;
34    uint filetype;
35    uint ncmds;
36    uint sizeofcmds;
37    uint flags;
38    uint reserved;
39}
40
41enum uint MH_MAGIC      = 0xfeedface;
42enum uint MH_CIGAM      = 0xcefaedfe;
43enum uint MH_MAGIC_64   = 0xfeedfacf;
44enum uint MH_CIGAM_64   = 0xcffaedfe;
45
46enum SEG_PAGEZERO       = "__PAGEZERO";
47enum SEG_TEXT           = "__TEXT";
48enum SECT_TEXT          = "__text";
49enum SECT_FVMLIB_INIT0  = "__fvmlib_init0";
50enum SECT_FVMLIB_INIT1  = "__fvmlib_init1";
51enum SEG_DATA           = "__DATA";
52enum SECT_DATA          = "__data";
53enum SECT_BSS           = "__bss";
54enum SECT_COMMON        = "__common";
55enum SEG_OBJC           = "__OBJC";
56enum SECT_OBJC_SYMBOLS  = "__symbol_table";
57enum SECT_OBJC_MODULES  = "__module_info";
58enum SECT_OBJC_STRINGS  = "__selector_strs";
59enum SECT_OBJC_REFS     = "__selector_refs";
60enum SEG_ICON           = "__ICON";
61enum SECT_ICON_HEADER   = "__header";
62enum SECT_ICON_TIFF     = "__tiff";
63enum SEG_LINKEDIT       = "__LINKEDIT";
64enum SEG_UNIXSTACK      = "__UNIXSTACK";
65enum SEG_IMPORT         = "__IMPORT";
66
67struct section
68{
69    char[16] sectname;
70    char[16] segname;
71    uint     addr;
72    uint     size;
73    uint     offset;
74    uint     align_;
75    uint     reloff;
76    uint     nreloc;
77    uint     flags;
78    uint     reserved1;
79    uint     reserved2;
80}
81
82struct section_64
83{
84    char[16] sectname;
85    char[16] segname;
86    ulong    addr;
87    ulong    size;
88    uint     offset;
89    uint     align_;
90    uint     reloff;
91    uint     nreloc;
92    uint     flags;
93    uint     reserved1;
94    uint     reserved2;
95    uint     reserved3;
96}
97