Commit b0d60a98 authored by Daniel Schwierzeck's avatar Daniel Schwierzeck Committed by Tom Rini
Browse files

common: cmd_elf.c: use uintptr_t for casts from u32 to void*



This fixes warnings when compiling with ELDK-5.2.1 for MIPS64:

cmd_elf.c: In function 'load_elf_image_phdr':
cmd_elf.c:289:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
cmd_elf.c: In function 'load_elf_image_shdr':
cmd_elf.c:343:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
cmd_elf.c:346:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
Signed-off-by: default avatarDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
parent 62e03d33
...@@ -284,7 +284,7 @@ static unsigned long load_elf_image_phdr(unsigned long addr) ...@@ -284,7 +284,7 @@ static unsigned long load_elf_image_phdr(unsigned long addr)
/* Load each program header */ /* Load each program header */
for (i = 0; i < ehdr->e_phnum; ++i) { for (i = 0; i < ehdr->e_phnum; ++i) {
void *dst = (void *) phdr->p_paddr; void *dst = (void *)(uintptr_t) phdr->p_paddr;
void *src = (void *) addr + phdr->p_offset; void *src = (void *) addr + phdr->p_offset;
debug("Loading phdr %i to 0x%p (%i bytes)\n", debug("Loading phdr %i to 0x%p (%i bytes)\n",
i, dst, phdr->p_filesz); i, dst, phdr->p_filesz);
...@@ -339,10 +339,11 @@ static unsigned long load_elf_image_shdr(unsigned long addr) ...@@ -339,10 +339,11 @@ static unsigned long load_elf_image_shdr(unsigned long addr)
} }
if (shdr->sh_type == SHT_NOBITS) { if (shdr->sh_type == SHT_NOBITS) {
memset((void *)shdr->sh_addr, 0, shdr->sh_size); memset((void *)(uintptr_t) shdr->sh_addr, 0,
shdr->sh_size);
} else { } else {
image = (unsigned char *) addr + shdr->sh_offset; image = (unsigned char *) addr + shdr->sh_offset;
memcpy((void *) shdr->sh_addr, memcpy((void *)(uintptr_t) shdr->sh_addr,
(const void *) image, (const void *) image,
shdr->sh_size); shdr->sh_size);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment