Commit a86c8f29de76536db368714297ed13beb05ef771

Authored by ths
1 parent 5dc4b744

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
Showing 1 changed file with 15 additions and 3 deletions
dyngen.c
... ... @@ -127,10 +127,12 @@
127 127 typedef int32_t host_long;
128 128 typedef uint32_t host_ulong;
129 129 #define swabls(x) swab32s(x)
  130 +#define swablss(x) swab32ss(x)
130 131 #else
131 132 typedef int64_t host_long;
132 133 typedef uint64_t host_ulong;
133 134 #define swabls(x) swab64s(x)
  135 +#define swablss(x) swab64ss(x)
134 136 #endif
135 137  
136 138 #ifdef ELF_USES_RELOCA
... ... @@ -284,11 +286,21 @@ void swab32s(uint32_t *p)
284 286 *p = bswap32(*p);
285 287 }
286 288  
  289 +void swab32ss(int32_t *p)
  290 +{
  291 + *p = bswap32(*p);
  292 +}
  293 +
287 294 void swab64s(uint64_t *p)
288 295 {
289 296 *p = bswap64(*p);
290 297 }
291 298  
  299 +void swab64ss(int64_t *p)
  300 +{
  301 + *p = bswap64(*p);
  302 +}
  303 +
292 304 uint16_t get16(uint16_t *p)
293 305 {
294 306 uint16_t val;
... ... @@ -397,7 +409,7 @@ void elf_swap_rel(ELF_RELOC *rel)
397 409 swabls(&rel->r_offset);
398 410 swabls(&rel->r_info);
399 411 #ifdef ELF_USES_RELOCA
400   - swabls(&rel->r_addend);
  412 + swablss(&rel->r_addend);
401 413 #endif
402 414 }
403 415  
... ... @@ -505,7 +517,7 @@ int load_object(const char *filename)
505 517 }
506 518  
507 519 sec = &shdr[ehdr.e_shstrndx];
508   - shstr = sdata[ehdr.e_shstrndx];
  520 + shstr = (char *)sdata[ehdr.e_shstrndx];
509 521  
510 522 /* swap relocations */
511 523 for(i = 0; i < ehdr.e_shnum; i++) {
... ... @@ -541,7 +553,7 @@ int load_object(const char *filename)
541 553 strtab_sec = &shdr[symtab_sec->sh_link];
542 554  
543 555 symtab = (ElfW(Sym) *)sdata[symtab_sec - shdr];
544   - strtab = sdata[symtab_sec->sh_link];
  556 + strtab = (char *)sdata[symtab_sec->sh_link];
545 557  
546 558 nb_syms = symtab_sec->sh_size / sizeof(ElfW(Sym));
547 559 if (do_swap) {
... ...