Skip to content

Commit

Permalink
macho: set __DATA_CONST* segments flags to SG_READ_ONLY
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Jan 24, 2024
1 parent 75af594 commit 8985725
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/MachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1806,11 +1806,13 @@ fn initSegments(self: *MachO) !void {
const segname = header.segName();
if (self.getSegmentByName(segname) == null) {
const prot = getSegmentProt(segname);
const flags: u32 = if (mem.startsWith(u8, segname, "__DATA_CONST")) 0x10 else 0; // TODO usee macho.SG_READ_ONLY once upstreamed
try self.segments.append(gpa, .{
.cmdsize = @sizeOf(macho.segment_command_64),
.segname = makeStaticString(segname),
.maxprot = prot,
.initprot = prot,
.flags = flags,
});
}
}
Expand Down

0 comments on commit 8985725

Please sign in to comment.