Open cclin0816 opened 4 months ago
https://github.com/ziglang/zig/blob/28476a5ee94d311319941b54e9da66210690ce70/lib/compiler/objcopy.zig#L400
I understand that p_paddr might be set to zero when not used. However, shouldn't zero also be a valid physical address?
When elf is linked with something like this:
SECTIONS { . = load_offset; .text : AT(0) { *(.text) } .data : { *(.data) } }
Trying to create binary with zig objcopy will either failed to seek, or produce binary with wrong layout. gnu objcopy and llvm-objcopy produces correct binary file.
Will it break things if newSegment.physicalAddress = phdr.p_paddr is used instead?
newSegment.physicalAddress = phdr.p_paddr
seems fine to me
https://github.com/ziglang/zig/blob/28476a5ee94d311319941b54e9da66210690ce70/lib/compiler/objcopy.zig#L400
I understand that p_paddr might be set to zero when not used. However, shouldn't zero also be a valid physical address?
When elf is linked with something like this:
Trying to create binary with zig objcopy will either failed to seek, or produce binary with wrong layout. gnu objcopy and llvm-objcopy produces correct binary file.
Will it break things if
newSegment.physicalAddress = phdr.p_paddr
is used instead?