| ... | ... | @@ -4273,10 +4273,13 @@ fn flushFileOffset(elf: *Elf, ni: MappedFile.Node.Index) !void { |
| 4273 | 4273 | }, |
| 4274 | 4274 | .segment => |phndx| { |
| 4275 | 4275 | switch (elf.phdrSlice()) { |
| 4276 | | inline else => |phdr| elf.targetStore( |
| 4277 | | &phdr[phndx].offset, |
| 4278 | | @intCast(ni.fileLocation(&elf.mf, false).offset), |
| 4279 | | ), |
| 4276 | inline else => |phdr, class| { |
| 4277 | const ph = &phdr[phndx]; |
| 4278 | elf.targetStore(&ph.offset, @intCast(ni.fileLocation(&elf.mf, false).offset)); |
| 4279 | if (elf.targetLoad(&ph.type) == .PHDR) { |
| 4280 | @field(elf.ehdrPtr(), @tagName(class)).phoff = ph.offset; |
| 4281 | } |
| 4282 | }, |
| 4280 | 4283 | } |
| 4281 | 4284 | var child_it = ni.children(&elf.mf); |
| 4282 | 4285 | while (child_it.next()) |child_ni| try elf.flushFileOffset(child_ni); |
| ... | ... | @@ -4296,14 +4299,18 @@ fn flushMoved(elf: *Elf, ni: MappedFile.Node.Index) !void { |
| 4296 | 4299 | .segment => |phndx| { |
| 4297 | 4300 | try elf.flushFileOffset(ni); |
| 4298 | 4301 | switch (elf.phdrSlice()) { |
| 4299 | | inline else => |phdr, class| { |
| 4302 | inline else => |phdr| { |
| 4300 | 4303 | const ph = &phdr[phndx]; |
| 4301 | 4304 | switch (elf.targetLoad(&ph.type)) { |
| 4302 | 4305 | else => unreachable, |
| 4303 | 4306 | .NULL, .LOAD => return, |
| 4304 | | .DYNAMIC, .INTERP => {}, |
| 4305 | | .PHDR => @field(elf.ehdrPtr(), @tagName(class)).phoff = ph.offset, |
| 4306 | | .TLS, std.elf.PT.GNU_RELRO => {}, |
| 4307 | |
| 4308 | .DYNAMIC, |
| 4309 | .INTERP, |
| 4310 | .PHDR, |
| 4311 | .TLS, |
| 4312 | .GNU_RELRO, |
| 4313 | => {}, |
| 4307 | 4314 | } |
| 4308 | 4315 | elf.targetStore(&ph.vaddr, @intCast(elf.computeNodeVAddr(ni))); |
| 4309 | 4316 | ph.paddr = ph.vaddr; |