aboutsummaryrefslogtreecommitdiff
path: root/src/link/MachO/Atom.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-08-26 22:05:42 +0200
committerJakub Konka <kubkon@jakubkonka.com>2023-08-29 11:39:35 +0200
commit7f74b3562deaa0dedfc2945a702fe82dbd103aa2 (patch)
tree1febb87377211d897c3d7e76baa0484985f5a769 /src/link/MachO/Atom.zig
parentef0d35e00cd1320b5f0ffde718422a69be54fe80 (diff)
downloadzig-7f74b3562deaa0dedfc2945a702fe82dbd103aa2.tar.gz
zig-7f74b3562deaa0dedfc2945a702fe82dbd103aa2.zip
macho: unify creating atoms
Diffstat (limited to 'src/link/MachO/Atom.zig')
-rw-r--r--src/link/MachO/Atom.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/link/MachO/Atom.zig b/src/link/MachO/Atom.zig
index fe118e0e3a..411c42c4dd 100644
--- a/src/link/MachO/Atom.zig
+++ b/src/link/MachO/Atom.zig
@@ -4,13 +4,13 @@
/// a stub trampoline, it can be found in the linkers `locals` arraylist.
/// If this field is 0 and file is 0, it means the codegen size = 0 and there is no symbol or
/// offset table entry.
-sym_index: u32,
+sym_index: u32 = 0,
/// 0 means an Atom is a synthetic Atom such as a GOT cell defined by the linker.
/// Otherwise, it is the index into appropriate object file (indexing from 1).
/// Prefer using `getFile()` helper to get the file index out rather than using
/// the field directly.
-file: u32,
+file: u32 = 0,
/// If this Atom is not a synthetic Atom, i.e., references a subsection in an
/// Object file, `inner_sym_index` and `inner_nsyms_trailing` tell where and if
@@ -18,22 +18,22 @@ file: u32,
/// address range. These could for example be an alias symbol which can be used
/// internally by the relocation records, or if the Object file couldn't be split
/// into subsections, this Atom may encompass an entire input section.
-inner_sym_index: u32,
-inner_nsyms_trailing: u32,
+inner_sym_index: u32 = 0,
+inner_nsyms_trailing: u32 = 0,
/// Size and alignment of this atom
/// Unlike in Elf, we need to store the size of this symbol as part of
/// the atom since macho.nlist_64 lacks this information.
-size: u64,
+size: u64 = 0,
/// Alignment of this atom as a power of 2.
/// For instance, aligmment of 0 should be read as 2^0 = 1 byte aligned.
-alignment: u32,
+alignment: u32 = 0,
/// Points to the previous and next neighbours
/// TODO use the same trick as with symbols: reserve index 0 as null atom
-next_index: ?Index,
-prev_index: ?Index,
+next_index: ?Index = null,
+prev_index: ?Index = null,
pub const Index = u32;