| ... | @@ -3223,6 +3223,12 @@ fn detectAllocCollision(self: *MachO, start: u64, size: u64) ?u64 { | ... | @@ -3223,6 +3223,12 @@ fn detectAllocCollision(self: *MachO, start: u64, size: u64) ?u64 { |
| 3223 | } | 3223 | } |
| 3224 | | 3224 | |
| 3225 | fn detectAllocCollisionVirtual(self: *MachO, start: u64, size: u64) ?u64 { | 3225 | fn detectAllocCollisionVirtual(self: *MachO, start: u64, size: u64) ?u64 { |
| | 3226 | // Conservatively commit one page size as reserved space for the headers as we |
| | 3227 | // expect it to grow and everything else be moved in flush anyhow. |
| | 3228 | const header_size = self.getPageSize(); |
| | 3229 | if (start < header_size) |
| | 3230 | return header_size; |
| | 3231 | |
| 3226 | const end = start + padToIdeal(size); | 3232 | const end = start + padToIdeal(size); |
| 3227 | | 3233 | |
| 3228 | if (self.base.isRelocatable()) { | 3234 | if (self.base.isRelocatable()) { |
| ... | @@ -3234,12 +3240,6 @@ fn detectAllocCollisionVirtual(self: *MachO, start: u64, size: u64) ?u64 { | ... | @@ -3234,12 +3240,6 @@ fn detectAllocCollisionVirtual(self: *MachO, start: u64, size: u64) ?u64 { |
| 3234 | } | 3240 | } |
| 3235 | } | 3241 | } |
| 3236 | } else { | 3242 | } else { |
| 3237 | // Conservatively commit one page size as reserved space for the headers as we | | |
| 3238 | // expect it to grow and everything else be moved in flush anyhow. | | |
| 3239 | const header_size = self.getPageSize(); | | |
| 3240 | if (start < header_size) | | |
| 3241 | return header_size; | | |
| 3242 | | | |
| 3243 | for (self.segments.items) |seg| { | 3243 | for (self.segments.items) |seg| { |
| 3244 | const increased_size = padToIdeal(seg.vmsize); | 3244 | const increased_size = padToIdeal(seg.vmsize); |
| 3245 | const test_end = seg.vmaddr +| increased_size; | 3245 | const test_end = seg.vmaddr +| increased_size; |