authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-04-03 12:53:39+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-04-03 12:53:39+02:00
loga329450aa4107d376ebda753be8a5579dd600c69
tree5cdb727ea245f082d4e19c7b770932e4dcc04ff1
parenta31450375eaadfead340c28c32dd414160a99e65
parent72137824e5ee59798140aef1d2061adc1c8227b9
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #15160 from ziglang/link-cleanup

link: misc clean ups

4 files changed, 67 insertions(+), 79 deletions(-)

src/link/Coff.zig+6-13
...@@ -155,6 +155,7 @@ const LazySymbolTable = std.ArrayHashMapUnmanaged(...@@ -155,6 +155,7 @@ const LazySymbolTable = std.ArrayHashMapUnmanaged(
155const LazySymbolMetadata = struct {155const LazySymbolMetadata = struct {
156 atom: Atom.Index,156 atom: Atom.Index,
157 section: u16,157 section: u16,
158 alignment: u32,
158};159};
159160
160const DeclMetadata = struct {161const DeclMetadata = struct {
...@@ -621,12 +622,7 @@ fn allocateAtom(self: *Coff, atom_index: Atom.Index, new_atom_size: u32, alignme...@@ -621,12 +622,7 @@ fn allocateAtom(self: *Coff, atom_index: Atom.Index, new_atom_size: u32, alignme
621 try self.growSection(sect_id, needed_size);622 try self.growSection(sect_id, needed_size);
622 maybe_last_atom_index.* = atom_index;623 maybe_last_atom_index.* = atom_index;
623 }624 }
624625 self.getAtomPtr(atom_index).size = new_atom_size;
625 {
626 const atom_ptr = self.getAtomPtr(atom_index);
627 atom_ptr.size = new_atom_size;
628 atom_ptr.alignment = alignment;
629 }
630626
631 if (atom.prev_index) |prev_index| {627 if (atom.prev_index) |prev_index| {
632 const prev = self.getAtomPtr(prev_index);628 const prev = self.getAtomPtr(prev_index);
...@@ -739,7 +735,6 @@ pub fn createAtom(self: *Coff) !Atom.Index {...@@ -739,7 +735,6 @@ pub fn createAtom(self: *Coff) !Atom.Index {
739 .sym_index = sym_index,735 .sym_index = sym_index,
740 .file = null,736 .file = null,
741 .size = 0,737 .size = 0,
742 .alignment = 0,
743 .prev_index = null,738 .prev_index = null,
744 .next_index = null,739 .next_index = null,
745 };740 };
...@@ -751,11 +746,10 @@ fn createGotAtom(self: *Coff, target: SymbolWithLoc) !Atom.Index {...@@ -751,11 +746,10 @@ fn createGotAtom(self: *Coff, target: SymbolWithLoc) !Atom.Index {
751 const atom_index = try self.createAtom();746 const atom_index = try self.createAtom();
752 const atom = self.getAtomPtr(atom_index);747 const atom = self.getAtomPtr(atom_index);
753 atom.size = @sizeOf(u64);748 atom.size = @sizeOf(u64);
754 atom.alignment = @alignOf(u64);
755749
756 const sym = atom.getSymbolPtr(self);750 const sym = atom.getSymbolPtr(self);
757 sym.section_number = @intToEnum(coff.SectionNumber, self.got_section_index.? + 1);751 sym.section_number = @intToEnum(coff.SectionNumber, self.got_section_index.? + 1);
758 sym.value = try self.allocateAtom(atom_index, atom.size, atom.alignment);752 sym.value = try self.allocateAtom(atom_index, atom.size, @sizeOf(u64));
759753
760 log.debug("allocated GOT atom at 0x{x}", .{sym.value});754 log.debug("allocated GOT atom at 0x{x}", .{sym.value});
761755
...@@ -1116,9 +1110,8 @@ pub fn lowerUnnamedConst(self: *Coff, tv: TypedValue, decl_index: Module.Decl.In...@@ -1116,9 +1110,8 @@ pub fn lowerUnnamedConst(self: *Coff, tv: TypedValue, decl_index: Module.Decl.In
11161110
1117 const required_alignment = tv.ty.abiAlignment(self.base.options.target);1111 const required_alignment = tv.ty.abiAlignment(self.base.options.target);
1118 const atom = self.getAtomPtr(atom_index);1112 const atom = self.getAtomPtr(atom_index);
1119 atom.alignment = required_alignment;
1120 atom.size = @intCast(u32, code.len);1113 atom.size = @intCast(u32, code.len);
1121 atom.getSymbolPtr(self).value = try self.allocateAtom(atom_index, atom.size, atom.alignment);1114 atom.getSymbolPtr(self).value = try self.allocateAtom(atom_index, atom.size, required_alignment);
1122 errdefer self.freeAtom(atom_index);1115 errdefer self.freeAtom(atom_index);
11231116
1124 try unnamed_consts.append(gpa, atom_index);1117 try unnamed_consts.append(gpa, atom_index);
...@@ -1228,7 +1221,7 @@ fn updateLazySymbol(...@@ -1228,7 +1221,7 @@ fn updateLazySymbol(
1228 },1221 },
1229 };1222 };
12301223
1231 const required_alignment = atom.alignment;1224 const required_alignment = lazy_metadata.alignment;
1232 const code_len = @intCast(u32, code.len);1225 const code_len = @intCast(u32, code.len);
1233 const symbol = atom.getSymbolPtr(self);1226 const symbol = atom.getSymbolPtr(self);
1234 try self.setSymbolName(symbol, name);1227 try self.setSymbolName(symbol, name);
...@@ -1271,8 +1264,8 @@ pub fn getOrCreateAtomForLazySymbol(...@@ -1271,8 +1264,8 @@ pub fn getOrCreateAtomForLazySymbol(
1271 .code => self.text_section_index.?,1264 .code => self.text_section_index.?,
1272 .const_data => self.rdata_section_index.?,1265 .const_data => self.rdata_section_index.?,
1273 },1266 },
1267 .alignment = alignment,
1274 };1268 };
1275 self.getAtomPtr(gop.value_ptr.atom).alignment = alignment;
1276 }1269 }
1277 return gop.value_ptr.atom;1270 return gop.value_ptr.atom;
1278}1271}
src/link/Coff/Atom.zig+1-4
...@@ -19,12 +19,9 @@ sym_index: u32,...@@ -19,12 +19,9 @@ sym_index: u32,
19/// null means symbol defined by Zig source.19/// null means symbol defined by Zig source.
20file: ?u32,20file: ?u32,
2121
22/// Used size of the atom22/// Size of the atom
23size: u32,23size: u32,
2424
25/// Alignment of the atom
26alignment: u32,
27
28/// Points to the previous and next neighbors, based on the `text_offset`.25/// Points to the previous and next neighbors, based on the `text_offset`.
29/// This can be used to find, for example, the capacity of this `Atom`.26/// This can be used to find, for example, the capacity of this `Atom`.
30prev_index: ?Index,27prev_index: ?Index,
src/link/MachO.zig+60-58
...@@ -242,6 +242,7 @@ const LazySymbolTable = std.ArrayHashMapUnmanaged(...@@ -242,6 +242,7 @@ const LazySymbolTable = std.ArrayHashMapUnmanaged(
242const LazySymbolMetadata = struct {242const LazySymbolMetadata = struct {
243 atom: Atom.Index,243 atom: Atom.Index,
244 section: u8,244 section: u8,
245 alignment: u32,
245};246};
246247
247const DeclMetadata = struct {248const DeclMetadata = struct {
...@@ -1205,7 +1206,6 @@ pub fn createAtom(self: *MachO) !Atom.Index {...@@ -1205,7 +1206,6 @@ pub fn createAtom(self: *MachO) !Atom.Index {
1205 .sym_index = sym_index,1206 .sym_index = sym_index,
1206 .file = null,1207 .file = null,
1207 .size = 0,1208 .size = 0,
1208 .alignment = 0,
1209 .prev_index = null,1209 .prev_index = null,
1210 .next_index = null,1210 .next_index = null,
1211 };1211 };
...@@ -1217,7 +1217,6 @@ pub fn createGotAtom(self: *MachO, target: SymbolWithLoc) !Atom.Index {...@@ -1217,7 +1217,6 @@ pub fn createGotAtom(self: *MachO, target: SymbolWithLoc) !Atom.Index {
1217 const atom_index = try self.createAtom();1217 const atom_index = try self.createAtom();
1218 const atom = self.getAtomPtr(atom_index);1218 const atom = self.getAtomPtr(atom_index);
1219 atom.size = @sizeOf(u64);1219 atom.size = @sizeOf(u64);
1220 atom.alignment = @alignOf(u64);
12211220
1222 const sym = atom.getSymbolPtr(self);1221 const sym = atom.getSymbolPtr(self);
1223 sym.n_type = macho.N_SECT;1222 sym.n_type = macho.N_SECT;
...@@ -1259,7 +1258,6 @@ pub fn createDyldPrivateAtom(self: *MachO) !void {...@@ -1259,7 +1258,6 @@ pub fn createDyldPrivateAtom(self: *MachO) !void {
1259 const atom_index = try self.createAtom();1258 const atom_index = try self.createAtom();
1260 const atom = self.getAtomPtr(atom_index);1259 const atom = self.getAtomPtr(atom_index);
1261 atom.size = @sizeOf(u64);1260 atom.size = @sizeOf(u64);
1262 atom.alignment = @alignOf(u64);
12631261
1264 const sym = atom.getSymbolPtr(self);1262 const sym = atom.getSymbolPtr(self);
1265 sym.n_type = macho.N_SECT;1263 sym.n_type = macho.N_SECT;
...@@ -1285,7 +1283,8 @@ pub fn createStubHelperPreambleAtom(self: *MachO) !void {...@@ -1285,7 +1283,8 @@ pub fn createStubHelperPreambleAtom(self: *MachO) !void {
1285 const atom_index = try self.createAtom();1283 const atom_index = try self.createAtom();
1286 const atom = self.getAtomPtr(atom_index);1284 const atom = self.getAtomPtr(atom_index);
1287 atom.size = size;1285 atom.size = size;
1288 atom.alignment = switch (arch) {1286
1287 const required_alignment: u32 = switch (arch) {
1289 .x86_64 => 1,1288 .x86_64 => 1,
1290 .aarch64 => @alignOf(u32),1289 .aarch64 => @alignOf(u32),
1291 else => unreachable,1290 else => unreachable,
...@@ -1392,7 +1391,7 @@ pub fn createStubHelperPreambleAtom(self: *MachO) !void {...@@ -1392,7 +1391,7 @@ pub fn createStubHelperPreambleAtom(self: *MachO) !void {
1392 }1391 }
1393 self.stub_helper_preamble_atom_index = atom_index;1392 self.stub_helper_preamble_atom_index = atom_index;
13941393
1395 sym.n_value = try self.allocateAtom(atom_index, size, atom.alignment);1394 sym.n_value = try self.allocateAtom(atom_index, size, required_alignment);
1396 log.debug("allocated stub preamble atom at 0x{x}", .{sym.n_value});1395 log.debug("allocated stub preamble atom at 0x{x}", .{sym.n_value});
1397 try self.writeAtom(atom_index, code);1396 try self.writeAtom(atom_index, code);
1398}1397}
...@@ -1408,7 +1407,8 @@ pub fn createStubHelperAtom(self: *MachO) !Atom.Index {...@@ -1408,7 +1407,8 @@ pub fn createStubHelperAtom(self: *MachO) !Atom.Index {
1408 const atom_index = try self.createAtom();1407 const atom_index = try self.createAtom();
1409 const atom = self.getAtomPtr(atom_index);1408 const atom = self.getAtomPtr(atom_index);
1410 atom.size = size;1409 atom.size = size;
1411 atom.alignment = switch (arch) {1410
1411 const required_alignment: u32 = switch (arch) {
1412 .x86_64 => 1,1412 .x86_64 => 1,
1413 .aarch64 => @alignOf(u32),1413 .aarch64 => @alignOf(u32),
1414 else => unreachable,1414 else => unreachable,
...@@ -1470,7 +1470,7 @@ pub fn createStubHelperAtom(self: *MachO) !Atom.Index {...@@ -1470,7 +1470,7 @@ pub fn createStubHelperAtom(self: *MachO) !Atom.Index {
1470 else => unreachable,1470 else => unreachable,
1471 }1471 }
14721472
1473 sym.n_value = try self.allocateAtom(atom_index, size, atom.alignment);1473 sym.n_value = try self.allocateAtom(atom_index, size, required_alignment);
1474 log.debug("allocated stub helper atom at 0x{x}", .{sym.n_value});1474 log.debug("allocated stub helper atom at 0x{x}", .{sym.n_value});
1475 try self.writeAtom(atom_index, code);1475 try self.writeAtom(atom_index, code);
14761476
...@@ -1481,7 +1481,6 @@ pub fn createLazyPointerAtom(self: *MachO, stub_sym_index: u32, target: SymbolWi...@@ -1481,7 +1481,6 @@ pub fn createLazyPointerAtom(self: *MachO, stub_sym_index: u32, target: SymbolWi
1481 const atom_index = try self.createAtom();1481 const atom_index = try self.createAtom();
1482 const atom = self.getAtomPtr(atom_index);1482 const atom = self.getAtomPtr(atom_index);
1483 atom.size = @sizeOf(u64);1483 atom.size = @sizeOf(u64);
1484 atom.alignment = @alignOf(u64);
14851484
1486 const sym = atom.getSymbolPtr(self);1485 const sym = atom.getSymbolPtr(self);
1487 sym.n_type = macho.N_SECT;1486 sym.n_type = macho.N_SECT;
...@@ -1523,7 +1522,8 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !Atom.Index {...@@ -1523,7 +1522,8 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !Atom.Index {
1523 const atom_index = try self.createAtom();1522 const atom_index = try self.createAtom();
1524 const atom = self.getAtomPtr(atom_index);1523 const atom = self.getAtomPtr(atom_index);
1525 atom.size = size;1524 atom.size = size;
1526 atom.alignment = switch (arch) {1525
1526 const required_alignment: u32 = switch (arch) {
1527 .x86_64 => 1,1527 .x86_64 => 1,
1528 .aarch64 => @alignOf(u32),1528 .aarch64 => @alignOf(u32),
1529 else => unreachable, // unhandled architecture type1529 else => unreachable, // unhandled architecture type
...@@ -1587,7 +1587,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !Atom.Index {...@@ -1587,7 +1587,7 @@ pub fn createStubAtom(self: *MachO, laptr_sym_index: u32) !Atom.Index {
1587 else => unreachable,1587 else => unreachable,
1588 }1588 }
15891589
1590 sym.n_value = try self.allocateAtom(atom_index, size, atom.alignment);1590 sym.n_value = try self.allocateAtom(atom_index, size, required_alignment);
1591 log.debug("allocated stub atom at 0x{x}", .{sym.n_value});1591 log.debug("allocated stub atom at 0x{x}", .{sym.n_value});
1592 try self.writeAtom(atom_index, code);1592 try self.writeAtom(atom_index, code);
15931593
...@@ -2217,7 +2217,6 @@ pub fn lowerUnnamedConst(self: *MachO, typed_value: TypedValue, decl_index: Modu...@@ -2217,7 +2217,6 @@ pub fn lowerUnnamedConst(self: *MachO, typed_value: TypedValue, decl_index: Modu
2217 const required_alignment = typed_value.ty.abiAlignment(self.base.options.target);2217 const required_alignment = typed_value.ty.abiAlignment(self.base.options.target);
2218 const atom = self.getAtomPtr(atom_index);2218 const atom = self.getAtomPtr(atom_index);
2219 atom.size = code.len;2219 atom.size = code.len;
2220 atom.alignment = required_alignment;
2221 // TODO: work out logic for disambiguating functions from function pointers2220 // TODO: work out logic for disambiguating functions from function pointers
2222 // const sect_id = self.getDeclOutputSection(decl_index);2221 // const sect_id = self.getDeclOutputSection(decl_index);
2223 const sect_id = self.data_const_section_index.?;2222 const sect_id = self.data_const_section_index.?;
...@@ -2355,7 +2354,7 @@ fn updateLazySymbol(self: *MachO, lazy_sym: File.LazySymbol, lazy_metadata: Lazy...@@ -2355,7 +2354,7 @@ fn updateLazySymbol(self: *MachO, lazy_sym: File.LazySymbol, lazy_metadata: Lazy
2355 },2354 },
2356 };2355 };
23572356
2358 const required_alignment = atom.alignment;2357 const required_alignment = lazy_metadata.alignment;
2359 const symbol = atom.getSymbolPtr(self);2358 const symbol = atom.getSymbolPtr(self);
2360 symbol.n_strx = name_str_index;2359 symbol.n_strx = name_str_index;
2361 symbol.n_type = macho.N_SECT;2360 symbol.n_type = macho.N_SECT;
...@@ -2398,8 +2397,8 @@ pub fn getOrCreateAtomForLazySymbol(...@@ -2398,8 +2397,8 @@ pub fn getOrCreateAtomForLazySymbol(
2398 .code => self.text_section_index.?,2397 .code => self.text_section_index.?,
2399 .const_data => self.data_const_section_index.?,2398 .const_data => self.data_const_section_index.?,
2400 },2399 },
2400 .alignment = alignment,
2401 };2401 };
2402 self.getAtomPtr(gop.value_ptr.atom).alignment = alignment;
2403 }2402 }
2404 return gop.value_ptr.atom;2403 return gop.value_ptr.atom;
2405}2404}
...@@ -3054,7 +3053,51 @@ fn allocateSection(self: *MachO, segname: []const u8, sectname: []const u8, opts...@@ -3054,7 +3053,51 @@ fn allocateSection(self: *MachO, segname: []const u8, sectname: []const u8, opts
3054 return section_id;3053 return section_id;
3055}3054}
30563055
3057fn moveSectionInVirtualMemory(self: *MachO, sect_id: u8, needed_size: u64) !void {3056fn growSection(self: *MachO, sect_id: u8, needed_size: u64) !void {
3057 const header = &self.sections.items(.header)[sect_id];
3058 const segment_index = self.sections.items(.segment_index)[sect_id];
3059 const segment = &self.segments.items[segment_index];
3060 const maybe_last_atom_index = self.sections.items(.last_atom_index)[sect_id];
3061 const sect_capacity = self.allocatedSize(header.offset);
3062
3063 if (needed_size > sect_capacity) {
3064 const new_offset = self.findFreeSpace(needed_size, self.page_size);
3065 const current_size = if (maybe_last_atom_index) |last_atom_index| blk: {
3066 const last_atom = self.getAtom(last_atom_index);
3067 const sym = last_atom.getSymbol(self);
3068 break :blk (sym.n_value + last_atom.size) - segment.vmaddr;
3069 } else 0;
3070
3071 log.debug("moving {s},{s} from 0x{x} to 0x{x}", .{
3072 header.segName(),
3073 header.sectName(),
3074 header.offset,
3075 new_offset,
3076 });
3077
3078 const amt = try self.base.file.?.copyRangeAll(
3079 header.offset,
3080 self.base.file.?,
3081 new_offset,
3082 current_size,
3083 );
3084 if (amt != current_size) return error.InputOutput;
3085 header.offset = @intCast(u32, new_offset);
3086 segment.fileoff = new_offset;
3087 }
3088
3089 const sect_vm_capacity = self.allocatedVirtualSize(segment.vmaddr);
3090 if (needed_size > sect_vm_capacity) {
3091 self.markRelocsDirtyByAddress(segment.vmaddr + needed_size);
3092 try self.growSectionVirtualMemory(sect_id, needed_size);
3093 }
3094
3095 header.size = needed_size;
3096 segment.filesize = mem.alignForwardGeneric(u64, needed_size, self.page_size);
3097 segment.vmsize = mem.alignForwardGeneric(u64, needed_size, self.page_size);
3098}
3099
3100fn growSectionVirtualMemory(self: *MachO, sect_id: u8, needed_size: u64) !void {
3058 const header = &self.sections.items(.header)[sect_id];3101 const header = &self.sections.items(.header)[sect_id];
3059 const segment = self.getSegmentPtr(sect_id);3102 const segment = self.getSegmentPtr(sect_id);
3060 const increased_size = padToIdeal(needed_size);3103 const increased_size = padToIdeal(needed_size);
...@@ -3173,45 +3216,9 @@ fn allocateAtom(self: *MachO, atom_index: Atom.Index, new_atom_size: u64, alignm...@@ -3173,45 +3216,9 @@ fn allocateAtom(self: *MachO, atom_index: Atom.Index, new_atom_size: u64, alignm
3173 else3216 else
3174 true;3217 true;
3175 if (expand_section) {3218 if (expand_section) {
3176 const sect_capacity = self.allocatedSize(header.offset);
3177 const needed_size = (vaddr + new_atom_size) - segment.vmaddr;3219 const needed_size = (vaddr + new_atom_size) - segment.vmaddr;
3178 if (needed_size > sect_capacity) {3220 try self.growSection(sect_id, needed_size);
3179 const new_offset = self.findFreeSpace(needed_size, self.page_size);
3180 const current_size = if (maybe_last_atom_index.*) |last_atom_index| blk: {
3181 const last_atom = self.getAtom(last_atom_index);
3182 const sym = last_atom.getSymbol(self);
3183 break :blk (sym.n_value + last_atom.size) - segment.vmaddr;
3184 } else 0;
3185
3186 log.debug("moving {s},{s} from 0x{x} to 0x{x}", .{
3187 header.segName(),
3188 header.sectName(),
3189 header.offset,
3190 new_offset,
3191 });
3192
3193 const amt = try self.base.file.?.copyRangeAll(
3194 header.offset,
3195 self.base.file.?,
3196 new_offset,
3197 current_size,
3198 );
3199 if (amt != current_size) return error.InputOutput;
3200 header.offset = @intCast(u32, new_offset);
3201 segment.fileoff = new_offset;
3202 }
3203
3204 const sect_vm_capacity = self.allocatedVirtualSize(segment.vmaddr);
3205 if (needed_size > sect_vm_capacity) {
3206 self.markRelocsDirtyByAddress(segment.vmaddr + needed_size);
3207 try self.moveSectionInVirtualMemory(sect_id, needed_size);
3208 }
3209
3210 header.size = needed_size;
3211 segment.filesize = mem.alignForwardGeneric(u64, needed_size, self.page_size);
3212 segment.vmsize = mem.alignForwardGeneric(u64, needed_size, self.page_size);
3213 maybe_last_atom_index.* = atom_index;3221 maybe_last_atom_index.* = atom_index;
3214
3215 self.segment_table_dirty = true;3222 self.segment_table_dirty = true;
3216 }3223 }
32173224
...@@ -3219,11 +3226,7 @@ fn allocateAtom(self: *MachO, atom_index: Atom.Index, new_atom_size: u64, alignm...@@ -3219,11 +3226,7 @@ fn allocateAtom(self: *MachO, atom_index: Atom.Index, new_atom_size: u64, alignm
3219 if (header.@"align" < align_pow) {3226 if (header.@"align" < align_pow) {
3220 header.@"align" = align_pow;3227 header.@"align" = align_pow;
3221 }3228 }
3222 {3229 self.getAtomPtr(atom_index).size = new_atom_size;
3223 const atom_ptr = self.getAtomPtr(atom_index);
3224 atom_ptr.size = new_atom_size;
3225 atom_ptr.alignment = @intCast(u32, alignment);
3226 }
32273230
3228 if (atom.prev_index) |prev_index| {3231 if (atom.prev_index) |prev_index| {
3229 const prev = self.getAtomPtr(prev_index);3232 const prev = self.getAtomPtr(prev_index);
...@@ -4510,12 +4513,11 @@ pub fn logAtom(self: *MachO, atom_index: Atom.Index) void {...@@ -4510,12 +4513,11 @@ pub fn logAtom(self: *MachO, atom_index: Atom.Index) void {
4510 const atom = self.getAtom(atom_index);4513 const atom = self.getAtom(atom_index);
4511 const sym = atom.getSymbol(self);4514 const sym = atom.getSymbol(self);
4512 const sym_name = atom.getName(self);4515 const sym_name = atom.getName(self);
4513 log.debug(" ATOM(%{?d}, '{s}') @ {x} (sizeof({x}), alignof({x})) in object({?d}) in sect({d})", .{4516 log.debug(" ATOM(%{?d}, '{s}') @ {x} sizeof({x}) in object({?d}) in sect({d})", .{
4514 atom.getSymbolIndex(),4517 atom.getSymbolIndex(),
4515 sym_name,4518 sym_name,
4516 sym.n_value,4519 sym.n_value,
4517 atom.size,4520 atom.size,
4518 atom.alignment,
4519 atom.file,4521 atom.file,
4520 sym.n_sect,4522 sym.n_sect,
4521 });4523 });
src/link/MachO/Atom.zig-4
...@@ -33,10 +33,6 @@ file: ?u32,...@@ -33,10 +33,6 @@ file: ?u32,
33/// the atom since macho.nlist_64 lacks this information.33/// the atom since macho.nlist_64 lacks this information.
34size: u64,34size: u64,
3535
36/// Alignment of this atom as a power of 2.
37/// For instance, alignment of 0 should be read as 2^0 = 1 byte aligned.
38alignment: u32,
39
40/// Points to the previous and next neighbours36/// Points to the previous and next neighbours
41/// TODO use the same trick as with symbols: reserve index 0 as null atom37/// TODO use the same trick as with symbols: reserve index 0 as null atom
42next_index: ?Index,38next_index: ?Index,