forked from len0rd/rockbox
elf: fix handling of virtual/physical addresses
Remove the hackish elf_translate_addresses which should not have existed in the first place, on write always compute the physical address of a section using elf_translate_virtual_address which makes it possible to specify any virtual to physical mapping and fail nicely if there is none. Change-Id: I4f436945e90280a6fd9430de6c642dbeb8e23d40
This commit is contained in:
parent
48ccea96f2
commit
8b13d2f5f1
4 changed files with 3 additions and 16 deletions
|
|
@ -519,8 +519,8 @@ void elf_write_file(struct elf_params_t *params, elf_write_fn_t write,
|
|||
phdr.p_offset = sec->offset;
|
||||
else
|
||||
phdr.p_offset = 0;
|
||||
phdr.p_paddr = sec->addr;
|
||||
phdr.p_vaddr = phdr.p_paddr; /* assume identity map ? */
|
||||
phdr.p_paddr = elf_translate_virtual_address(params, sec->addr);
|
||||
phdr.p_vaddr = sec->addr; /* assume identity map ? */
|
||||
phdr.p_memsz = sec->size;
|
||||
if(sec->type == EST_LOAD)
|
||||
phdr.p_filesz = phdr.p_memsz;
|
||||
|
|
@ -795,17 +795,6 @@ uint32_t elf_translate_virtual_address(struct elf_params_t *params, uint32_t add
|
|||
return addr;
|
||||
}
|
||||
|
||||
void elf_translate_addresses(struct elf_params_t *params)
|
||||
{
|
||||
struct elf_section_t *sec = params->first_section;
|
||||
while(sec)
|
||||
{
|
||||
sec->addr = elf_translate_virtual_address(params, sec->addr);
|
||||
sec = sec->next;
|
||||
}
|
||||
params->start_addr = elf_translate_virtual_address(params, params->start_addr);
|
||||
}
|
||||
|
||||
bool elf_is_empty(struct elf_params_t *params)
|
||||
{
|
||||
return params->first_section == NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue