forked from len0rd/rockbox
sbtools: do not rely on the ELF flags and always assume the entry point is valid
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29806 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e75018ad66
commit
8da7237fd9
2 changed files with 4 additions and 5 deletions
|
|
@ -360,7 +360,7 @@ bool elf_read_file(struct elf_params_t *params, elf_read_fn_t read,
|
||||||
if(ehdr.e_ident[EI_DATA] != ELFDATA2LSB)
|
if(ehdr.e_ident[EI_DATA] != ELFDATA2LSB)
|
||||||
error_printf("invalid elf data encoding: must be 32-bit lsb\n");
|
error_printf("invalid elf data encoding: must be 32-bit lsb\n");
|
||||||
if(ehdr.e_ident[EI_VERSION] != EV_CURRENT)
|
if(ehdr.e_ident[EI_VERSION] != EV_CURRENT)
|
||||||
error_printf("invalid elf version");
|
error_printf("invalid elf version\n");
|
||||||
if(ehdr.e_type != ET_EXEC)
|
if(ehdr.e_type != ET_EXEC)
|
||||||
error_printf("invalid elf file: must be an executable file\n");
|
error_printf("invalid elf file: must be an executable file\n");
|
||||||
if(ehdr.e_machine != EM_ARM)
|
if(ehdr.e_machine != EM_ARM)
|
||||||
|
|
@ -371,8 +371,7 @@ bool elf_read_file(struct elf_params_t *params, elf_read_fn_t read,
|
||||||
error_printf("invalid elf file: program header size mismatch\n");
|
error_printf("invalid elf file: program header size mismatch\n");
|
||||||
if(ehdr.e_shnum > 0 && ehdr.e_shentsize != sizeof(Elf32_Shdr))
|
if(ehdr.e_shnum > 0 && ehdr.e_shentsize != sizeof(Elf32_Shdr))
|
||||||
error_printf("invalid elf file: section header size mismatch\n");
|
error_printf("invalid elf file: section header size mismatch\n");
|
||||||
if(ehdr.e_flags & EF_ARM_HASENTRY)
|
elf_set_start_addr(params, ehdr.e_entry);
|
||||||
elf_set_start_addr(params, ehdr.e_entry);
|
|
||||||
|
|
||||||
char *strtab = NULL;
|
char *strtab = NULL;
|
||||||
if(ehdr.e_shstrndx != SHN_UNDEF)
|
if(ehdr.e_shstrndx != SHN_UNDEF)
|
||||||
|
|
@ -403,7 +402,7 @@ bool elf_read_file(struct elf_params_t *params, elf_read_fn_t read,
|
||||||
{
|
{
|
||||||
void *data = xmalloc(shdr.sh_size);
|
void *data = xmalloc(shdr.sh_size);
|
||||||
if(!read(user, shdr.sh_offset, data, shdr.sh_size))
|
if(!read(user, shdr.sh_offset, data, shdr.sh_size))
|
||||||
error_printf("error read self section data");
|
error_printf("error read self section data\n");
|
||||||
elf_add_load_section(params, shdr.sh_addr, shdr.sh_size, data);
|
elf_add_load_section(params, shdr.sh_addr, shdr.sh_size, data);
|
||||||
|
|
||||||
if(strtab)
|
if(strtab)
|
||||||
|
|
|
||||||
|
|
@ -601,7 +601,7 @@ static struct sb_file_t *apply_cmd_file(struct cmd_file_t *cmd_file)
|
||||||
else if(cinst->type == CMD_JUMP || cinst->type == CMD_CALL)
|
else if(cinst->type == CMD_JUMP || cinst->type == CMD_CALL)
|
||||||
{
|
{
|
||||||
if(!elf_get_start_addr(elf, NULL))
|
if(!elf_get_start_addr(elf, NULL))
|
||||||
bug("cannot jump/call '%s' because it has no starting point !", cinst->identifier);
|
bug("cannot jump/call '%s' because it has no starting point !\n", cinst->identifier);
|
||||||
sec->nr_insts++;
|
sec->nr_insts++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue