public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: "H . J . Lu" <hjl@lucon.org>,
	"Leonard N. Zubkoff" <lnz@dandelion.com>,
	binutils@sourceware.cygnus.com, gcc@gcc.gnu.org,
	GNU C Library <libc-alpha@sourceware.cygnus.com>,
	Kenneth Albanowski <kjahds@kjahds.com>,
	Mat Hostetter <mat@lcs.mit.edu>,
	Andy Dougherty <doughera@lafcol.lafayette.edu>,
	Warner Losh <imp@village.org>,
	linux-mips@oss.sgi.com, Ron Guilmette <rfg@monkeys.com>,
	"Polstra; John" <linux-binutils-in@polstra.com>,
	"Hazelwood; Galen" <galenh@micron.net>,
	Ralf Baechle <ralf@informatik.uni-koblenz.de>,
	Linas Vepstas <linas@linas.org>,
	Feher Janos <aries@hal2000.terra.vein.hu>,
	"Steven J. Hill" <sjhill@cotw.com>,
	linux-gcc@vger.kernel.org
Subject: Re: binutils 2.11.92.0.6 (Re: binutils 2.11.92.0.5 is broken)
Date: Mon, 15 Oct 2001 00:17:00 -0000	[thread overview]
Message-ID: <20011015164539.I1015@bubble.sa.bigpond.net.au> (raw)
In-Reply-To: <20011015093317.B1015@bubble.sa.bigpond.net.au>

I'm about to commit this to fix the problems introduced by the new
reference counting scheme.

2001-10-15  Alan Modra  <amodra@bigpond.net.au>
	    H.J. Lu  <hjl@gnu.org>

	* elf32-hppa.c (elf32_hppa_copy_indirect_symbol): Merge dyn_reloc
	counts for aliases instead of aborting.
	* elf32-i386.c (elf_i386_copy_indirect_symbol): Likewise.
	* elf64-ppc.c (ppc64_elf_copy_indirect_symbol): Likewise.

	* elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Set plt.offset
	to -1 for non-function symbols.
	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise.
	* elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
	* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
	* elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
	* elf64-x86-64.c (elf64_x86_64_adjust_dynamic_symbol): Likewise.
	* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Refer to
	plt.offset instead of plt.refcount when setting to -1.

-- 
Alan Modra

Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.52
diff -u -p -r1.52 elf32-hppa.c
--- elf32-hppa.c	2001/10/03 08:33:18	1.52
+++ elf32-hppa.c	2001/10/15 05:12:07
@@ -1142,13 +1142,41 @@ elf32_hppa_copy_indirect_symbol (dir, in
   edir = (struct elf32_hppa_link_hash_entry *) dir;
   eind = (struct elf32_hppa_link_hash_entry *) ind;
 
-  if (edir->dyn_relocs == NULL)
+  if (eind->dyn_relocs != NULL)
     {
+      if (edir->dyn_relocs != NULL)
+	{
+	  struct elf32_hppa_dyn_reloc_entry **pp;
+	  struct elf32_hppa_dyn_reloc_entry *p;
+
+	  if (dir != ind->weakdef)
+	    abort ();
+
+	  /* Add reloc counts against the weak sym to the strong sym
+	     list.  Merge any entries against the same section.  */
+	  for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+	    {
+	      struct elf32_hppa_dyn_reloc_entry *q;
+
+	      for (q = edir->dyn_relocs; q != NULL; q = q->next)
+		if (q->sec == p->sec)
+		  {
+#if RELATIVE_DYNRELOCS
+		    q->relative_count += p->relative_count;
+#endif
+		    q->count += p->count;
+		    *pp = p->next;
+		    break;
+		  }
+	      if (q == NULL)
+		pp = &p->next;
+	    }
+	  *pp = edir->dyn_relocs;
+	}
+
       edir->dyn_relocs = eind->dyn_relocs;
       eind->dyn_relocs = NULL;
     }
-  else if (eind->dyn_relocs != NULL)
-    abort ();
 
   _bfd_elf_link_hash_copy_indirect (dir, ind);
 }
