aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-21 16:49:27 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-21 16:49:27 +0000
commita86c8f29de76536db368714297ed13beb05ef771 (patch)
tree9d8bae842b88dbe2bd0ae95f5339b69d3108a33e
parent5dc4b744806b5f7487989e42a84322fbd5810877 (diff)
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
-rw-r--r--dyngen.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/dyngen.c b/dyngen.c
index 2d93283d67..bcfb86ea0d 100644
--- a/dyngen.c
+++ b/dyngen.c
@@ -127,10 +127,12 @@
typedef int32_t host_long;
typedef uint32_t host_ulong;
#define swabls(x) swab32s(x)
+#define swablss(x) swab32ss(x)
#else
typedef int64_t host_long;
typedef uint64_t host_ulong;
#define swabls(x) swab64s(x)
+#define swablss(x) swab64ss(x)
#endif
#ifdef ELF_USES_RELOCA
@@ -284,11 +286,21 @@ void swab32s(uint32_t *p)
*p = bswap32(*p);
}
+void swab32ss(int32_t *p)
+{
+ *p = bswap32(*p);
+}
+
void swab64s(uint64_t *p)
{
*p = bswap64(*p);
}
+void swab64ss(int64_t *p)
+{
+ *p = bswap64(*p);
+}
+
uint16_t get16(uint16_t *p)
{
uint16_t val;
@@ -397,7 +409,7 @@ void elf_swap_rel(ELF_RELOC *rel)
swabls(&rel->r_offset);
swabls(&rel->r_info);
#ifdef ELF_USES_RELOCA
- swabls(&rel->r_addend);
+ swablss(&rel->r_addend);
#endif
}
@@ -505,7 +517,7 @@ int load_object(const char *filename)
}
sec = &shdr[ehdr.e_shstrndx];
- shstr = sdata[ehdr.e_shstrndx];
+ shstr = (char *)sdata[ehdr.e_shstrndx];
/* swap relocations */
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];
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));
if (do_swap) {