57 lines
17 KiB
HTML
Raw Permalink Normal View History

2019-09-06 15:57:44 -07:00
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `header` mod in crate `goblin`."><meta name="keywords" content="rust, rustlang, rust-lang, header"><title>goblin::mach::header - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../goblin/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Module header</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#constants">Constants</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'><a href='../../index.html'>goblin</a>::<wbr><a href='../index.html'>mach</a></p><script>window.sidebarCurrent = {name: 'header', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/goblin/mach/header.rs.html#1-443' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../../index.html'>goblin</a>::<wbr><a href='../index.html'>mach</a>::<wbr><a class="mod" href=''>header</a></span></h1><div class='docblock'><p>A header contains minimal architecture information, the binary kind, the number of load commands, as well as an endianness hint</p>
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.Header.html" title='goblin::mach::header::Header struct'>Header</a></td><td class='docblock-short'><p>Generic sized header</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Header32.html" title='goblin::mach::header::Header32 struct'>Header32</a></td><td class='docblock-short'><p>A 32-bit Mach-o header</p>
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Header64.html" title='goblin::mach::header::Header64 struct'>Header64</a></td><td class='docblock-short'><p>A 64-bit Mach-o header</p>
</td></tr></table><h2 id='constants' class='section-header'><a href="#constants">Constants</a></h2>
<table><tr class='module-item'><td><a class="constant" href="constant.MH_ALLMODSBOUND.html" title='goblin::mach::header::MH_ALLMODSBOUND constant'>MH_ALLMODSBOUND</a></td><td class='docblock-short'><p>indicates that this binary binds to all two-level namespace modules of its dependent libraries.
Only used when MH_PREBINDABLE and MH_TWOLEVEL are both set.</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_ALLOW_STACK_EXECUTION.html" title='goblin::mach::header::MH_ALLOW_STACK_EXECUTION constant'>MH_ALLOW_STACK_EXECUTION</a></td><td class='docblock-short'><p>When this bit is set, all stacks in the task will be given stack execution privilege.
Only used in MH_EXECUTE filetypes.</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_APP_EXTENSION_SAFE.html" title='goblin::mach::header::MH_APP_EXTENSION_SAFE constant'>MH_APP_EXTENSION_SAFE</a></td><td class='docblock-short'><p>The code was linked for use in an application extension.</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_BINDATLOAD.html" title='goblin::mach::header::MH_BINDATLOAD constant'>MH_BINDATLOAD</a></td><td class='docblock-short'><p>the object file's undefined references are bound by the dynamic linker when loaded.</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_BINDS_TO_WEAK.html" title='goblin::mach::header::MH_BINDS_TO_WEAK constant'>MH_BINDS_TO_WEAK</a></td><td class='docblock-short'><p>the final linked image uses weak symbols</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_BUNDLE.html" title='goblin::mach::header::MH_BUNDLE constant'>MH_BUNDLE</a></td><td class='docblock-short'><p>dynamically bound bundle file</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_CANONICAL.html" title='goblin::mach::header::MH_CANONICAL constant'>MH_CANONICAL</a></td><td class='docblock-short'><p>the binary has been canonicalized via the unprebind operation</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_CIGAM.html" title='goblin::mach::header::MH_CIGAM constant'>MH_CIGAM</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_CIGAM_64.html" title='goblin::mach::header::MH_CIGAM_64 constant'>MH_CIGAM_64</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_CORE.html" title='goblin::mach::header::MH_CORE constant'>MH_CORE</a></td><td class='docblock-short'><p>core file</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_DEAD_STRIPPABLE_DYLIB.html" title='goblin::mach::header::MH_DEAD_STRIPPABLE_DYLIB constant'>MH_DEAD_STRIPPABLE_DYLIB</a></td><td class='docblock-short'><p>Only for use on dylibs. When linking against a dylib that has this bit set, the static linker
will automatically not create a LC_LOAD_DYLIB load command to the dylib if no symbols are being
referenced from the dylib.</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_DSYM.html" title='goblin::mach::header::MH_DSYM constant'>MH_DSYM</a></td><td class='docblock-short'><p>companion file with only debug sections</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_DYLDLINK.html" title='goblin::mach::header::MH_DYLDLINK constant'>MH_DYLDLINK</a></td><td class='docblock-short'><p>the object file is input for the dynamic linker and can't be staticly link edited again</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_DYLIB.html" title='goblin::mach::header::MH_DYLIB constant'>MH_DYLIB</a></td><td class='docblock-short'><p>dynamically bound shared library</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_DYLIB_STUB.html" title='goblin::mach::header::MH_DYLIB_STUB constant'>MH_DYLIB_STUB</a></td><td class='docblock-short'><p>shared library stub for static linking only, no section contents</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_DYLINKER.html" title='goblin::mach::header::MH_DYLINKER constant'>MH_DYLINKER</a></td><td class='docblock-short'><p>dynamic link editor</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_EXECUTE.html" title='goblin::mach::header::MH_EXECUTE constant'>MH_EXECUTE</a></td><td class='docblock-short'><p>demand paged executable file</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_FORCE_FLAT.html" title='goblin::mach::header::MH_FORCE_FLAT constant'>MH_FORCE_FLAT</a></td><td class='docblock-short'><p>the executable is forcing all images to use flat name space bindings</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_FVMLIB.html" title='goblin::mach::header::MH_FVMLIB constant'>MH_FVMLIB</a></td><td class='docblock-short'><p>fixed VM shared library file</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_HAS_TLV_DESCRIPTORS.html" title='goblin::mach::header::MH_HAS_TLV_DESCRIPTORS constant'>MH_HAS_TLV_DESCRIPTORS</a></td><td class='docblock-short'><p>Contains a section of type S_THREAD_LOCAL_VARIABLES</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_INCRLINK.html" title='goblin::mach::header::MH_INCRLINK constant'>MH_INCRLINK</a></td><td class='docblock-short'><p>the object file is the output of an incremental link against a base file and can't be
link edited again</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_KEXT_BUNDLE.html" title='goblin::mach::header::MH_KEXT_BUNDLE constant'>MH_KEXT_BUNDLE</a></td><td class='docblock-short'><p>x86_64 kexts</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_LAZY_INIT.html" title='goblin::mach::header::MH_LAZY_INIT constant'>MH_LAZY_INIT</a></td><td class='docblock-short'><p>the shared library init routine is to be run lazily via catching memory faults to its writeable
segments (obsolete)</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_MAGIC.html" title='goblin::mach::header::MH_MAGIC constant'>MH_MAGIC</a></td><td class='docblock-short'><p>Mach Header magic constant</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_MAGIC_64.html" title='goblin::mach::header::MH_MAGIC_64 constant'>MH_MAGIC_64</a></td><td class='docblock-short'><p>Mach Header magic constant for 64-bit</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_NOFIXPREBINDING.html" title='goblin::mach::header::MH_NOFIXPREBINDING constant'>MH_NOFIXPREBINDING</a></td><td class='docblock-short'><p>do not have dyld notify the prebinding agent about this executable</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_NOMULTIDEFS.html" title='goblin::mach::header::MH_NOMULTIDEFS constant'>MH_NOMULTIDEFS</a></td><td class='docblock-short'><p>this umbrella guarantees no multiple defintions of symbols in its sub-images so the
two-level namespace hints can always be used.</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_NOUNDEFS.html" title='goblin::mach::header::MH_NOUNDEFS constant'>MH_NOUNDEFS</a></td><td class='docblock-short'><p>the object file has no undefined references</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_NO_HEAP_EXECUTION.html" title='goblin::mach::header::MH_NO_HEAP_EXECUTION constant'>MH_NO_HEAP_EXECUTION</a></td><td class='docblock-short'><p>When this bit is set, the OS will run the main executable with a non-executable heap even on
platforms (e.g. i386) that don't require it. Only used in MH_EXECUTE filetypes.</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_NO_REEXPORTED_DYLIBS.html" title='goblin::mach::header::MH_NO_REEXPORTED_DYLIBS constant'>MH_NO_REEXPORTED_DYLIBS</a></td><td class='docblock-short'><p>When this bit is set on a dylib, the static linker does not need to examine dependent dylibs to
see if any are re-exported</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_OBJECT.html" title='goblin::mach::header::MH_OBJECT constant'>MH_OBJECT</a></td><td class='docblock-short'><p>relocatable object file</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_PIE.html" title='goblin::mach::header::MH_PIE constant'>MH_PIE</a></td><td class='docblock-short'><p>When this bit is set, the OS will load the main executable at a random address.
Only used in MH_EXECUTE filetypes.</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_PREBINDABLE.html" title='goblin::mach::header::MH_PREBINDABLE constant'>MH_PREBINDABLE</a></td><td class='docblock-short'><p>the binary is not prebound but can have its prebinding redone. only used when MH_PREBOUND is not set.</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_PREBOUND.html" title='goblin::mach::header::MH_PREBOUND constant'>MH_PREBOUND</a></td><td class='docblock-short'><p>the file has its dynamic undefined references prebound.</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_PRELOAD.html" title='goblin::mach::header::MH_PRELOAD constant'>MH_PRELOAD</a></td><td class='docblock-short'><p>preloaded executable file</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_ROOT_SAFE.html" title='goblin::mach::header::MH_ROOT_SAFE constant'>MH_ROOT_SAFE</a></td><td class='docblock-short'><p>When this bit is set, the binary declares it is safe for use in processes with uid zero</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_SETUID_SAFE.html" title='goblin::mach::header::MH_SETUID_SAFE constant'>MH_SETUID_SAFE</a></td><td class='docblock-short'><p>When this bit is set, the binary declares it is safe for use in processes when issetugid() is true</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_SPLIT_SEGS.html" title='goblin::mach::header::MH_SPLIT_SEGS constant'>MH_SPLIT_SEGS</a></td><td class='docblock-short'><p>the file has its read-only and read-write segments split</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_SUBSECTIONS_VIA_SYMBOLS.html" title='goblin::mach::header::MH_SUBSECTIONS_VIA_SYMBOLS constant'>MH_SUBSECTIONS_VIA_SYMBOLS</a></td><td class='docblock-short'><p>safe to divide up the sections into sub-sections via symbols for dead code stripping</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_TWOLEVEL.html" title='goblin::mach::header::MH_TWOLEVEL constant'>MH_TWOLEVEL</a></td><td class='docblock-short'><p>the image is using two-level name space bindings</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.MH_WEAK_DEFINES.html" title='goblin::mach::header::MH_WEAK_DEFINES constant'>MH_WEAK_DEFINES</a></td><td class='docblock-short'><p>the final linked image contains external weak symbols</p>
</td></tr><tr class='module-item'><td><a class="constant" href="constant.SIZEOF_HEADER_32.html" title='goblin::mach::header::SIZEOF_HEADER_32 constant'>SIZEOF_HEADER_32</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="constant" href="constant.SIZEOF_HEADER_64.html" title='goblin::mach::header::SIZEOF_HEADER_64 constant'>SIZEOF_HEADER_64</a></td><td class='docblock-short'></td></tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
<table><tr class='module-item'><td><a class="fn" href="fn.filetype_to_str.html" title='goblin::mach::header::filetype_to_str fn'>filetype_to_str</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="fn" href="fn.flag_to_str.html" title='goblin::mach::header::flag_to_str fn'>flag_to_str</a></td><td class='docblock-short'></td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g., <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g., <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../../";window.currentCrate = "goblin";</script><script src="../../../aliases.js"></script><script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>