bfd_byte *contents;
bfd_vma value;
{
- bfd_vma insn, t;
+ bfd_vma insn;
reloc_howto_type *howto;
howto = lookup_howto (ELF32_R_TYPE (rello->r_info));
insn = bfd_get_32 (input_bfd, contents + rello->r_offset);
- /* Remove encode bits and intervening bits. Then concatenate the
- two fields into one 16-bit quantity. */
- t = (insn & howto->src_mask);
- t = ((t >> 5) & 0xf8) | (t & 0x7ff);
-
/* Relocate. */
- value += (rello->r_addend + t);
+ value += rello->r_addend;
- /* Separate the fields and re-insert. */
+ /* Separate the fields and insert. */
value = (((value & 0xf8) << 5) | (value & 0x7ff)) & howto->dst_mask;
insn = (insn & ~howto->dst_mask) | value;
bfd_byte *contents;
bfd_vma value;
{
- bfd_vma insn, t;
+ bfd_vma insn;
reloc_howto_type *howto;
howto = lookup_howto (ELF32_R_TYPE (rello->r_info));
insn = bfd_get_32 (input_bfd, contents + rello->r_offset);
+ input_section->output_offset);
value -= rello->r_offset;
- /* Remove encode bits and intervening bits. Then concatenate the
- two fields into one 16-bit quantity. */
- t = (insn & howto->src_mask);
- t = ((t >> 5) & 0xf8) | (t & 0x7ff);
-
/* Relocate. */
- value += (rello->r_addend + t);
+ value += rello->r_addend;
- /* Separate the fields and re-insert. */
+ /* Separate the fields and insert. */
value = (((value & 0xf8) << 5) | (value & 0x7ff)) & howto->dst_mask;
insn = (insn & ~howto->dst_mask) | value;
value += ((rel->r_addend & 0x8000) << 1);
value += rel->r_addend;
value = ((value >> 16) & 0xffff);
- value = (value + (insn & 0xffff)) & 0xffff;
insn = (insn & 0xffff0000) | value;
fix->fx_r_type = obtain_reloc_for_imm16 (fix, &val);
/* Insert the immediate. */
- insn |= val & 0xffff;
- bfd_putl32 (insn, buf);
-
- fix->fx_done = (fix->fx_addsy == 0);
+ if (fix->fx_addsy)
+ fix->fx_done = 0;
+ else
+ {
+ insn |= val & 0xffff;
+ bfd_putl32 (insn, buf);
+ fix->fx_r_type = BFD_RELOC_NONE;
+ fix->fx_done = 1;
+ }
}
else if (fup & OP_IMM_U16)
{
fix->fx_r_type = obtain_reloc_for_imm16 (fix, &val);
/* Insert the immediate. */
- insn |= val & 0x7ff;
- insn |= (val & 0xf800) << 5;
- bfd_putl32 (insn, buf);
-
- fix->fx_done = (fix->fx_addsy == 0);
+ if (fix->fx_addsy)
+ fix->fx_done = 0;
+ else
+ {
+ insn |= val & 0x7ff;
+ insn |= (val & 0xf800) << 5;
+ bfd_putl32 (insn, buf);
+ fix->fx_r_type = BFD_RELOC_NONE;
+ fix->fx_done = 1;
+ }
}
else if (fup & OP_IMM_BR16)
{
val = val >> 2;
/* Insert the immediate. */
- insn |= (val & 0x7ff);
- insn |= ((val & 0xf800) << 5);
- bfd_putl32 (insn, buf);
-
- fix->fx_r_type = BFD_RELOC_860_PC16;
- fix->fx_done = (fix->fx_addsy == 0);
+ if (fix->fx_addsy)
+ {
+ fix->fx_done = 0;
+ fix->fx_r_type = BFD_RELOC_860_PC16;
+ }
+ else
+ {
+ insn |= (val & 0x7ff);
+ insn |= ((val & 0xf800) << 5);
+ bfd_putl32 (insn, buf);
+ fix->fx_r_type = BFD_RELOC_NONE;
+ fix->fx_done = 1;
+ }
}
else if (fup & OP_IMM_BR26)
{
val >>= 2;
/* Insert the immediate. */
- insn |= (val & 0x3ffffff);
- bfd_putl32 (insn, buf);
-
- fix->fx_r_type = BFD_RELOC_860_PC26;
- fix->fx_done = (fix->fx_addsy == 0);
+ if (fix->fx_addsy)
+ {
+ fix->fx_r_type = BFD_RELOC_860_PC26;
+ fix->fx_done = 0;
+ }
+ else
+ {
+ insn |= (val & 0x3ffffff);
+ bfd_putl32 (insn, buf);
+ fix->fx_r_type = BFD_RELOC_NONE;
+ fix->fx_done = 1;
+ }
}
else if (fup != OP_NONE)
{
{
/* I believe only fix-ups such as ".long .ep.main-main+0xc8000000"
reach here (???). */
- insn |= (val & 0xffffffff);
- bfd_putl32 (insn, buf);
- fix->fx_r_type = BFD_RELOC_32;
- fix->fx_done = (fix->fx_addsy == 0);
+ if (fix->fx_addsy)
+ {
+ fix->fx_r_type = BFD_RELOC_32;
+ fix->fx_done = 0;
+ }
+ else
+ {
+ insn |= (val & 0xffffffff);
+ bfd_putl32 (insn, buf);
+ fix->fx_r_type = BFD_RELOC_NONE;
+ fix->fx_done = 1;
+ }
}
/* Return value ignored. */