@@ -1844,6 +1872,8 @@ elf32_hppa_adjust_dynamic_symbol (info, 
 
       return true;
     }
+  else
+    h->plt.offset = (bfd_vma) -1;
 
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.54
diff -u -p -r1.54 elf32-i386.c
--- elf32-i386.c	2001/10/03 15:11:46	1.54
+++ elf32-i386.c	2001/10/15 05:12:07
@@ -637,13 +637,39 @@ elf_i386_copy_indirect_symbol (dir, ind)
   edir = (struct elf_i386_link_hash_entry *) dir;
   eind = (struct elf_i386_link_hash_entry *) ind;
 
-  if (edir->dyn_relocs == NULL)
+  if (eind->dyn_relocs != NULL)
     {
+      if (edir->dyn_relocs != NULL)
+	{
+	  struct elf_i386_dyn_relocs **pp;
+	  struct elf_i386_dyn_relocs *p;
+
+	  if (dir != ind->weakdef)
+	    abort ();
+
+	  /* Add reloc counts against the weak sym to the strong sym
+	     list.  Merge any entries against the same section.  */
+	  for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+	    {
+	      struct elf_i386_dyn_relocs *q;
+
+	      for (q = edir->dyn_relocs; q != NULL; q = q->next)
+		if (q->sec == p->sec)
+		  {
+		    q->pc_count += p->pc_count;
+		    q->count += p->count;
+		    *pp = p->next;
+		    break;
+		  }
+	      if (q == NULL)
+		pp = &p->next;
+	    }
+	  *pp = edir->dyn_relocs;
+	}
+
       edir->dyn_relocs = eind->dyn_relocs;
       eind->dyn_relocs = NULL;
     }
-  else if (eind->dyn_relocs != NULL)
-    abort ();
 
   _bfd_elf_link_hash_copy_indirect (dir, ind);
 }
@@ -1086,7 +1112,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
 	     object, or if all references were garbage collected.  In
 	     such a case, we don't actually need to build a procedure
 	     linkage table, and we can just do a PC32 reloc instead.  */
-	  h->plt.refcount = -1;
+	  h->plt.offset = (bfd_vma) -1;
 	  h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
 	}
 
@@ -1098,7 +1124,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
        check_relocs.  We can't decide accurately between function and
        non-function syms in check-relocs;  Objects loaded later in
        the link may change h->type.  So fix it now.  */
-    h->plt.refcount = -1;
+    h->plt.offset = (bfd_vma) -1;
 
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.32
diff -u -p -r1.32 elf32-ppc.c
--- elf32-ppc.c	2001/09/29 06:21:59	1.32
+++ elf32-ppc.c	2001/10/15 05:12:09
@@ -1797,6 +1797,8 @@ ppc_elf_adjust_dynamic_symbol (info, h)
 
       return true;
     }
+  else
+    h->plt.offset = (bfd_vma) -1;
 
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
Index: bfd/elf32-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-s390.c,v
retrieving revision 1.9
diff -u -p -r1.9 elf32-s390.c
--- elf32-s390.c	2001/09/29 06:21:59	1.9
+++ elf32-s390.c	2001/10/15 05:12:11
@@ -998,6 +998,8 @@ elf_s390_adjust_dynamic_symbol (info, h)
 
       return true;
     }
