summaryrefslogtreecommitdiff
path: root/utils/imxtools
diff options
context:
space:
mode:
Diffstat (limited to 'utils/imxtools')
-rw-r--r--utils/imxtools/sbtools/elf.c15
-rw-r--r--utils/imxtools/sbtools/elf.h1
-rw-r--r--utils/imxtools/sbtools/elftosb.c1
-rw-r--r--utils/imxtools/sbtools/elftosb1.c2
4 files changed, 3 insertions, 16 deletions
diff --git a/utils/imxtools/sbtools/elf.c b/utils/imxtools/sbtools/elf.c
index adf876e5c7..5017251da3 100644
--- a/utils/imxtools/sbtools/elf.c
+++ b/utils/imxtools/sbtools/elf.c
@@ -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;
diff --git a/utils/imxtools/sbtools/elf.h b/utils/imxtools/sbtools/elf.h
index 09cbe251a1..4200850e74 100644
--- a/utils/imxtools/sbtools/elf.h
+++ b/utils/imxtools/sbtools/elf.h
@@ -101,7 +101,6 @@ void elf_add_load_section(struct elf_params_t *params,
void elf_add_fill_section(struct elf_params_t *params,
uint32_t fill_addr, uint32_t size, uint32_t pattern, const char *name);
uint32_t elf_translate_virtual_address(struct elf_params_t *params, uint32_t addr);
-void elf_translate_addresses(struct elf_params_t *params);
void elf_simplify(struct elf_params_t *params);
void elf_sort_by_address(struct elf_params_t *params);
void elf_write_file(struct elf_params_t *params, elf_write_fn_t write, elf_printf_fn_t printf, void *user);
diff --git a/utils/imxtools/sbtools/elftosb.c b/utils/imxtools/sbtools/elftosb.c
index a18bad6437..e264337d11 100644
--- a/utils/imxtools/sbtools/elftosb.c
+++ b/utils/imxtools/sbtools/elftosb.c
@@ -88,7 +88,6 @@ static void load_elf_by_id(struct cmd_file_t *cmd_file, const char *id)
fclose(fd);
if(!src->loaded)
bug("error loading elf file '%s' (id '%s')\n", src->filename, id);
- elf_translate_addresses(&src->elf);
}
static void load_bin_by_id(struct cmd_file_t *cmd_file, const char *id)
diff --git a/utils/imxtools/sbtools/elftosb1.c b/utils/imxtools/sbtools/elftosb1.c
index 79b7621844..43f9b1e9be 100644
--- a/utils/imxtools/sbtools/elftosb1.c
+++ b/utils/imxtools/sbtools/elftosb1.c
@@ -19,6 +19,7 @@
*
****************************************************************************/
+#define _POSIX_C_SOURCE 200809L /* for strdup */
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
@@ -405,7 +406,6 @@ static int load_elf(struct sb1_file_t *sb, const char *filename, int act)
fclose(fd);
if(!loaded)
bug("error loading elf file '%s'\n", filename);
- elf_translate_addresses(&elf);
elf_sort_by_address(&elf);
struct elf_section_t *esec = elf.first_section;