1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-27 10:23:41 +03:00

Set ELF header's p_paddr

On Unix, p_paddr values (segment physical addresss) don't matter,
but GNU linkers set them to the same value as p_vaddr. We should
set the same values for compatibility with programs that make the
wrong assumption.
This commit is contained in:
Rui Ueyama 2021-06-04 15:31:03 +09:00
parent b0b2406d84
commit 507ee38975

View File

@ -120,6 +120,7 @@ std::vector<ElfPhdr<E>> create_phdr(Context<E> &ctx) {
phdr.p_filesz =
(chunk->shdr.sh_type == SHT_NOBITS) ? 0 : chunk->shdr.sh_size;
phdr.p_vaddr = chunk->shdr.sh_addr;
phdr.p_paddr = chunk->shdr.sh_addr;
phdr.p_memsz = chunk->shdr.sh_size;
};