Commit b29d8ae4d40a3cd1e3e6ca8810ed8cd8d93af46a

Authored by aurel32
1 parent 2408a527

fix dyngen on HPPA hosts

(Stuart Brady)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4227 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 30 additions and 1 deletions
dyngen.c
... ... @@ -1759,7 +1759,36 @@ void gen_code(const char *name, host_ulong offset, host_ulong size,
1759 1759 }
1760 1760  
1761 1761 if (gen_switch == 2) {
1762   - fprintf(outfile, "DEF(%s, %d, %d)\n", name + 3, nb_args, copy_size);
  1762 +
  1763 +#if defined(HOST_HPPA)
  1764 + int op_size = copy_size;
  1765 + int has_stubs = 0;
  1766 + char relname[256];
  1767 + int type, is_label;
  1768 +
  1769 + for (i = 0, rel = relocs; i < nb_relocs; i++, rel++) {
  1770 + if (rel->r_offset >= start_offset &&
  1771 + rel->r_offset < start_offset + copy_size) {
  1772 + sym_name = get_rel_sym_name(rel);
  1773 + sym_name = strtab + symtab[ELF32_R_SYM(rel->r_info)].st_name;
  1774 + is_label = get_reloc_expr(relname, sizeof(relname), sym_name);
  1775 + type = ELF32_R_TYPE(rel->r_info);
  1776 +
  1777 + if (!is_label && type == R_PARISC_PCREL17F) {
  1778 + has_stubs = 1;
  1779 + op_size += 8; /* ldil and be,n instructions */
  1780 + }
  1781 + }
  1782 + }
  1783 +
  1784 + if (has_stubs)
  1785 + op_size += 4; /* b,l,n instruction, to skip past the stubs */
  1786 +
  1787 + fprintf(outfile, "DEF(%s, %d, %d)\n", name + 3, nb_args, op_size);
  1788 +#else
  1789 + fprintf(outfile, "DEF(%s, %d, %d)\n", name + 3, nb_args, copy_size);
  1790 +#endif
  1791 +
1763 1792 } else if (gen_switch == 1) {
1764 1793  
1765 1794 /* output C code */
... ...