| ... | @@ -1658,7 +1658,7 @@ fn initSyntheticSections(self: *MachO) !void { | ... | @@ -1658,7 +1658,7 @@ fn initSyntheticSections(self: *MachO) !void { |
| 1658 | .maxprot = prot, | 1658 | .maxprot = prot, |
| 1659 | }); | 1659 | }); |
| 1660 | } | 1660 | } |
| 1661 | } else if (eatPrefix(name, "segment$stop$")) |segname| { | 1661 | } else if (eatPrefix(name, "segment$end$")) |segname| { |
| 1662 | if (self.getSegmentByName(segname) == null) { // TODO check segname is valid | 1662 | if (self.getSegmentByName(segname) == null) { // TODO check segname is valid |
| 1663 | const prot = getSegmentProt(segname); | 1663 | const prot = getSegmentProt(segname); |
| 1664 | _ = try self.segments.append(gpa, .{ | 1664 | _ = try self.segments.append(gpa, .{ |
| ... | @@ -1675,7 +1675,7 @@ fn initSyntheticSections(self: *MachO) !void { | ... | @@ -1675,7 +1675,7 @@ fn initSyntheticSections(self: *MachO) !void { |
| 1675 | if (self.getSectionByName(segname, sectname) == null) { | 1675 | if (self.getSectionByName(segname, sectname) == null) { |
| 1676 | _ = try self.addSection(segname, sectname, .{}); | 1676 | _ = try self.addSection(segname, sectname, .{}); |
| 1677 | } | 1677 | } |
| 1678 | } else if (eatPrefix(name, "section$stop$")) |actual_name| { | 1678 | } else if (eatPrefix(name, "section$end$")) |actual_name| { |
| 1679 | const sep = mem.indexOfScalar(u8, actual_name, '$').?; // TODO error rather than a panic | 1679 | const sep = mem.indexOfScalar(u8, actual_name, '$').?; // TODO error rather than a panic |
| 1680 | const segname = actual_name[0..sep]; // TODO check segname is valid | 1680 | const segname = actual_name[0..sep]; // TODO check segname is valid |
| 1681 | const sectname = actual_name[sep + 1 ..]; // TODO check sectname is valid | 1681 | const sectname = actual_name[sep + 1 ..]; // TODO check sectname is valid |
| ... | @@ -2267,8 +2267,8 @@ fn allocateSyntheticSymbols(self: *MachO) void { | ... | @@ -2267,8 +2267,8 @@ fn allocateSyntheticSymbols(self: *MachO) void { |
| 2267 | const seg = self.segments.items[seg_id]; | 2267 | const seg = self.segments.items[seg_id]; |
| 2268 | sym.value = seg.vmaddr; | 2268 | sym.value = seg.vmaddr; |
| 2269 | } | 2269 | } |
| 2270 | } else if (mem.startsWith(u8, name, "segment$stop$")) { | 2270 | } else if (mem.startsWith(u8, name, "segment$end$")) { |
| 2271 | const segname = name["segment$stop$".len..]; | 2271 | const segname = name["segment$end$".len..]; |
| 2272 | if (self.getSegmentByName(segname)) |seg_id| { | 2272 | if (self.getSegmentByName(segname)) |seg_id| { |
| 2273 | const seg = self.segments.items[seg_id]; | 2273 | const seg = self.segments.items[seg_id]; |
| 2274 | sym.value = seg.vmaddr + seg.vmsize; | 2274 | sym.value = seg.vmaddr + seg.vmsize; |
| ... | @@ -2283,8 +2283,8 @@ fn allocateSyntheticSymbols(self: *MachO) void { | ... | @@ -2283,8 +2283,8 @@ fn allocateSyntheticSymbols(self: *MachO) void { |
| 2283 | sym.value = sect.addr; | 2283 | sym.value = sect.addr; |
| 2284 | sym.out_n_sect = sect_id; | 2284 | sym.out_n_sect = sect_id; |
| 2285 | } | 2285 | } |
| 2286 | } else if (mem.startsWith(u8, name, "section$stop$")) { | 2286 | } else if (mem.startsWith(u8, name, "section$end$")) { |
| 2287 | const actual_name = name["section$stop$".len..]; | 2287 | const actual_name = name["section$end$".len..]; |
| 2288 | const sep = mem.indexOfScalar(u8, actual_name, '$').?; // TODO error rather than a panic | 2288 | const sep = mem.indexOfScalar(u8, actual_name, '$').?; // TODO error rather than a panic |
| 2289 | const segname = actual_name[0..sep]; | 2289 | const segname = actual_name[0..sep]; |
| 2290 | const sectname = actual_name[sep + 1 ..]; | 2290 | const sectname = actual_name[sep + 1 ..]; |