+  else
+    h->plt.offset = (bfd_vma) -1;
 
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.7
diff -u -p -r1.7 elf64-ppc.c
--- elf64-ppc.c	2001/10/03 08:33:18	1.7
+++ elf64-ppc.c	2001/10/15 05:12:13
@@ -1794,13 +1794,39 @@ ppc64_elf_copy_indirect_symbol (dir, ind
   edir = (struct ppc_link_hash_entry *) dir;
   eind = (struct ppc_link_hash_entry *) ind;
 
-  if (edir->dyn_relocs == NULL)
+  if (eind->dyn_relocs != NULL)
     {
+      if (edir->dyn_relocs != NULL)
+	{
+	  struct ppc_dyn_relocs **pp;
+	  struct ppc_dyn_relocs *p;
+
+	  if (dir != ind->weakdef)
+	    abort ();
+
+	  /* Add reloc counts against the weak sym to the strong sym
+	     list.  Merge any entries against the same section.  */
+	  for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
+	    {
+	      struct ppc_dyn_relocs *q;
+
+	      for (q = edir->dyn_relocs; q != NULL; q = q->next)
+		if (q->sec == p->sec)
+		  {
+		    q->pc_count += p->pc_count;
+		    q->count += p->count;
+		    *pp = p->next;
+		    break;
+		  }
+	      if (q == NULL)
+		pp = &p->next;
+	    }
+	  *pp = edir->dyn_relocs;
+	}
+
       edir->dyn_relocs = eind->dyn_relocs;
       eind->dyn_relocs = NULL;
     }
-  else if (eind->dyn_relocs != NULL)
-    abort ();
 
   _bfd_elf_link_hash_copy_indirect (dir, ind);
 }
@@ -2366,6 +2392,8 @@ ppc64_elf_adjust_dynamic_symbol (info, h
 	}
       return true;
     }
+  else
+    h->plt.offset = (bfd_vma) -1;
 
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
Index: bfd/elf64-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-s390.c,v
retrieving revision 1.9
diff -u -p -r1.9 elf64-s390.c
--- elf64-s390.c	2001/09/29 06:21:59	1.9
+++ elf64-s390.c	2001/10/15 05:12:15
@@ -976,6 +976,8 @@ elf_s390_adjust_dynamic_symbol (info, h)
 
       return true;
     }
+  else
+    h->plt.offset = (bfd_vma) -1;
 
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.29
diff -u -p -r1.29 elf64-x86-64.c
--- elf64-x86-64.c	2001/09/29 06:21:59	1.29
+++ elf64-x86-64.c	2001/10/15 05:12:17
@@ -854,6 +854,8 @@ elf64_x86_64_adjust_dynamic_symbol (info
 
       return true;
     }
+  else
+    h->plt.offset = (bfd_vma) -1;
 
   /* If this is a weak symbol, and there is a real definition, the
      processor independent code will have arranged for us to see the

      reply	other threads:[~2001-10-15  0:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200110131452.f9DEq7Q0032358@dandelion.com>
2001-10-13 19:00 ` binutils 2.11.92.0.5 is broke (Re: Binutils Bug) H . J . Lu
2001-10-13 23:56   ` binutils 2.11.92.0.6 (Re: binutils 2.11.92.0.5 is broken) H . J . Lu
2001-10-13 23:59     ` H . J . Lu
2001-10-14 17:03     ` Alan Modra
2001-10-15  0:17       ` Alan Modra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011015164539.I1015@bubble.sa.bigpond.net.au \
    --to=amodra@bigpond.net.au \
    --cc=aries@hal2000.terra.vein.hu \
    --cc=binutils@sourceware.cygnus.com \
    --cc=doughera@lafcol.lafayette.edu \
    --cc=galenh@micron.net \
    --cc=gcc@gcc.gnu.org \
    --cc=hjl@lucon.org \
    --cc=imp@village.org \
    --cc=kjahds@kjahds.com \
    --cc=libc-alpha@sourceware.cygnus.com \
    --cc=linas@linas.org \
    --cc=linux-binutils-in@polstra.com \
    --cc=linux-gcc@vger.kernel.org \
    --cc=linux-mips@oss.sgi.com \
    --cc=lnz@dandelion.com \
    --cc=mat@lcs.mit.edu \
    --cc=ralf@informatik.uni-koblenz.de \
    --cc=rfg@monkeys.com \
    --cc=sjhill@cotw.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).