From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29034 invoked by alias); 11 Aug 2012 13:24:26 -0000 Received: (qmail 29023 invoked by uid 22791); 11 Aug 2012 13:24:23 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_99,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_LR,TW_LW,TW_WZ X-Spam-Check-By: sourceware.org Received: from mail-pb0-f41.google.com (HELO mail-pb0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 11 Aug 2012 13:24:09 +0000 Received: by pbbro12 with SMTP id ro12so4880161pbb.0 for ; Sat, 11 Aug 2012 06:24:08 -0700 (PDT) Received: by 10.68.129.73 with SMTP id nu9mr5601927pbb.59.1344691448805; Sat, 11 Aug 2012 06:24:08 -0700 (PDT) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id nu5sm1390222pbb.53.2012.08.11.06.24.05 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 11 Aug 2012 06:24:07 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 06178EA31B1; Sat, 11 Aug 2012 22:54:01 +0930 (CST) Date: Sat, 11 Aug 2012 14:17:00 -0000 From: Alan Modra To: Ian Lance Taylor , binutils@sourceware.org Subject: Re: powerpc gold work in progress Message-ID: <20120811132401.GD5588@bubble.grove.modra.org> Mail-Followup-To: Ian Lance Taylor , binutils@sourceware.org References: <20120809132716.GB30412@bubble.grove.modra.org> <20120810131816.GA5588@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120810131816.GA5588@bubble.grove.modra.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00200.txt.bz2 Formatting fixes to bring powerpc.cc in line with other gold sources, some other minor changes, and a bug fix Output_data_glink::add_entry. In http://sourceware.org/ml/binutils/2012-08/msg00188.html I said that support for ppc32 -fPIC shared libs and pies was missing. That wasn't true. It's there but wasn't working due to the add_entry bug. OK to apply? * powerpc.cc: Whitespace fixes. Wrap overly long lines. (glink insn constants): Make them uint32_t. (Output_data_glink::add_entry): Use insert, not [] operator. Index: gold/powerpc.cc =================================================================== RCS file: /cvs/src/src/gold/powerpc.cc,v retrieving revision 1.45 diff -u -p -r1.45 powerpc.cc --- gold/powerpc.cc 11 Aug 2012 04:41:28 -0000 1.45 +++ gold/powerpc.cc 11 Aug 2012 12:53:22 -0000 @@ -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 O // 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 O // 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 -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::Out template 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_ 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_g 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::optimi 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:: 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:: 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:: 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:: 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:: 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_pro 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_fin 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::Reloca 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::Reloca 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::reloca 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, -- Alan Modra Australia Development Lab, IBM