authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-09-06 11:17:20+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-09-06 11:17:20+02:00
log2914ea9e3388da2bf0240b9bd6b0474f9686322c
treefa48deabdf6dc6377c5f612b4d649943db46ed86
parent5e64d9745ba54d4dd61f8f98be4a3b7e6f2d8205

macho: require atom padding for machine code only


1 files changed, 1 insertions(+), 16 deletions(-)

src/link/MachO.zig+1-16
...@@ -1632,22 +1632,7 @@ pub fn allocateAtom(self: *MachO, atom: *TextBlock, match: MatchingSection) !u64...@@ -1632,22 +1632,7 @@ pub fn allocateAtom(self: *MachO, atom: *TextBlock, match: MatchingSection) !u64
1632 const sect = &seg.sections.items[match.sect];1632 const sect = &seg.sections.items[match.sect];
16331633
1634 const sym = &self.locals.items[atom.local_sym_index];1634 const sym = &self.locals.items[atom.local_sym_index];
1635 // Padding is not required for pointer-type sections and any synthetic sections such as1635 const needs_padding = match.seg == self.text_segment_cmd_index.? and match.sect == self.text_section_index.?;
1636 // stubs or stub_helper.
1637 // TODO audit this.
1638 const needs_padding = switch (commands.sectionType(sect.*)) {
1639 macho.S_SYMBOL_STUBS,
1640 macho.S_NON_LAZY_SYMBOL_POINTERS,
1641 macho.S_LAZY_SYMBOL_POINTERS,
1642 macho.S_LITERAL_POINTERS,
1643 macho.S_THREAD_LOCAL_VARIABLES,
1644 => false,
1645 else => blk: {
1646 if (match.seg == self.text_segment_cmd_index.? and
1647 match.sect == self.stub_helper_section_index.?) break :blk false;
1648 break :blk true;
1649 },
1650 };
16511636
1652 var atom_placement: ?*TextBlock = null;1637 var atom_placement: ?*TextBlock = null;
16531638