From 64b6a4ff7731ac70556081500b0a615b9f4a42a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Fri, 4 Oct 2024 22:38:37 +0200 Subject: [PATCH] objcopy: Use p_paddr from PT_LOAD even if zero. Fix suggested by @cclin0816. Closes #20019. --- lib/compiler/objcopy.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compiler/objcopy.zig b/lib/compiler/objcopy.zig index ac609c94e5..b14f963771 100644 --- a/lib/compiler/objcopy.zig +++ b/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;