aboutsummaryrefslogtreecommitdiff
path: root/lib/std/macho.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2020-09-29 18:42:50 +0200
committerJakub Konka <kubkon@jakubkonka.com>2020-10-04 15:31:47 +0200
commita927f242019f22bda95fb4a74020966ac2bdb54e (patch)
tree79662c18b6dc20b2b923cf9d507c2a698467f55a /lib/std/macho.zig
parent57a81bb5596f7487d728cf9a91013347e368912b (diff)
downloadzig-a927f242019f22bda95fb4a74020966ac2bdb54e.tar.gz
zig-a927f242019f22bda95fb4a74020966ac2bdb54e.zip
Generate more MachO exe boilerplate
* Convert draft to generate all relevant segments and sections in right places * Do not prealloc space in text blocks until we can NOP * Write out LC_LOAD_DYLINKER command * Add LC_LOAD_DYLIB command in order to specify to load libSystem * Redo update decl exports (similar to Elf globals, globals need to be contiguous in memory)
Diffstat (limited to 'lib/std/macho.zig')
-rw-r--r--lib/std/macho.zig38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/std/macho.zig b/lib/std/macho.zig
index d3296ee171..565401f342 100644
--- a/lib/std/macho.zig
+++ b/lib/std/macho.zig
@@ -1257,3 +1257,41 @@ pub const reloc_type_x86_64 = packed enum(u4) {
/// for thread local variables
X86_64_RELOC_TLV,
};
+
+/// This symbol is a reference to an external non-lazy (data) symbol.
+pub const REFERENCE_FLAG_UNDEFINED_NON_LAZY: u16 = 0x0;
+
+/// This symbol is a reference to an external lazy symbol—that is, to a function call.
+pub const REFERENCE_FLAG_UNDEFINED_LAZY: u16 = 0x1;
+
+/// This symbol is defined in this module.
+pub const REFERENCE_FLAG_DEFINED: u16 = 0x2;
+
+/// This symbol is defined in this module and is visible only to modules within this shared library.
+pub const REFERENCE_FLAG_PRIVATE_DEFINED: u16 = 3;
+
+/// This symbol is defined in another module in this file, is a non-lazy (data) symbol, and is visible
+/// only to modules within this shared library.
+pub const REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY: u16 = 4;
+
+/// This symbol is defined in another module in this file, is a lazy (function) symbol, and is visible
+/// only to modules within this shared library.
+pub const REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY: u16 = 5;
+
+/// Must be set for any defined symbol that is referenced by dynamic-loader APIs (such as dlsym and
+/// NSLookupSymbolInImage) and not ordinary undefined symbol references. The strip tool uses this bit
+/// to avoid removing symbols that must exist: If the symbol has this bit set, strip does not strip it.
+pub const REFERENCED_DYNAMICALLY: u16 = 0x10;
+
+/// Used by the dynamic linker at runtime. Do not set this bit.
+pub const N_DESC_DISCARDED: u16 = 0x20;
+
+/// Indicates that this symbol is a weak reference. If the dynamic linker cannot find a definition
+/// for this symbol, it sets the address of this symbol to 0. The static linker sets this symbol given
+/// the appropriate weak-linking flags.
+pub const N_WEAK_REF: u16 = 0x40;
+
+/// Indicates that this symbol is a weak definition. If the static linker or the dynamic linker finds
+/// another (non-weak) definition for this symbol, the weak definition is ignored. Only symbols in a
+/// coalesced section (page 23) can be marked as a weak definition.
+pub const N_WEAK_DEF: u16 = 0x80;