asection *, struct elf_link_hash_entry *,
struct elf64_hppa_dyn_hash_entry *));
-static unsigned int elf_hppa_relocate_insn
- PARAMS ((unsigned int, unsigned int, unsigned int));
+static int elf_hppa_relocate_insn
+ PARAMS ((int, int, unsigned int));
#endif
/* ELF/PA relocation howto entries. */
{
elf_hppa_reloc_type *finaltype;
elf_hppa_reloc_type **final_types;
+ bfd_size_type amt = sizeof (elf_hppa_reloc_type *) * 2;
/* Allocate slots for the BFD relocation. */
- final_types = ((elf_hppa_reloc_type **)
- bfd_alloc (abfd, sizeof (elf_hppa_reloc_type *) * 2));
+ final_types = (elf_hppa_reloc_type **) bfd_alloc (abfd, amt);
if (final_types == NULL)
return NULL;
/* Allocate space for the relocation itself. */
- finaltype = ((elf_hppa_reloc_type *)
- bfd_alloc (abfd, sizeof (elf_hppa_reloc_type)));
+ amt = sizeof (elf_hppa_reloc_type);
+ finaltype = (elf_hppa_reloc_type *) bfd_alloc (abfd, amt);
if (finaltype == NULL)
return NULL;
struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
struct elf64_hppa_dyn_hash_entry *dyn_h;
{
- unsigned int insn;
+ int insn;
bfd_vma offset = rel->r_offset;
- bfd_vma addend = rel->r_addend;
+ bfd_signed_vma addend = rel->r_addend;
reloc_howto_type *howto = elf_hppa_howto_table + ELF_R_TYPE (rel->r_info);
unsigned int r_type = howto->type;
bfd_byte *hit_data = contents + offset;
value = hppa_field_adjust (value, -8 + addend, e_rsel);
/* Apply the relocation to the given instruction. */
- insn = elf_hppa_relocate_insn (insn, value, r_type);
+ insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
break;
}
value >>= 2;
/* Apply the relocation to the given instruction. */
- insn = elf_hppa_relocate_insn (insn, value, r_type);
+ insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
break;
}
else
value = hppa_field_adjust (value, addend, e_rrsel);
- insn = elf_hppa_relocate_insn (insn, value, r_type);
+ insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
break;
}
else
value = hppa_field_adjust (value, addend, e_rrsel);
- insn = elf_hppa_relocate_insn (insn, value, r_type);
+ insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
break;
}
value >>= 2;
}
- insn = elf_hppa_relocate_insn (insn, value, r_type);
+ insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
break;
}
else
value = hppa_field_adjust (value, addend, e_rrsel);
- insn = elf_hppa_relocate_insn (insn, value, r_type);
+ insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
break;
}
}
/* Update the instruction word. */
- bfd_put_32 (input_bfd, insn, hit_data);
+ bfd_put_32 (input_bfd, (bfd_vma) insn, hit_data);
return bfd_reloc_ok;
}
Instead this routine is meant to handle the bit manipulations needed
to insert the relocation into the given instruction. */
-static unsigned int
+static int
elf_hppa_relocate_insn (insn, sym_value, r_type)
- unsigned int insn;
- unsigned int sym_value;
+ int insn;
+ int sym_value;
unsigned int r_type;
{
switch (r_type)
the "B" instruction. */
case R_PARISC_PCREL22F:
case R_PARISC_PCREL22C:
- return (insn & ~ 0x3ff1ffd) | re_assemble_22 (sym_value);
+ return (insn & ~0x3ff1ffd) | re_assemble_22 (sym_value);
/* This is any 12 bit branch. */
case R_PARISC_PCREL12F:
- return (insn & ~ 0x1ffd) | re_assemble_12 (sym_value);
+ return (insn & ~0x1ffd) | re_assemble_12 (sym_value);
/* This is any 17 bit branch. In PA2.0 syntax it also corresponds
to the "B" instruction as well as BE. */
case R_PARISC_DIR17R:
case R_PARISC_PCREL17C:
case R_PARISC_PCREL17R:
- return (insn & ~ 0x1f1ffd) | re_assemble_17 (sym_value);
+ return (insn & ~0x1f1ffd) | re_assemble_17 (sym_value);
/* ADDIL or LDIL instructions. */
case R_PARISC_DLTREL21L:
case R_PARISC_DPREL21L:
case R_PARISC_PLTOFF21L:
case R_PARISC_DIR21L:
- return (insn & ~ 0x1fffff) | re_assemble_21 (sym_value);
+ return (insn & ~0x1fffff) | re_assemble_21 (sym_value);
/* LDO and integer loads/stores with 14 bit displacements. */
case R_PARISC_DLTREL14R:
case R_PARISC_DIR14F:
case R_PARISC_DIR16F:
case R_PARISC_LTOFF16F:
- return (insn & ~ 0x3fff) | low_sign_unext (sym_value, 14);
+ return (insn & ~0x3fff) | low_sign_unext (sym_value, 14);
/* Doubleword loads and stores with a 14 bit displacement. */
case R_PARISC_DLTREL14DR:
case R_PARISC_DIR14DR:
case R_PARISC_DIR16DF:
case R_PARISC_LTOFF16DF:
- return (insn & ~ 0x3ff1) | (((sym_value & 0x2000) >> 13)
- | ((sym_value & 0x1ff8) << 1));
+ return (insn & ~0x3ff1) | (((sym_value & 0x2000) >> 13)
+ | ((sym_value & 0x1ff8) << 1));
/* Floating point single word load/store instructions. */
case R_PARISC_DLTREL14WR:
case R_PARISC_DIR16WF:
case R_PARISC_DIR14WR:
case R_PARISC_LTOFF16WF:
- return (insn & ~ 0x3ff9) | (((sym_value & 0x2000) >> 13)
- | ((sym_value & 0x1ffc) << 1));
+ return (insn & ~0x3ff9) | (((sym_value & 0x2000) >> 13)
+ | ((sym_value & 0x1ffc) << 1));
default:
return insn;