}
static void
-ppc_elf_vle_split16 (bfd *output_bfd, bfd_byte *loc,
+ppc_elf_vle_split16 (bfd *input_bfd,
+ bfd_byte *loc,
bfd_vma value,
split16_format_type split16_format)
-
{
unsigned int insn, top5;
- insn = bfd_get_32 (output_bfd, loc);
+ insn = bfd_get_32 (input_bfd, loc);
top5 = value & 0xf800;
top5 = top5 << (split16_format == split16a_type ? 9 : 5);
insn &= (split16_format == split16a_type ? ~0x1f007ff : ~0x1f07ff);
insn |= top5;
insn |= value & 0x7ff;
- bfd_put_32 (output_bfd, insn, loc);
+ bfd_put_32 (input_bfd, insn, loc);
}
-
\f
/* Choose which PLT scheme to use, and set .plt flags appropriately.
Returns -1 on error, 0 for old PLT, 1 for new PLT. */
asection *got2;
bfd_vma *local_got_offsets;
bfd_boolean ret = TRUE;
- bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0);
+ bfd_vma d_offset = (bfd_big_endian (input_bfd) ? 2 : 0);
bfd_boolean is_vxworks_tls;
unsigned int picfixup_size = 0;
struct ppc_elf_relax_info *relax_info = NULL;
{
bfd_vma insn;
- insn = bfd_get_32 (output_bfd,
+ insn = bfd_get_32 (input_bfd,
contents + rel->r_offset - d_offset);
insn &= 31 << 21;
insn |= 0x3c020000; /* addis 0,2,0 */
- bfd_put_32 (output_bfd, insn,
+ bfd_put_32 (input_bfd, insn,
contents + rel->r_offset - d_offset);
r_type = R_PPC_TPREL16_HA;
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
{
bfd_vma insn;
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn = _bfd_elf_ppc_at_tls_transform (insn, 2);
if (insn == 0)
abort ();
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
r_type = R_PPC_TPREL16_LO;
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
else
{
rel->r_offset -= d_offset;
- bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, NOP, contents + rel->r_offset);
r_type = R_PPC_NONE;
}
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
the destination reg. It may be something other than
the usual r3, and moved to r3 before the call by
intervening code. */
- insn1 = bfd_get_32 (output_bfd,
+ insn1 = bfd_get_32 (input_bfd,
contents + rel->r_offset - d_offset);
if ((tls_mask & tls_gd) != 0)
{
{
rel[1].r_info = ELF32_R_INFO (STN_UNDEF, R_PPC_NONE);
insn2 = 0x7c631214; /* add 3,3,2 */
- bfd_put_32 (output_bfd, insn2, contents + offset);
+ bfd_put_32 (input_bfd, insn2, contents + offset);
}
r_type = (((r_type - (R_PPC_GOT_TLSGD16 & 3)) & 3)
+ R_PPC_GOT_TPREL16);
rel[1].r_offset = offset + d_offset;
rel[1].r_addend = rel->r_addend;
insn2 = 0x38630000; /* addi 3,3,0 */
- bfd_put_32 (output_bfd, insn2, contents + offset);
+ bfd_put_32 (input_bfd, insn2, contents + offset);
}
}
- bfd_put_32 (output_bfd, insn1,
+ bfd_put_32 (input_bfd, insn1,
contents + rel->r_offset - d_offset);
if (tls_gd == 0)
{
insn2 = 0x38630000; /* addi 3,3,0 */
}
rel->r_info = ELF32_R_INFO (r_symndx, r_type);
- bfd_put_32 (output_bfd, insn2, contents + offset);
+ bfd_put_32 (input_bfd, insn2, contents + offset);
/* Zap the reloc on the _tls_get_addr call too. */
BFD_ASSERT (offset == rel[1].r_offset);
rel[1].r_info = ELF32_R_INFO (STN_UNDEF, R_PPC_NONE);
rel->r_info = ELF32_R_INFO (r_symndx, R_PPC_TPREL16_LO);
rel->r_offset += d_offset;
insn2 = 0x38630000; /* addi 3,3,0 */
- bfd_put_32 (output_bfd, insn2,
+ bfd_put_32 (input_bfd, insn2,
contents + rel->r_offset - d_offset);
/* Zap the reloc on the _tls_get_addr call too. */
BFD_ASSERT (rel->r_offset - d_offset == rel[1].r_offset);
{
bfd_vma insn;
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn &= ~BRANCH_PREDICT_BIT;
insn |= branch_bit;
if ((bfd_signed_vma) (relocation + rel->r_addend - from) < 0)
insn ^= BRANCH_PREDICT_BIT;
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
break;
}
}
if (r_type == R_PPC_ADDR16_HA)
{
- insn = bfd_get_32 (output_bfd,
+ insn = bfd_get_32 (input_bfd,
contents + rel->r_offset - d_offset);
if ((insn & (0x3f << 26)) == (15u << 26)
&& (insn & (0x1f << 16)) == 0 /* lis */)
(_("%P: %H: fixup branch overflow\n"),
input_bfd, input_section, rel->r_offset);
- bfd_put_32 (output_bfd, B | off,
+ bfd_put_32 (input_bfd, B | off,
contents + rel->r_offset - d_offset);
got_addr = (htab->got->output_section->vma
+ htab->got->output_offset
wrel->r_addend = got_addr;
insn &= ~0xffff;
insn |= ((unsigned int )(got_addr + 0x8000) >> 16) & 0xffff;
- bfd_put_32 (output_bfd, insn, p);
+ bfd_put_32 (input_bfd, insn, p);
/* Convert lis to lwz, loading address from GOT. */
insn &= ~0xffff;
insn ^= (32u ^ 15u) << 26;
insn |= (insn & (0x1f << 21)) >> 5;
insn |= got_addr & 0xffff;
- bfd_put_32 (output_bfd, insn, p + 4);
+ bfd_put_32 (input_bfd, insn, p + 4);
- bfd_put_32 (output_bfd, B | ((-4 - off) & 0x3ffffff), p + 8);
+ bfd_put_32 (input_bfd, B | ((-4 - off) & 0x3ffffff), p + 8);
picfixup_size += 12;
/* Use one of the spare relocs, so --emit-relocs
}
else if (r_type == R_PPC_ADDR16_LO)
{
- insn = bfd_get_32 (output_bfd,
+ insn = bfd_get_32 (input_bfd,
contents + rel->r_offset - d_offset);
if ((insn & (0x3f << 26)) == 14u << 26 /* addi */
|| (insn & (0x3f << 26)) == 32u << 26 /* lwz */
if (tls_ty == (TLS_TLS | TLS_GD))
{
- bfd_put_32 (output_bfd, value,
+ bfd_put_32 (input_bfd, value,
htab->got->contents + off + 4);
value = 1;
}
}
- bfd_put_32 (output_bfd, value,
+ bfd_put_32 (input_bfd, value,
htab->got->contents + off);
}
code using weak externs ought to check that they are
defined before using them. */
bfd_byte *p = contents + rel->r_offset - d_offset;
- unsigned int insn = bfd_get_32 (output_bfd, p);
+ unsigned int insn = bfd_get_32 (input_bfd, p);
insn = _bfd_elf_ppc_at_tprel_transform (insn, 2);
if (insn != 0)
- bfd_put_32 (output_bfd, insn, p);
+ bfd_put_32 (input_bfd, insn, p);
break;
}
if (htab->elf.tls_sec != NULL)
+ input_section->output_offset
+ rel->r_offset - 4);
stub = shared_stub_entry;
- bfd_put_32 (output_bfd, stub[0], contents + insn_offset - 12);
- bfd_put_32 (output_bfd, stub[1], contents + insn_offset - 8);
- bfd_put_32 (output_bfd, stub[2], contents + insn_offset - 4);
+ bfd_put_32 (input_bfd, stub[0], contents + insn_offset - 12);
+ bfd_put_32 (input_bfd, stub[1], contents + insn_offset - 8);
+ bfd_put_32 (input_bfd, stub[2], contents + insn_offset - 4);
stub += 3;
size = ARRAY_SIZE (shared_stub_entry) - 3;
}
/* First insn is HA, second is LO. */
insn = *stub++;
insn |= ((relocation + 0x8000) >> 16) & 0xffff;
- bfd_put_32 (output_bfd, insn, contents + insn_offset);
+ bfd_put_32 (input_bfd, insn, contents + insn_offset);
insn_offset += 4;
insn = *stub++;
insn |= relocation & 0xffff;
- bfd_put_32 (output_bfd, insn, contents + insn_offset);
+ bfd_put_32 (input_bfd, insn, contents + insn_offset);
insn_offset += 4;
size -= 2;
{
insn = *stub++;
--size;
- bfd_put_32 (output_bfd, insn, contents + insn_offset);
+ bfd_put_32 (input_bfd, insn, contents + insn_offset);
insn_offset += 4;
}
case R_PPC_VLE_LO16A:
relocation = relocation + addend;
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
relocation, split16a_type);
goto copy_reloc;
case R_PPC_VLE_LO16D:
relocation = relocation + addend;
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
relocation, split16d_type);
goto copy_reloc;
case R_PPC_VLE_HI16A:
relocation = (relocation + addend) >> 16;
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
relocation, split16a_type);
goto copy_reloc;
case R_PPC_VLE_HI16D:
relocation = (relocation + addend) >> 16;
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
relocation, split16d_type);
goto copy_reloc;
case R_PPC_VLE_HA16A:
relocation = (relocation + addend + 0x8000) >> 16;
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
relocation, split16a_type);
goto copy_reloc;
case R_PPC_VLE_HA16D:
relocation = (relocation + addend + 0x8000) >> 16;
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
relocation, split16d_type);
goto copy_reloc;
addend -= SYM_VAL (sda);
}
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
if (reg == 0
&& (r_type == R_PPC_VLE_SDA21
|| r_type == R_PPC_VLE_SDA21_LO))
/* And the final 11 bits of the value to bits 21 to 31. */
insn |= relocation & 0x7ff;
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
if (r_type == R_PPC_VLE_SDA21
&& ((relocation + 0x80000) & 0xffffffff) > 0x100000)
/* Fill in register field. */
insn = (insn & ~RA_REGISTER_MASK) | (reg << RA_REGISTER_SHIFT);
}
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
}
break;
+ addend);
if (r_type == R_PPC_VLE_SDAREL_LO16A)
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
value, split16a_type);
else if (r_type == R_PPC_VLE_SDAREL_LO16D)
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
value, split16d_type);
else if (r_type == R_PPC_VLE_SDAREL_HI16A)
{
value = value >> 16;
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
value, split16a_type);
}
else if (r_type == R_PPC_VLE_SDAREL_HI16D)
{
value = value >> 16;
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
value, split16d_type);
}
else if (r_type == R_PPC_VLE_SDAREL_HA16A)
{
value = (value + 0x8000) >> 16;
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
value, split16a_type);
}
else if (r_type == R_PPC_VLE_SDAREL_HA16D)
{
value = (value + 0x8000) >> 16;
- ppc_elf_vle_split16 (output_bfd, contents + rel->r_offset,
+ ppc_elf_vle_split16 (input_bfd, contents + rel->r_offset,
value, split16d_type);
}
}
that make up part of the insn opcode. */
unsigned int insn, mask, lobit;
- insn = bfd_get_32 (output_bfd,
+ insn = bfd_get_32 (input_bfd,
contents + rel->r_offset - d_offset);
mask = 0;
if (is_insn_ds_form (insn))
bfd_boolean is_opd;
/* Assume 'at' branch hints. */
bfd_boolean is_isa_v2 = TRUE;
- bfd_vma d_offset = (bfd_big_endian (output_bfd) ? 2 : 0);
+ bfd_vma d_offset = (bfd_big_endian (input_bfd) ? 2 : 0);
/* Initialize howto table if needed. */
if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
break;
case R_PPC64_LO_DS_OPT:
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset - d_offset);
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset - d_offset);
if ((insn & (0x3f << 26)) != 58u << 26)
abort ();
insn += (14u << 26) - (58u << 26);
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset - d_offset);
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset - d_offset);
r_type = R_PPC64_TOC16_LO;
rel->r_info = ELF64_R_INFO (r_symndx, r_type);
break;
&& (tls_mask & TLS_TPREL) == 0)
{
rel->r_offset -= d_offset;
- bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, NOP, contents + rel->r_offset);
r_type = R_PPC64_NONE;
rel->r_info = ELF64_R_INFO (r_symndx, r_type);
}
&& (tls_mask & TLS_TPREL) == 0)
{
toctprel:
- insn = bfd_get_32 (output_bfd,
+ insn = bfd_get_32 (input_bfd,
contents + rel->r_offset - d_offset);
insn &= 31 << 21;
insn |= 0x3c0d0000; /* addis 0,13,0 */
- bfd_put_32 (output_bfd, insn,
+ bfd_put_32 (input_bfd, insn,
contents + rel->r_offset - d_offset);
r_type = R_PPC64_TPREL16_HA;
if (toc_symndx != 0)
if (tls_mask != 0
&& (tls_mask & TLS_TPREL) == 0)
{
- insn = bfd_get_32 (output_bfd, contents + rel->r_offset);
+ insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn = _bfd_elf_ppc_at_tls_transform (insn, 13);
if (insn == 0)
abort ();
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
/* Was PPC64_TLS which sits on insn boundary, now
PPC64_TPREL16_LO which is at low-order half-word. */
rel->r_offset += d_offset;
else
{
rel->r_offset -= d_offset;
- bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, NOP, contents + rel->r_offset);
r_type = R_PPC64_NONE;
}
rel->r_info = ELF64_R_INFO (r_symndx, r_type);
need to keep the destination reg. It may be
something other than the usual r3, and moved to r3
before the call by intervening code. */
- insn1 = bfd_get_32 (output_bfd,
+ insn1 = bfd_get_32 (input_bfd,
contents + rel->r_offset - d_offset);
if ((tls_mask & tls_gd) != 0)
{
rel[1].r_addend = rel->r_addend;
}
}
- bfd_put_32 (output_bfd, insn1,
+ bfd_put_32 (input_bfd, insn1,
contents + rel->r_offset - d_offset);
if (offset != (bfd_vma) -1)
{
- insn3 = bfd_get_32 (output_bfd,
+ insn3 = bfd_get_32 (input_bfd,
contents + offset + 4);
if (insn3 == NOP
|| insn3 == CROR_151515 || insn3 == CROR_313131)
{
rel[1].r_offset += 4;
- bfd_put_32 (output_bfd, insn2, contents + offset + 4);
+ bfd_put_32 (input_bfd, insn2, contents + offset + 4);
insn2 = NOP;
}
- bfd_put_32 (output_bfd, insn2, contents + offset);
+ bfd_put_32 (input_bfd, insn2, contents + offset);
}
if ((tls_mask & tls_gd) == 0
&& (tls_gd == 0 || toc_symndx != 0))
/* Zap the reloc on the _tls_get_addr call too. */
BFD_ASSERT (offset == rel[1].r_offset);
rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE);
- insn3 = bfd_get_32 (output_bfd,
+ insn3 = bfd_get_32 (input_bfd,
contents + offset + 4);
if (insn3 == NOP
|| insn3 == CROR_151515 || insn3 == CROR_313131)
{
rel->r_offset += 4;
- bfd_put_32 (output_bfd, insn2, contents + offset + 4);
+ bfd_put_32 (input_bfd, insn2, contents + offset + 4);
insn2 = NOP;
}
- bfd_put_32 (output_bfd, insn2, contents + offset);
+ bfd_put_32 (input_bfd, insn2, contents + offset);
if ((tls_mask & TLS_TPRELGD) == 0 && toc_symndx != 0)
goto again;
}
BFD_ASSERT (offset == rel[1].r_offset);
rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE);
insn2 = 0x38630000; /* addi 3,3,0 */
- insn3 = bfd_get_32 (output_bfd,
+ insn3 = bfd_get_32 (input_bfd,
contents + offset + 4);
if (insn3 == NOP
|| insn3 == CROR_151515 || insn3 == CROR_313131)
{
rel->r_offset += 4;
- bfd_put_32 (output_bfd, insn2, contents + offset + 4);
+ bfd_put_32 (input_bfd, insn2, contents + offset + 4);
insn2 = NOP;
}
- bfd_put_32 (output_bfd, insn2, contents + offset);
+ bfd_put_32 (input_bfd, insn2, contents + offset);
goto again;
}
break;
if ((insn1 & ~0xfffc) == LD_R2_0R12
&& insn2 == ADD_R2_R2_R12)
{
- bfd_put_32 (output_bfd,
+ bfd_put_32 (input_bfd,
LIS_R2 + PPC_HA (relocation),
contents + rel->r_offset);
- bfd_put_32 (output_bfd,
+ bfd_put_32 (input_bfd,
ADDI_R2_R2 + PPC_LO (relocation),
contents + rel->r_offset + 4);
}
if ((insn1 & ~0xfffc) == LD_R2_0R12
&& insn2 == ADD_R2_R2_R12)
{
- bfd_put_32 (output_bfd,
+ bfd_put_32 (input_bfd,
ADDIS_R2_R12 + PPC_HA (relocation),
contents + rel->r_offset);
- bfd_put_32 (output_bfd,
+ bfd_put_32 (input_bfd,
ADDI_R2_R2 + PPC_LO (relocation),
contents + rel->r_offset + 4);
}
{
unsigned int insn1, insn2;
bfd_vma offset = rel->r_offset - d_offset;
- insn1 = bfd_get_32 (output_bfd, contents + offset);
- insn2 = bfd_get_32 (output_bfd, contents + offset + 4);
+ insn1 = bfd_get_32 (input_bfd, contents + offset);
+ insn2 = bfd_get_32 (input_bfd, contents + offset + 4);
if ((insn1 & 0xffff0000) == ADDIS_R2_R12
&& (insn2 & 0xffff0000) == ADDI_R2_R2)
{
rel->r_addend -= d_offset;
rel[1].r_info = ELF64_R_INFO (r_symndx, R_PPC64_ADDR16_LO);
rel[1].r_addend -= d_offset + 4;
- bfd_put_32 (output_bfd, LIS_R2, contents + offset);
+ bfd_put_32 (input_bfd, LIS_R2, contents + offset);
}
}
break;
/* Branch not taken prediction relocations. */
case R_PPC64_ADDR14_BRNTAKEN:
case R_PPC64_REL14_BRNTAKEN:
- insn |= bfd_get_32 (output_bfd,
+ insn |= bfd_get_32 (input_bfd,
contents + rel->r_offset) & ~(0x01 << 21);
/* Fall through. */
insn ^= 0x01 << 21;
}
- bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
}
/* NOP out calls to undefined weak functions.
&& relocation == 0
&& addend == 0)
{
- bfd_put_32 (output_bfd, NOP, contents + rel->r_offset);
+ bfd_put_32 (input_bfd, NOP, contents + rel->r_offset);
goto copy_reloc;
}
break;
defined before using them. */
bfd_byte *p = contents + rel->r_offset - d_offset;
- insn = bfd_get_32 (output_bfd, p);
+ insn = bfd_get_32 (input_bfd, p);
insn = _bfd_elf_ppc_at_tprel_transform (insn, 13);
if (insn != 0)
- bfd_put_32 (output_bfd, insn, p);
+ bfd_put_32 (input_bfd, insn, p);
break;
}
if (htab->elf.tls_sec != NULL)