Commit 64b6a4ff77

Alex Rønne Petersen <alex@alexrp.com>
2024-10-04 22:38:37
objcopy: Use p_paddr from PT_LOAD even if zero.
Fix suggested by @cclin0816. Closes #20019.
1 parent eb363bf
Changed files (1)
lib
compiler
lib/compiler/objcopy.zig
@@ -392,7 +392,7 @@ const BinaryElfOutput = struct {
             if (phdr.p_type == elf.PT_LOAD) {
                 const newSegment = try allocator.create(BinaryElfSegment);
 
-                newSegment.physicalAddress = if (phdr.p_paddr != 0) phdr.p_paddr else phdr.p_vaddr;
+                newSegment.physicalAddress = phdr.p_paddr;
                 newSegment.virtualAddress = phdr.p_vaddr;
                 newSegment.fileSize = @intCast(phdr.p_filesz);
                 newSegment.elfOffset = phdr.p_offset;