From: Alan Modra Date: Sun, 12 Aug 2012 03:07:32 +0000 (+0000) Subject: * powerpc.cc: Whitespace fixes. Wrap overly long lines. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d83ce4e3cd2f601444de8d804452dda6e2e01b55;p=binutils-gdb.git * powerpc.cc: Whitespace fixes. Wrap overly long lines. (glink insn constants): Use uint32_t. (Output_data_glink::add_entry): Use insert, not [] operator. --- diff --git a/gold/ChangeLog b/gold/ChangeLog index 3fd2b4054d9..6a19d864741 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2012-08-12 Alan Modra + + * 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 * object.h (Sized_relobj_file::find_shdr): New function. diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 984696ef18b..ba6c257c593 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -95,7 +95,8 @@ template class Target_powerpc : public Sized_target { public: - typedef Output_data_reloc Reloc_section; + typedef + Output_data_reloc Reloc_section; Target_powerpc() : Sized_target(&powerpc_info), @@ -684,7 +685,7 @@ public: typename elfcpp::Elf_types::Elf_Addr value, typename elfcpp::Elf_types::Elf_Addr addend, typename elfcpp::Elf_types::Elf_Addr address) - { + { This::template rela<16>(view, 16, 0xffff, value - address, addend); } @@ -696,7 +697,7 @@ public: typename elfcpp::Elf_types::Elf_Addr value, typename elfcpp::Elf_types::Elf_Addr addend, typename elfcpp::Elf_types::Elf_Addr address) - { + { This::rel16_hi(view, value + 0x8000, addend, address); } }; @@ -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,8 +972,9 @@ class Output_data_plt_powerpc : public Output_section_data_build // Create the PLT section. template -Output_data_plt_powerpc::Output_data_plt_powerpc(Layout* layout, - Target_powerpc* targ) +Output_data_plt_powerpc::Output_data_plt_powerpc( + Layout* layout, + Target_powerpc* targ) : Output_section_data_build(size == 32 ? 4 : 8), targ_(targ) { @@ -999,45 +1004,45 @@ Output_data_plt_powerpc::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 -Output_data_glink::Output_data_glink(Target_powerpc* targ) +Output_data_glink::Output_data_glink( + Target_powerpc* targ) : Output_section_data(16), pltresolve_(0), targ_(targ) { @@ -1218,24 +1224,24 @@ Output_data_glink::Output_data_glink(Target_powerpc void -Output_data_glink -::add_entry(const Symbol* gsym, - const elfcpp::Rela& reloc, - const Sized_relobj* object, - unsigned int shndx) +Output_data_glink::add_entry( + const Symbol* gsym, + const elfcpp::Rela& reloc, + const Sized_relobj* 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 unsigned int -Output_data_glink -::find_entry(const Symbol* gsym, - const elfcpp::Rela& reloc, - const Sized_relobj* object, - unsigned int shndx) const +Output_data_glink::find_entry( + const Symbol* gsym, + const elfcpp::Rela& reloc, + const Sized_relobj* object, + unsigned int shndx) const { Glink_sym_ent ent(gsym, reloc, object, shndx); typename Glink_entries::const_iterator p = this->glink_entries_.find(ent); @@ -1427,9 +1433,10 @@ Output_data_glink::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,10 +1561,11 @@ Target_powerpc::make_glink_section(Layout* layout) template void -Target_powerpc::make_plt_entry(Layout* layout, - Symbol* gsym, - const elfcpp::Rela& reloc, - const Sized_relobj* object) +Target_powerpc::make_plt_entry( + Layout* layout, + Symbol* gsym, + const elfcpp::Rela& reloc, + const Sized_relobj* object) { if (this->plt_ == NULL) this->make_plt_section(layout); @@ -1650,8 +1658,7 @@ Target_powerpc::optimize_tls_reloc(bool, int) template int -Target_powerpc::Scan::get_reference_flags( - unsigned int r_type) +Target_powerpc::Scan::get_reference_flags(unsigned int r_type) { switch (r_type) { @@ -1714,8 +1721,8 @@ Target_powerpc::Scan::get_reference_flags( template void Target_powerpc::Scan::unsupported_reloc_local( - Sized_relobj_file* object, - unsigned int r_type) + Sized_relobj_file* object, + unsigned int r_type) { gold_error(_("%s: unsupported reloc %u against local symbol"), object->name().c_str(), r_type); @@ -1819,15 +1826,15 @@ Target_powerpc::Scan::check_non_pic(Relobj* object, template inline void Target_powerpc::Scan::local( - Symbol_table* symtab, - Layout* layout, - Target_powerpc* target, - Sized_relobj_file* object, - unsigned int data_shndx, - Output_section* output_section, - const elfcpp::Rela& reloc, - unsigned int r_type, - const elfcpp::Sym& lsym) + Symbol_table* symtab, + Layout* layout, + Target_powerpc* target, + Sized_relobj_file* object, + unsigned int data_shndx, + Output_section* output_section, + const elfcpp::Rela& reloc, + unsigned int r_type, + const elfcpp::Sym& lsym) { switch (r_type) { @@ -1940,9 +1947,9 @@ Target_powerpc::Scan::local( template void Target_powerpc::Scan::unsupported_reloc_global( - Sized_relobj_file* object, - unsigned int r_type, - Symbol* gsym) + Sized_relobj_file* object, + unsigned int r_type, + Symbol* gsym) { gold_error(_("%s: unsupported reloc %u against global symbol %s"), object->name().c_str(), r_type, gsym->demangled_name().c_str()); @@ -1953,15 +1960,15 @@ Target_powerpc::Scan::unsupported_reloc_global( template inline void Target_powerpc::Scan::global( - Symbol_table* symtab, - Layout* layout, - Target_powerpc* target, - Sized_relobj_file* object, - unsigned int data_shndx, - Output_section* output_section, - const elfcpp::Rela& reloc, - unsigned int r_type, - Symbol* gsym) + Symbol_table* symtab, + Layout* layout, + Target_powerpc* target, + Sized_relobj_file* object, + unsigned int data_shndx, + Output_section* output_section, + const elfcpp::Rela& reloc, + unsigned int r_type, + Symbol* gsym) { switch (r_type) { @@ -2143,17 +2150,17 @@ Target_powerpc::Scan::global( template void Target_powerpc::gc_process_relocs( - Symbol_table* symtab, - Layout* layout, - Sized_relobj_file* object, - unsigned int data_shndx, - unsigned int, - const unsigned char* prelocs, - size_t reloc_count, - Output_section* output_section, - bool needs_special_offset_handling, - size_t local_symbol_count, - const unsigned char* plocal_symbols) + Symbol_table* symtab, + Layout* layout, + Sized_relobj_file* object, + unsigned int data_shndx, + unsigned int, + const unsigned char* prelocs, + size_t reloc_count, + Output_section* output_section, + bool needs_special_offset_handling, + size_t local_symbol_count, + const unsigned char* plocal_symbols) { typedef Target_powerpc Powerpc; typedef typename Target_powerpc::Scan Scan; @@ -2178,17 +2185,17 @@ Target_powerpc::gc_process_relocs( template void Target_powerpc::scan_relocs( - Symbol_table* symtab, - Layout* layout, - Sized_relobj_file* object, - unsigned int data_shndx, - unsigned int sh_type, - const unsigned char* prelocs, - size_t reloc_count, - Output_section* output_section, - bool needs_special_offset_handling, - size_t local_symbol_count, - const unsigned char* plocal_symbols) + Symbol_table* symtab, + Layout* layout, + Sized_relobj_file* object, + unsigned int data_shndx, + unsigned int sh_type, + const unsigned char* prelocs, + size_t reloc_count, + Output_section* output_section, + bool needs_special_offset_handling, + size_t local_symbol_count, + const unsigned char* plocal_symbols) { typedef Target_powerpc Powerpc; typedef typename Target_powerpc::Scan Scan; @@ -2271,17 +2278,17 @@ Target_powerpc::do_finalize_sections( template inline bool Target_powerpc::Relocate::relocate( - const Relocate_info* relinfo, - Target_powerpc* target, - Output_section* os, - size_t relnum, - const elfcpp::Rela& rela, - unsigned int r_type, - const Sized_symbol* gsym, - const Symbol_value* psymval, - unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr address, - section_size_type /* view_size */) + const Relocate_info* relinfo, + Target_powerpc* target, + Output_section* os, + size_t relnum, + const elfcpp::Rela& rela, + unsigned int r_type, + const Sized_symbol* gsym, + const Symbol_value* psymval, + unsigned char* view, + typename elfcpp::Elf_types::Elf_Addr address, + section_size_type /* view_size */) { const unsigned int toc_base_offset = 0x8000; typedef Powerpc_relocate_functions Reloc; @@ -2469,16 +2476,16 @@ Target_powerpc::Relocate::relocate( template inline void Target_powerpc::Relocate::relocate_tls( - const Relocate_info* relinfo, - Target_powerpc* target, - size_t relnum, - const elfcpp::Rela& rela, - unsigned int r_type, - const Sized_symbol* gsym, - const Symbol_value* psymval, - unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr address, - section_size_type) + const Relocate_info* relinfo, + Target_powerpc* target, + size_t relnum, + const elfcpp::Rela& rela, + unsigned int r_type, + const Sized_symbol* gsym, + const Symbol_value* psymval, + unsigned char* view, + typename elfcpp::Elf_types::Elf_Addr address, + section_size_type) { Output_segment* tls_segment = relinfo->layout->tls_segment(); const Sized_relobj_file* object = relinfo->object; @@ -2502,16 +2509,16 @@ Target_powerpc::Relocate::relocate_tls( template void Target_powerpc::relocate_section( - const Relocate_info* relinfo, - unsigned int sh_type, - const unsigned char* prelocs, - size_t reloc_count, - Output_section* output_section, - bool needs_special_offset_handling, - unsigned char* view, - typename elfcpp::Elf_types::Elf_Addr address, - section_size_type view_size, - const Reloc_symbol_changes* reloc_symbol_changes) + const Relocate_info* relinfo, + unsigned int sh_type, + const unsigned char* prelocs, + size_t reloc_count, + Output_section* output_section, + bool needs_special_offset_handling, + unsigned char* view, + typename elfcpp::Elf_types::Elf_Addr address, + section_size_type view_size, + const Reloc_symbol_changes* reloc_symbol_changes) { typedef Target_powerpc Powerpc; typedef typename Target_powerpc::Relocate Powerpc_relocate; @@ -2519,7 +2526,7 @@ Target_powerpc::relocate_section( gold_assert(sh_type == elfcpp::SHT_RELA); gold::relocate_section( + Powerpc_relocate>( relinfo, this, prelocs, @@ -2569,23 +2576,23 @@ public: template void Target_powerpc::scan_relocatable_relocs( - Symbol_table* symtab, - Layout* layout, - Sized_relobj_file* object, - unsigned int data_shndx, - unsigned int sh_type, - const unsigned char* prelocs, - size_t reloc_count, - Output_section* output_section, - bool needs_special_offset_handling, - size_t local_symbol_count, - const unsigned char* plocal_symbols, - Relocatable_relocs* rr) + Symbol_table* symtab, + Layout* layout, + Sized_relobj_file* object, + unsigned int data_shndx, + unsigned int sh_type, + const unsigned char* prelocs, + size_t reloc_count, + Output_section* output_section, + bool needs_special_offset_handling, + size_t local_symbol_count, + const unsigned char* plocal_symbols, + Relocatable_relocs* rr) { gold_assert(sh_type == elfcpp::SHT_RELA); gold::scan_relocatable_relocs( + Powerpc_scan_relocatable_reloc>( symtab, layout, object,