Skip to content

Commit

Permalink
Cast ELF datatypes properly to host 64bit types.
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3407 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
ths committed Oct 17, 2007
1 parent 06c0b38 commit 8279006
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions elf_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend,
goto fail;

if (pentry)
*pentry = (uint64_t)ehdr.e_entry;
*pentry = (uint64_t)(elf_sword)ehdr.e_entry;

glue(load_symbols, SZ)(&ehdr, fd, must_swab);

Expand Down Expand Up @@ -206,9 +206,9 @@ int glue(load_elf, SZ)(int fd, int64_t virt_to_phys_addend,
}
qemu_free(phdr);
if (lowaddr)
*lowaddr = (uint64_t)low;
*lowaddr = (uint64_t)(elf_sword)low;
if (highaddr)
*highaddr = (uint64_t)high;
*highaddr = (uint64_t)(elf_sword)high;
return total_size;
fail:
qemu_free(data);
Expand Down
3 changes: 3 additions & 0 deletions loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ static void *load_at(int fd, int offset, int size)

#define SZ 32
#define elf_word uint32_t
#define elf_sword int32_t
#define bswapSZs bswap32s
#include "elf_ops.h"

Expand All @@ -182,6 +183,7 @@ static void *load_at(int fd, int offset, int size)
#undef elf_sym
#undef elf_note
#undef elf_word
#undef elf_sword
#undef bswapSZs
#undef SZ
#define elfhdr elf64_hdr
Expand All @@ -190,6 +192,7 @@ static void *load_at(int fd, int offset, int size)
#define elf_shdr elf64_shdr
#define elf_sym elf64_sym
#define elf_word uint64_t
#define elf_sword int64_t
#define bswapSZs bswap64s
#define SZ 64
#include "elf_ops.h"
Expand Down

0 comments on commit 8279006

Please sign in to comment.