This is the mail archive of the binutils@sources.redhat.com 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]

ppc64 plt branch in shared libs


I must not have ever tested plt branch stubs in shared libs.  Of course,
you need to have shared libs well over 33M text size before you start
using relbrlt.  Either that, or you're branching into somewhere funny,
like .opd.

Michal, your dl-runtime.o:fixup had this near the end.
 1a4:   48 00 00 79     bl      21c <.profile_fixup+0x48>
                        1a4: R_PPC64_REL24      .opd+0x78

	* elf64-ppc.c (ppc_size_one_stub): Size relbrlt.  Accept info arg
	rather than htab.
	(ppc64_elf_size_stubs): Adjust ppc_size_one_stub traversal.  Zero
	relbrlt size.
	(ppc64_elf_build_stubs): Allocate space for relbrlt.

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.135
diff -u -p -r1.135 elf64-ppc.c
--- bfd/elf64-ppc.c	4 Nov 2003 06:16:36 -0000	1.135
+++ bfd/elf64-ppc.c	4 Nov 2003 07:47:12 -0000
@@ -6354,13 +6354,16 @@ static bfd_boolean
 ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
 {
   struct ppc_stub_hash_entry *stub_entry;
+  struct bfd_link_info *info;
   struct ppc_link_hash_table *htab;
   bfd_vma off;
   int size;
 
   /* Massage our args to the form they really have.  */
   stub_entry = (struct ppc_stub_hash_entry *) gen_entry;
-  htab = in_arg;
+  info = in_arg;
+
+  htab = ppc_hash_table (info);
 
   if (stub_entry->stub_type == ppc_stub_plt_call)
     {
@@ -6427,6 +6430,9 @@ ppc_size_one_stub (struct bfd_hash_entry
 	      br_entry->iter = htab->stub_iteration;
 	      br_entry->offset = htab->brlt->_raw_size;
 	      htab->brlt->_raw_size += 8;
+
+	      if (info->shared)
+		htab->relbrlt->_raw_size += sizeof (Elf64_External_Rela);
 	    }
 
 	  stub_entry->stub_type += ppc_stub_plt_branch - ppc_stub_long_branch;
@@ -7007,8 +7013,13 @@ ppc64_elf_size_stubs (bfd *output_bfd,
 	  }
       htab->brlt->_raw_size = 0;
       htab->brlt->_cooked_size = 0;
+      if (info->shared)
+	{
+	  htab->relbrlt->_raw_size = 0;
+	  htab->relbrlt->_cooked_size = 0;
+	}
 
-      bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, htab);
+      bfd_hash_traverse (&htab->stub_hash_table, ppc_size_one_stub, info);
 
       /* Ask the linker to do its stuff.  */
       (*htab->layout_sections_again) ();
@@ -7209,6 +7220,13 @@ ppc64_elf_build_stubs (bfd_boolean emit_
       htab->brlt->contents = bfd_zalloc (htab->brlt->owner,
 					 htab->brlt->_raw_size);
       if (htab->brlt->contents == NULL)
+	return FALSE;
+    }
+  if (info->shared && htab->relbrlt->_raw_size != 0)
+    {
+      htab->relbrlt->contents = bfd_zalloc (htab->relbrlt->owner,
+					    htab->relbrlt->_raw_size);
+      if (htab->relbrlt->contents == NULL)
 	return FALSE;
     }
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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