Fix compiler warnings, add signed versions of some swab functions.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2252 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
5dc4b74480
commit
a86c8f29de
18
dyngen.c
18
dyngen.c
|
@ -127,10 +127,12 @@
|
||||||
typedef int32_t host_long;
|
typedef int32_t host_long;
|
||||||
typedef uint32_t host_ulong;
|
typedef uint32_t host_ulong;
|
||||||
#define swabls(x) swab32s(x)
|
#define swabls(x) swab32s(x)
|
||||||
|
#define swablss(x) swab32ss(x)
|
||||||
#else
|
#else
|
||||||
typedef int64_t host_long;
|
typedef int64_t host_long;
|
||||||
typedef uint64_t host_ulong;
|
typedef uint64_t host_ulong;
|
||||||
#define swabls(x) swab64s(x)
|
#define swabls(x) swab64s(x)
|
||||||
|
#define swablss(x) swab64ss(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ELF_USES_RELOCA
|
#ifdef ELF_USES_RELOCA
|
||||||
|
@ -284,11 +286,21 @@ void swab32s(uint32_t *p)
|
||||||
*p = bswap32(*p);
|
*p = bswap32(*p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void swab32ss(int32_t *p)
|
||||||
|
{
|
||||||
|
*p = bswap32(*p);
|
||||||
|
}
|
||||||
|
|
||||||
void swab64s(uint64_t *p)
|
void swab64s(uint64_t *p)
|
||||||
{
|
{
|
||||||
*p = bswap64(*p);
|
*p = bswap64(*p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void swab64ss(int64_t *p)
|
||||||
|
{
|
||||||
|
*p = bswap64(*p);
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t get16(uint16_t *p)
|
uint16_t get16(uint16_t *p)
|
||||||
{
|
{
|
||||||
uint16_t val;
|
uint16_t val;
|
||||||
|
@ -397,7 +409,7 @@ void elf_swap_rel(ELF_RELOC *rel)
|
||||||
swabls(&rel->r_offset);
|
swabls(&rel->r_offset);
|
||||||
swabls(&rel->r_info);
|
swabls(&rel->r_info);
|
||||||
#ifdef ELF_USES_RELOCA
|
#ifdef ELF_USES_RELOCA
|
||||||
swabls(&rel->r_addend);
|
swablss(&rel->r_addend);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +517,7 @@ int load_object(const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
sec = &shdr[ehdr.e_shstrndx];
|
sec = &shdr[ehdr.e_shstrndx];
|
||||||
shstr = sdata[ehdr.e_shstrndx];
|
shstr = (char *)sdata[ehdr.e_shstrndx];
|
||||||
|
|
||||||
/* swap relocations */
|
/* swap relocations */
|
||||||
for(i = 0; i < ehdr.e_shnum; i++) {
|
for(i = 0; i < ehdr.e_shnum; i++) {
|
||||||
|
@ -541,7 +553,7 @@ int load_object(const char *filename)
|
||||||
strtab_sec = &shdr[symtab_sec->sh_link];
|
strtab_sec = &shdr[symtab_sec->sh_link];
|
||||||
|
|
||||||
symtab = (ElfW(Sym) *)sdata[symtab_sec - shdr];
|
symtab = (ElfW(Sym) *)sdata[symtab_sec - shdr];
|
||||||
strtab = sdata[symtab_sec->sh_link];
|
strtab = (char *)sdata[symtab_sec->sh_link];
|
||||||
|
|
||||||
nb_syms = symtab_sec->sh_size / sizeof(ElfW(Sym));
|
nb_syms = symtab_sec->sh_size / sizeof(ElfW(Sym));
|
||||||
if (do_swap) {
|
if (do_swap) {
|
||||||
|
|
Loading…
Reference in a new issue