// Return whether SYM is defined by the ABI.
bool
- do_is_defined_by_abi(Symbol* sym) const
+ do_is_defined_by_abi(const Symbol* sym) const
{
return strcmp(sym->name(), "___tls_get_addr") == 0;
}
// Copy a relocation against a global symbol.
void
- copy_reloc(Symbol_table* symtab, Layout* layout, Relobj* object,
+ copy_reloc(Symbol_table* symtab, Layout* layout,
+ Sized_relobj<size, big_endian>* object,
unsigned int shndx, Output_section* output_section,
Symbol* sym, const elfcpp::Rela<size, big_endian>& reloc)
{
typename elfcpp::Elf_types<size>::Elf_Addr value,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
- typedef typename elfcpp::Swap<16, true>::Valtype Valtype;
- Valtype* wv = reinterpret_cast<Valtype*>(view);
- Valtype val = elfcpp::Swap<16, true>::readval(wv);
typename elfcpp::Elf_types<size>::Elf_Addr reloc;
reloc = value + addend;
reloc += 0x10000;
reloc >>= 16;
- val &= ~0xffff;
- reloc &= 0xffff;
-
- elfcpp::Swap<16, true>::writeval(wv, val | reloc);
+ elfcpp::Swap<16, big_endian>::writeval(view, reloc);
}
static inline void
const Symbol_value<size>* psymval,
typename elfcpp::Elf_types<size>::Elf_Addr addend)
{
- typedef typename elfcpp::Swap<16, true>::Valtype Valtype;
- Valtype* wv = reinterpret_cast<Valtype*>(view);
- Valtype val = elfcpp::Swap<16, true>::readval(wv);
typename elfcpp::Elf_types<size>::Elf_Addr reloc;
reloc = psymval->value(object, addend);
reloc += 0x10000;
reloc >>= 16;
- val &= ~0xffff;
- reloc &= 0xffff;
-
- elfcpp::Swap<16, true>::writeval(wv, val | reloc);
+ elfcpp::Swap<16, big_endian>::writeval(view, reloc);
}
// R_PPC_REL16: (Symbol + Addend - Address) & 0xffff
reloc += 0x10000;
reloc >>= 16;
- val &= ~0xffff;
- reloc &= 0xffff;
+ val &= ~static_cast<Valtype>(0xffff);
+ reloc &= static_cast<Valtype>(0xffff);
elfcpp::Swap<16, true>::writeval(wv, val | reloc);
}
lwz_11_30 + plt_offset);
elfcpp::Swap<32, true>::writeval(pov + 0x04, mtctr_11);
elfcpp::Swap<32, true>::writeval(pov + 0x08, bctr);
- elfcpp::Swap<32, true>::writeval(pov + 0x0b, nop);
+ elfcpp::Swap<32, true>::writeval(pov + 0x0c, nop);
pov += base_plt_entry_size;
plt_offset += base_plt_entry_size;
}
// Pick the value to use for symbols defined in shared objects.
Symbol_value<size> symval;
if (gsym != NULL
- && (gsym->is_from_dynobj()
- || (parameters->options().shared()
- && (gsym->is_undefined() || gsym->is_preemptible())))
- && gsym->has_plt_offset())
+ && gsym->use_plt_offset(r_type == elfcpp::R_POWERPC_REL24
+ || r_type == elfcpp::R_PPC_LOCAL24PC
+ || r_type == elfcpp::R_PPC_REL16
+ || r_type == elfcpp::R_PPC_REL16_LO
+ || r_type == elfcpp::R_PPC_REL16_HI
+ || r_type == elfcpp::R_PPC_REL16_HA))
{
elfcpp::Elf_Xword value;