authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-04 22:38:37+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-04 22:44:49+02:00
log64b6a4ff7731ac70556081500b0a615b9f4a42a1
tree0d8c761ad28113c15a531fe49d4cd0b35a873999
parenteb363bf84503c428374d5c698ef7ebd574940a11
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

objcopy: Use p_paddr from PT_LOAD even if zero.

Fix suggested by @cclin0816. Closes #20019.

1 files changed, 1 insertions(+), 1 deletions(-)

lib/compiler/objcopy.zig+1-1
...@@ -392,7 +392,7 @@ const BinaryElfOutput = struct {...@@ -392,7 +392,7 @@ const BinaryElfOutput = struct {
392 if (phdr.p_type == elf.PT_LOAD) {392 if (phdr.p_type == elf.PT_LOAD) {
393 const newSegment = try allocator.create(BinaryElfSegment);393 const newSegment = try allocator.create(BinaryElfSegment);
394394
395 newSegment.physicalAddress = if (phdr.p_paddr != 0) phdr.p_paddr else phdr.p_vaddr;395 newSegment.physicalAddress = phdr.p_paddr;
396 newSegment.virtualAddress = phdr.p_vaddr;396 newSegment.virtualAddress = phdr.p_vaddr;
397 newSegment.fileSize = @intCast(phdr.p_filesz);397 newSegment.fileSize = @intCast(phdr.p_filesz);
398 newSegment.elfOffset = phdr.p_offset;398 newSegment.elfOffset = phdr.p_offset;