This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[GOLD] powerpc .got section for call stubs and glink


Output_data_glink::do_write() needs a .got section, so make one
when the .plt section is created.  Committed.

	* powerpc.cc (Target_powerpc::make_plt_section): Add symtab
	param.  Call got_section() to make .got.  Update all callers
	and their callers and so on.

Index: gold/powerpc.cc
===================================================================
RCS file: /cvs/src/src/gold/powerpc.cc,v
retrieving revision 1.69
diff -u -p -r1.69 powerpc.cc
--- gold/powerpc.cc	30 Nov 2012 04:47:08 -0000	1.69
+++ gold/powerpc.cc	30 Nov 2012 04:48:23 -0000
@@ -711,20 +711,20 @@ class Target_powerpc : public Sized_targ
 
   // Create the PLT section.
   void
-  make_plt_section(Layout*);
+  make_plt_section(Symbol_table*, Layout*);
 
   void
-  make_iplt_section(Layout*);
+  make_iplt_section(Symbol_table*, Layout*);
 
   // Create a PLT entry for a global symbol.
   void
-  make_plt_entry(Layout*, Symbol*,
+  make_plt_entry(Symbol_table*, Layout*, Symbol*,
 		 const elfcpp::Rela<size, big_endian>&,
 		 const Sized_relobj_file<size, big_endian>* object);
 
   // Create a PLT entry for a local IFUNC symbol.
   void
-  make_local_ifunc_plt_entry(Layout*,
+  make_local_ifunc_plt_entry(Symbol_table*, Layout*,
 			     const elfcpp::Rela<size, big_endian>&,
 			     Sized_relobj_file<size, big_endian>*);
 
@@ -1885,10 +1885,14 @@ Output_data_plt_powerpc<size, big_endian
 
 template<int size, bool big_endian>
 void
-Target_powerpc<size, big_endian>::make_plt_section(Layout* layout)
+Target_powerpc<size, big_endian>::make_plt_section(Symbol_table* symtab,
+						   Layout* layout)
 {
   if (this->plt_ == NULL)
     {
+      if (this->got_ == NULL)
+	this->got_section(symtab, layout);
+
       if (this->glink_ == NULL)
 	make_glink_section(layout);
 
@@ -1922,11 +1926,12 @@ Target_powerpc<size, big_endian>::make_p
 
 template<int size, bool big_endian>
 void
-Target_powerpc<size, big_endian>::make_iplt_section(Layout* layout)
+Target_powerpc<size, big_endian>::make_iplt_section(Symbol_table* symtab,
+						    Layout* layout)
 {
   if (this->iplt_ == NULL)
     {
-      this->make_plt_section(layout);
+      this->make_plt_section(symtab, layout);
 
       Reloc_section* iplt_rel = new Reloc_section(false);
       this->rela_dyn_->output_section()->add_output_section_data(iplt_rel);
@@ -2872,6 +2877,7 @@ Target_powerpc<size, big_endian>::make_g
 template<int size, bool big_endian>
 void
 Target_powerpc<size, big_endian>::make_plt_entry(
+    Symbol_table* symtab,
     Layout* layout,
     Symbol* gsym,
     const elfcpp::Rela<size, big_endian>& reloc,
@@ -2881,13 +2887,13 @@ Target_powerpc<size, big_endian>::make_p
       && gsym->can_use_relative_reloc(false))
     {
       if (this->iplt_ == NULL)
-	this->make_iplt_section(layout);
+	this->make_iplt_section(symtab, layout);
       this->iplt_->add_ifunc_entry(gsym);
     }
   else
     {
       if (this->plt_ == NULL)
-	this->make_plt_section(layout);
+	this->make_plt_section(symtab, layout);
       this->plt_->add_entry(gsym);
     }
   this->glink_->add_entry(object, gsym, reloc);
@@ -2898,12 +2904,13 @@ Target_powerpc<size, big_endian>::make_p
 template<int size, bool big_endian>
 void
 Target_powerpc<size, big_endian>::make_local_ifunc_plt_entry(
+    Symbol_table* symtab,
     Layout* layout,
     const elfcpp::Rela<size, big_endian>& reloc,
     Sized_relobj_file<size, big_endian>* relobj)
 {
   if (this->iplt_ == NULL)
-    this->make_iplt_section(layout);
+    this->make_iplt_section(symtab, layout);
   unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info());
   this->iplt_->add_local_ifunc_entry(relobj, r_sym);
   this->glink_->add_entry(relobj, r_sym, reloc);
@@ -3256,7 +3263,9 @@ Target_powerpc<size, big_endian>::Scan::
   // A local STT_GNU_IFUNC symbol may require a PLT entry.
   bool is_ifunc = lsym.get_st_type() == elfcpp::STT_GNU_IFUNC;
   if (is_ifunc && this->reloc_needs_plt_for_ifunc(object, r_type))
-    target->make_local_ifunc_plt_entry(layout, reloc, object);
+    {
+      target->make_local_ifunc_plt_entry(symtab, layout, reloc, object);
+    }
 
   switch (r_type)
     {
@@ -3566,7 +3575,7 @@ Target_powerpc<size, big_endian>::Scan::
   // A STT_GNU_IFUNC symbol may require a PLT entry.
   if (gsym->type() == elfcpp::STT_GNU_IFUNC
       && this->reloc_needs_plt_for_ifunc(object, r_type))
-    target->make_plt_entry(layout, gsym, reloc, object);
+    target->make_plt_entry(symtab, layout, gsym, reloc, object);
 
   switch (r_type)
     {
@@ -3636,7 +3645,7 @@ Target_powerpc<size, big_endian>::Scan::
 	// Make a PLT entry if necessary.
 	if (gsym->needs_plt_entry())
 	  {
-	    target->make_plt_entry(layout, gsym, reloc, 0);
+	    target->make_plt_entry(symtab, layout, gsym, reloc, 0);
 	    // Since this is not a PC-relative relocation, we may be
 	    // taking the address of a function. In that case we need to
 	    // set the entry in the dynamic symbol table to the address of
@@ -3692,7 +3701,7 @@ Target_powerpc<size, big_endian>::Scan::
 	      && (gsym->is_undefined()
 		  || gsym->is_from_dynobj()
 		  || gsym->is_preemptible())))
-	target->make_plt_entry(layout, gsym, reloc, object);
+	target->make_plt_entry(symtab, layout, gsym, reloc, object);
       // Fall thru
 
     case elfcpp::R_PPC64_REL64:

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]