| ... | @@ -402,8 +402,7 @@ fn calcSectionSizes(macho_file: *MachO) !void { | ... | @@ -402,8 +402,7 @@ fn calcSectionSizes(macho_file: *MachO) !void { |
| 402 | const atom = macho_file.getAtom(atom_index) orelse continue; | 402 | const atom = macho_file.getAtom(atom_index) orelse continue; |
| 403 | if (!atom.flags.alive) continue; | 403 | if (!atom.flags.alive) continue; |
| 404 | const header = &macho_file.sections.items(.header)[atom.out_n_sect]; | 404 | const header = &macho_file.sections.items(.header)[atom.out_n_sect]; |
| 405 | if (!macho_file.isZigSection(atom.out_n_sect)) continue; | 405 | if (!macho_file.isZigSection(atom.out_n_sect) and !macho_file.isDebugSection(atom.out_n_sect)) continue; |
| 406 | if (!macho_file.isDebugSection(atom.out_n_sect)) continue; | | |
| 407 | header.nreloc += atom.calcNumRelocs(macho_file); | 406 | header.nreloc += atom.calcNumRelocs(macho_file); |
| 408 | } | 407 | } |
| 409 | } | 408 | } |
| ... | @@ -542,8 +541,7 @@ fn writeAtoms(macho_file: *MachO) !void { | ... | @@ -542,8 +541,7 @@ fn writeAtoms(macho_file: *MachO) !void { |
| 542 | for (slice.items(.header), slice.items(.atoms), 0..) |header, atoms, i| { | 541 | for (slice.items(.header), slice.items(.atoms), 0..) |header, atoms, i| { |
| 543 | if (atoms.items.len == 0) continue; | 542 | if (atoms.items.len == 0) continue; |
| 544 | if (header.isZerofill()) continue; | 543 | if (header.isZerofill()) continue; |
| 545 | if (macho_file.isZigSection(@intCast(i))) continue; | 544 | if (macho_file.isZigSection(@intCast(i)) or macho_file.isDebugSection(@intCast(i))) continue; |
| 546 | if (macho_file.isDebugSection(@intCast(i))) continue; | | |
| 547 | | 545 | |
| 548 | const size = math.cast(usize, header.size) orelse return error.Overflow; | 546 | const size = math.cast(usize, header.size) orelse return error.Overflow; |
| 549 | const code = try gpa.alloc(u8, size); | 547 | const code = try gpa.alloc(u8, size); |
| ... | @@ -584,8 +582,7 @@ fn writeAtoms(macho_file: *MachO) !void { | ... | @@ -584,8 +582,7 @@ fn writeAtoms(macho_file: *MachO) !void { |
| 584 | | 582 | |
| 585 | for (macho_file.sections.items(.header), 0..) |header, n_sect| { | 583 | for (macho_file.sections.items(.header), 0..) |header, n_sect| { |
| 586 | if (header.isZerofill()) continue; | 584 | if (header.isZerofill()) continue; |
| 587 | if (!macho_file.isZigSection(@intCast(n_sect))) continue; | 585 | if (!macho_file.isZigSection(@intCast(n_sect)) and !macho_file.isDebugSection(@intCast(n_sect))) continue; |
| 588 | if (!macho_file.isDebugSection(@intCast(n_sect))) continue; | | |
| 589 | const gop = try relocs.getOrPut(@intCast(n_sect)); | 586 | const gop = try relocs.getOrPut(@intCast(n_sect)); |
| 590 | if (gop.found_existing) continue; | 587 | if (gop.found_existing) continue; |
| 591 | gop.value_ptr.* = try std.ArrayList(macho.relocation_info).initCapacity(gpa, header.nreloc); | 588 | gop.value_ptr.* = try std.ArrayList(macho.relocation_info).initCapacity(gpa, header.nreloc); |
| ... | @@ -596,8 +593,7 @@ fn writeAtoms(macho_file: *MachO) !void { | ... | @@ -596,8 +593,7 @@ fn writeAtoms(macho_file: *MachO) !void { |
| 596 | if (!atom.flags.alive) continue; | 593 | if (!atom.flags.alive) continue; |
| 597 | const header = macho_file.sections.items(.header)[atom.out_n_sect]; | 594 | const header = macho_file.sections.items(.header)[atom.out_n_sect]; |
| 598 | if (header.isZerofill()) continue; | 595 | if (header.isZerofill()) continue; |
| 599 | if (!macho_file.isZigSection(atom.out_n_sect)) continue; | 596 | if (!macho_file.isZigSection(atom.out_n_sect) and !macho_file.isDebugSection(atom.out_n_sect)) continue; |
| 600 | if (!macho_file.isDebugSection(atom.out_n_sect)) continue; | | |
| 601 | if (atom.getRelocs(macho_file).len == 0) continue; | 597 | if (atom.getRelocs(macho_file).len == 0) continue; |
| 602 | const atom_size = math.cast(usize, atom.size) orelse return error.Overflow; | 598 | const atom_size = math.cast(usize, atom.size) orelse return error.Overflow; |
| 603 | const code = try gpa.alloc(u8, atom_size); | 599 | const code = try gpa.alloc(u8, atom_size); |