This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added 64-bit support for static data segments on OSX and moved the im…
…plementation from C to D
- Loading branch information
1 parent
0f1b868
commit 8d7a688
Showing
7 changed files
with
254 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,28 @@ | ||
| /** | ||
| * Copyright: Copyright Digital Mars 2010. | ||
| * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. | ||
| * Authors: Jacob Carlborg | ||
| * Version: Initial created: Feb 20, 2010 | ||
| */ | ||
|
|
||
| /* Copyright Digital Mars 2010. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE_1_0.txt or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.osx.mach.dyld; | ||
|
|
||
| version (OSX): | ||
|
|
||
| import core.sys.osx.mach.loader; | ||
|
|
||
| extern (C): | ||
|
|
||
| uint _dyld_image_count (); | ||
| mach_header* _dyld_get_image_header (uint image_index); | ||
|
|
||
|
|
||
| /** | ||
| * Copyright: Copyright Digital Mars 2010. | ||
| * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. | ||
| * Authors: Jacob Carlborg | ||
| * Version: Initial created: Feb 20, 2010 | ||
| */ | ||
|
|
||
| /* Copyright Digital Mars 2010. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE_1_0.txt or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.osx.mach.dyld; | ||
|
|
||
| version (OSX): | ||
|
|
||
| public import core.stdc.stdint; // for intptr_t | ||
| public import core.sys.osx.mach.loader; | ||
|
|
||
| extern (C): | ||
|
|
||
| uint _dyld_image_count(); | ||
| const(char)* _dyld_get_image_name(uint image_index); | ||
| mach_header* _dyld_get_image_header(uint image_index); | ||
| void _dyld_register_func_for_add_image(void function(in mach_header* mh, intptr_t vmaddr_slide)); | ||
| void _dyld_register_func_for_remove_image(void function(in mach_header* mh, intptr_t vmaddr_slide)); | ||
|
|
||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,23 @@ | ||
| /** | ||
| * Copyright: Copyright Digital Mars 2010. | ||
| * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. | ||
| * Authors: Jacob Carlborg | ||
| * Version: Initial created: Mar 16, 2010 | ||
| */ | ||
|
|
||
| /* Copyright Digital Mars 2010. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE_1_0.txt or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.osx.mach.getsect; | ||
|
|
||
| version (OSX): | ||
|
|
||
| import core.sys.osx.mach.loader; | ||
|
|
||
| extern (C): | ||
|
|
||
| section* getsectbynamefromheader (in mach_header* mhp, in char* segname, in char* sectname); | ||
| section_64* getsectbynamefromheader_64 (mach_header_64* mhp, in char* segname, in char* sectname); | ||
|
|
||
| /** | ||
| * Copyright: Copyright Digital Mars 2010. | ||
| * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. | ||
| * Authors: Jacob Carlborg | ||
| * Version: Initial created: Mar 16, 2010 | ||
| */ | ||
|
|
||
| /* Copyright Digital Mars 2010. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE_1_0.txt or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.osx.mach.getsect; | ||
|
|
||
| version (OSX): | ||
|
|
||
| public import core.sys.osx.mach.loader; | ||
|
|
||
| extern (C): | ||
|
|
||
| const(section)* getsectbynamefromheader(in mach_header* mhp, in char* segname, in char* sectname); | ||
| const(section_64)* getsectbynamefromheader_64(in mach_header_64* mhp, in char* segname, in char* sectname); | ||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,96 @@ | ||
| /** | ||
| * Copyright: Copyright Digital Mars 2010. | ||
| * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. | ||
| * Authors: Jacob Carlborg | ||
| * Version: Initial created: Feb 20, 2010 | ||
| */ | ||
|
|
||
| /* Copyright Digital Mars 2010. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE_1_0.txt or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.osx.mach.loader; | ||
|
|
||
| version (OSX): | ||
|
|
||
| struct mach_header | ||
| { | ||
| uint magic; | ||
| int cputype; | ||
| int cpusubtype; | ||
| uint filetype; | ||
| uint ncmds; | ||
| uint sizeofcmds; | ||
| uint flags; | ||
| } | ||
|
|
||
| struct mach_header_64 | ||
| { | ||
| uint magic; | ||
| int cputype; | ||
| int cpusubtype; | ||
| uint filetype; | ||
| uint ncmds; | ||
| uint sizeofcmds; | ||
| uint flags; | ||
| uint reserved; | ||
| } | ||
|
|
||
| enum : uint | ||
| { | ||
| MH_MAGIC = 0xfeedface, | ||
| MH_CIGAM = 0xcefaedfe, | ||
| MH_MAGIC_64 = 0xfeedfacf, | ||
| MH_CIGAM_64 = 0xcffaedfe, | ||
| } | ||
|
|
||
| struct section | ||
| { | ||
| char[16] sectname; | ||
| char[16] segname; | ||
| uint addr; | ||
| uint size; | ||
| uint offset; | ||
| uint align_; | ||
| uint reloff; | ||
| uint nreloc; | ||
| uint flags; | ||
| uint reserved1; | ||
| uint reserved2; | ||
| } | ||
|
|
||
| struct section_64 | ||
| { | ||
| char[16] sectname; | ||
| char[16] segname; | ||
| long addr; | ||
| long size; | ||
| uint offset; | ||
| uint align_; | ||
| uint reloff; | ||
| uint nreloc; | ||
| uint flags; | ||
| uint reserved1; | ||
| uint reserved2; | ||
| uint reserved3; | ||
| } | ||
|
|
||
| /** | ||
| * Copyright: Copyright Digital Mars 2010. | ||
| * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>. | ||
| * Authors: Jacob Carlborg | ||
| * Version: Initial created: Feb 20, 2010 | ||
| */ | ||
|
|
||
| /* Copyright Digital Mars 2010. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE_1_0.txt or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.osx.mach.loader; | ||
|
|
||
| version (OSX): | ||
|
|
||
| struct mach_header | ||
| { | ||
| uint magic; | ||
| int cputype; | ||
| int cpusubtype; | ||
| uint filetype; | ||
| uint ncmds; | ||
| uint sizeofcmds; | ||
| uint flags; | ||
| } | ||
|
|
||
| struct mach_header_64 | ||
| { | ||
| uint magic; | ||
| int cputype; | ||
| int cpusubtype; | ||
| uint filetype; | ||
| uint ncmds; | ||
| uint sizeofcmds; | ||
| uint flags; | ||
| uint reserved; | ||
| } | ||
|
|
||
| enum uint MH_MAGIC = 0xfeedface; | ||
| enum uint MH_CIGAM = 0xcefaedfe; | ||
| enum uint MH_MAGIC_64 = 0xfeedfacf; | ||
| enum uint MH_CIGAM_64 = 0xcffaedfe; | ||
|
|
||
| enum SEG_PAGEZERO = "__PAGEZERO"; | ||
| enum SEG_TEXT = "__TEXT"; | ||
| enum SECT_TEXT = "__text"; | ||
| enum SECT_FVMLIB_INIT0 = "__fvmlib_init0"; | ||
| enum SECT_FVMLIB_INIT1 = "__fvmlib_init1"; | ||
| enum SEG_DATA = "__DATA"; | ||
| enum SECT_DATA = "__data"; | ||
| enum SECT_BSS = "__bss"; | ||
| enum SECT_COMMON = "__common"; | ||
| enum SEG_OBJC = "__OBJC"; | ||
| enum SECT_OBJC_SYMBOLS = "__symbol_table"; | ||
| enum SECT_OBJC_MODULES = "__module_info"; | ||
| enum SECT_OBJC_STRINGS = "__selector_strs"; | ||
| enum SECT_OBJC_REFS = "__selector_refs"; | ||
| enum SEG_ICON = "__ICON"; | ||
| enum SECT_ICON_HEADER = "__header"; | ||
| enum SECT_ICON_TIFF = "__tiff"; | ||
| enum SEG_LINKEDIT = "__LINKEDIT"; | ||
| enum SEG_UNIXSTACK = "__UNIXSTACK"; | ||
| enum SEG_IMPORT = "__IMPORT"; | ||
|
|
||
| struct section | ||
| { | ||
| char[16] sectname; | ||
| char[16] segname; | ||
| uint addr; | ||
| uint size; | ||
| uint offset; | ||
| uint align_; | ||
| uint reloff; | ||
| uint nreloc; | ||
| uint flags; | ||
| uint reserved1; | ||
| uint reserved2; | ||
| } | ||
|
|
||
| struct section_64 | ||
| { | ||
| char[16] sectname; | ||
| char[16] segname; | ||
| ulong addr; | ||
| ulong size; | ||
| uint offset; | ||
| uint align_; | ||
| uint reloff; | ||
| uint nreloc; | ||
| uint flags; | ||
| uint reserved1; | ||
| uint reserved2; | ||
| uint reserved3; | ||
| } | ||
|
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.