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]

2.10.91: Adjust mips_elf_output_extsym() for the new stub code


Hi,

 For indirect (versioned) symbols with a stub their u.def.section field of
their struct link_hash_entry is null.  I believe we should use the value
from the real symbol in this case.  The following patch fixes it.  It
implies the binutils-2.10.91-20010116-mips-call_reloc.patch (sent
previously) is applied.

bfd/ChangeLog:

2001-01-22  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>

	* elf32-mips.c (mips_elf_output_extsym): Get the output section
	information from the real symbol for indirect ones.
	Check no_fn_stub to find out if a symbol has a function stub
	indeed.

 Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

binutils-2.10-mips-extsym_debug
diff -up --recursive --new-file binutils-2.10.macro/bfd/elf32-mips.c binutils-2.10/bfd/elf32-mips.c
--- binutils-2.10.macro/bfd/elf32-mips.c	Sat Mar 11 02:23:10 2000
+++ binutils-2.10/bfd/elf32-mips.c	Sat Nov 18 06:28:08 2000
@@ -4212,24 +4212,36 @@ mips_elf_output_extsym (h, data)
     }
   else if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
     {
-      /* Set type and value for a symbol with a function stub.  */
-      h->esym.asym.st = stProc;
-      sec = h->root.root.u.def.section;
-      if (sec == NULL)
-	h->esym.asym.value = 0;
-      else
+      struct mips_elf_link_hash_entry *hd = h;
+      boolean no_fn_stub = h->no_fn_stub;
+
+      while (hd->root.root.type == bfd_link_hash_indirect)
 	{
-	  output_section = sec->output_section;
-	  if (output_section != NULL)
-	    h->esym.asym.value = (h->root.plt.offset
-				  + sec->output_offset
-				  + output_section->vma);
-	  else
-	    h->esym.asym.value = 0;
+	  hd = (struct mips_elf_link_hash_entry *)h->root.root.u.i.link;
+	  no_fn_stub = no_fn_stub || hd->no_fn_stub;
 	}
+
+      if (!no_fn_stub)
+	{
+	  /* Set type and value for a symbol with a function stub.  */
+	  h->esym.asym.st = stProc;
+	  sec = hd->root.root.u.def.section;
+	  if (sec == NULL)
+	    h->esym.asym.value = 0;
+	  else
+	    {
+	      output_section = sec->output_section;
+	      if (output_section != NULL)
+		h->esym.asym.value = (hd->root.plt.offset
+				      + sec->output_offset
+				      + output_section->vma);
+	      else
+		h->esym.asym.value = 0;
+	    }
 #if 0 /* FIXME?  */
-      h->esym.ifd = 0;
+	  h->esym.ifd = 0;
 #endif
+	}
     }
 
   if (! bfd_ecoff_debug_one_external (einfo->abfd, einfo->debug, einfo->swap,



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