* powerpc.cc: Whitespace fixes. Wrap overly long lines.

(glink insn constants): Use uint32_t.
	(Output_data_glink::add_entry): Use insert, not [] operator.
This commit is contained in:
Alan Modra 2012-08-12 03:07:32 +00:00
parent 2fec20e227
commit d83ce4e3cd
2 changed files with 169 additions and 156 deletions

View File

@ -1,3 +1,9 @@
2012-08-12 Alan Modra <amodra@gmail.com>
* powerpc.cc: Whitespace fixes. Wrap overly long lines.
(glink insn constants): Use uint32_t.
(Output_data_glink::add_entry): Use insert, not [] operator.
2012-08-11 Alan Modra <amodra@gmail.com>
* object.h (Sized_relobj_file::find_shdr): New function.

View File

@ -95,7 +95,8 @@ template<int size, bool big_endian>
class Target_powerpc : public Sized_target<size, big_endian>
{
public:
typedef Output_data_reloc<elfcpp::SHT_RELA, true, size, big_endian> Reloc_section;
typedef
Output_data_reloc<elfcpp::SHT_RELA, true, size, big_endian> Reloc_section;
Target_powerpc()
: Sized_target<size, big_endian>(&powerpc_info),
@ -930,7 +931,10 @@ class Output_data_plt_powerpc : public Output_section_data_build
// Return the number of PLT entries.
unsigned int
entry_count() const
{ return (this->current_data_size() - initial_plt_entry_size) / plt_entry_size; }
{
return ((this->current_data_size() - initial_plt_entry_size)
/ plt_entry_size);
}
// Return the offset of the first non-reserved PLT entry.
static unsigned int
@ -968,7 +972,8 @@ class Output_data_plt_powerpc : public Output_section_data_build
// Create the PLT section.
template<int size, bool big_endian>
Output_data_plt_powerpc<size, big_endian>::Output_data_plt_powerpc(Layout* layout,
Output_data_plt_powerpc<size, big_endian>::Output_data_plt_powerpc(
Layout* layout,
Target_powerpc<size, big_endian>* targ)
: Output_section_data_build(size == 32 ? 4 : 8),
targ_(targ)
@ -999,45 +1004,45 @@ Output_data_plt_powerpc<size, big_endian>::add_entry(Symbol* gsym)
}
}
static const unsigned int addis_11_11 = 0x3d6b0000;
static const unsigned int addis_11_30 = 0x3d7e0000;
static const unsigned int addis_12_12 = 0x3d8c0000;
static const unsigned int addi_11_11 = 0x396b0000;
static const unsigned int add_0_11_11 = 0x7c0b5a14;
static const unsigned int add_11_0_11 = 0x7d605a14;
static const unsigned int b = 0x48000000;
static const unsigned int bcl_20_31 = 0x429f0005;
static const unsigned int bctr = 0x4e800420;
static const unsigned int blrl = 0x4e800021;
static const unsigned int lis_11 = 0x3d600000;
static const unsigned int lis_12 = 0x3d800000;
static const unsigned int lwzu_0_12 = 0x840c0000;
static const unsigned int lwz_0_12 = 0x800c0000;
static const unsigned int lwz_11_11 = 0x816b0000;
static const unsigned int lwz_11_30 = 0x817e0000;
static const unsigned int lwz_12_12 = 0x818c0000;
static const unsigned int mflr_0 = 0x7c0802a6;
static const unsigned int mflr_12 = 0x7d8802a6;
static const unsigned int mtctr_0 = 0x7c0903a6;
static const unsigned int mtctr_11 = 0x7d6903a6;
static const unsigned int mtlr_0 = 0x7c0803a6;
static const unsigned int nop = 0x60000000;
static const unsigned int sub_11_11_12 = 0x7d6c5850;
static const unsigned int addis_12_2 = 0x3d820000;
static const unsigned int std_2_1 = 0xf8410000;
static const unsigned int ld_11_12 = 0xe96c0000;
static const unsigned int ld_2_12 = 0xe84c0000;
static const unsigned int addi_12_12 = 0x398c0000;
static const unsigned int ld_11_2 = 0xe9620000;
static const unsigned int addi_2_2 = 0x38420000;
static const unsigned int ld_2_2 = 0xe8420000;
static const unsigned int mflr_11 = 0x7d6802a6;
static const unsigned int ld_2_11 = 0xe84b0000;
static const unsigned int mtlr_12 = 0x7d8803a6;
static const unsigned int add_12_2_11 = 0x7d825a14;
static const unsigned int li_0_0 = 0x38000000;
static const unsigned int lis_0_0 = 0x3c000000;
static const unsigned int ori_0_0_0 = 0x60000000;
static const uint32_t addis_11_11 = 0x3d6b0000;
static const uint32_t addis_11_30 = 0x3d7e0000;
static const uint32_t addis_12_12 = 0x3d8c0000;
static const uint32_t addi_11_11 = 0x396b0000;
static const uint32_t add_0_11_11 = 0x7c0b5a14;
static const uint32_t add_11_0_11 = 0x7d605a14;
static const uint32_t b = 0x48000000;
static const uint32_t bcl_20_31 = 0x429f0005;
static const uint32_t bctr = 0x4e800420;
static const uint32_t blrl = 0x4e800021;
static const uint32_t lis_11 = 0x3d600000;
static const uint32_t lis_12 = 0x3d800000;
static const uint32_t lwzu_0_12 = 0x840c0000;
static const uint32_t lwz_0_12 = 0x800c0000;
static const uint32_t lwz_11_11 = 0x816b0000;
static const uint32_t lwz_11_30 = 0x817e0000;
static const uint32_t lwz_12_12 = 0x818c0000;
static const uint32_t mflr_0 = 0x7c0802a6;
static const uint32_t mflr_12 = 0x7d8802a6;
static const uint32_t mtctr_0 = 0x7c0903a6;
static const uint32_t mtctr_11 = 0x7d6903a6;
static const uint32_t mtlr_0 = 0x7c0803a6;
static const uint32_t nop = 0x60000000;
static const uint32_t sub_11_11_12 = 0x7d6c5850;
static const uint32_t addis_12_2 = 0x3d820000;
static const uint32_t std_2_1 = 0xf8410000;
static const uint32_t ld_11_12 = 0xe96c0000;
static const uint32_t ld_2_12 = 0xe84c0000;
static const uint32_t addi_12_12 = 0x398c0000;
static const uint32_t ld_11_2 = 0xe9620000;
static const uint32_t addi_2_2 = 0x38420000;
static const uint32_t ld_2_2 = 0xe8420000;
static const uint32_t mflr_11 = 0x7d6802a6;
static const uint32_t ld_2_11 = 0xe84b0000;
static const uint32_t mtlr_12 = 0x7d8803a6;
static const uint32_t add_12_2_11 = 0x7d825a14;
static const uint32_t li_0_0 = 0x38000000;
static const uint32_t lis_0_0 = 0x3c000000;
static const uint32_t ori_0_0_0 = 0x60000000;
// Write out the PLT.
@ -1207,7 +1212,8 @@ class Output_data_glink : public Output_section_data
// Create the glink section.
template<int size, bool big_endian>
Output_data_glink<size, big_endian>::Output_data_glink(Target_powerpc<size, big_endian>* targ)
Output_data_glink<size, big_endian>::Output_data_glink(
Target_powerpc<size, big_endian>* targ)
: Output_section_data(16),
pltresolve_(0), targ_(targ)
{
@ -1218,21 +1224,21 @@ Output_data_glink<size, big_endian>::Output_data_glink(Target_powerpc<size, big_
template<int size, bool big_endian>
void
Output_data_glink<size, big_endian>
::add_entry(const Symbol* gsym,
Output_data_glink<size, big_endian>::add_entry(
const Symbol* gsym,
const elfcpp::Rela<size, big_endian>& reloc,
const Sized_relobj<size, big_endian>* object,
unsigned int shndx)
{
Glink_sym_ent ent(gsym, reloc, object, shndx);
unsigned int indx = this->glink_entries_.size();
this->glink_entries_[ent] = indx;
this->glink_entries_.insert(std::make_pair(ent, indx));
}
template<int size, bool big_endian>
unsigned int
Output_data_glink<size, big_endian>
::find_entry(const Symbol* gsym,
Output_data_glink<size, big_endian>::find_entry(
const Symbol* gsym,
const elfcpp::Rela<size, big_endian>& reloc,
const Sized_relobj<size, big_endian>* object,
unsigned int shndx) const
@ -1427,9 +1433,10 @@ Output_data_glink<size, big_endian>::do_write(Output_file* of)
p = oview + g->second * this->glink_entry_size();
if (parameters->options().output_is_position_independent())
{
if (g->first.shndx_)
got_addr = (g->first.object_->output_section(g->first.shndx_)->address()
+ g->first.object_->output_section_offset(g->first.shndx_)
unsigned int got2 = g->first.shndx_;
if (got2)
got_addr = (g->first.object_->output_section(got2)->address()
+ g->first.object_->output_section_offset(got2)
+ g->first.addend_);
else
got_addr = g_o_t;
@ -1554,7 +1561,8 @@ Target_powerpc<size, big_endian>::make_glink_section(Layout* layout)
template<int size, bool big_endian>
void
Target_powerpc<size, big_endian>::make_plt_entry(Layout* layout,
Target_powerpc<size, big_endian>::make_plt_entry(
Layout* layout,
Symbol* gsym,
const elfcpp::Rela<size, big_endian>& reloc,
const Sized_relobj<size, big_endian>* object)
@ -1650,8 +1658,7 @@ Target_powerpc<size, big_endian>::optimize_tls_reloc(bool, int)
template<int size, bool big_endian>
int
Target_powerpc<size, big_endian>::Scan::get_reference_flags(
unsigned int r_type)
Target_powerpc<size, big_endian>::Scan::get_reference_flags(unsigned int r_type)
{
switch (r_type)
{