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]

Re: ELIMINATE_COPY_RELOCS problems on ppc


On Thu, Apr 03, 2003 at 08:45:09AM +0930, Alan Modra wrote:
> On Wed, Apr 02, 2003 at 04:42:28PM +0200, Jakub Jelinek wrote:
> > segfaults the linker on ppc32 (while it used to work just fine
> 
> Thanks, the testcase is really useful!  I had been trying to debug
> this problem by remote-control with someone at Gentoo without
> much luck.  It turns out that the root of the problem is
> SYMBOL_REFERENCES_LOCAL in ppc_elf_check_relocs, in combination
> with reference counting of the plt.  Previous versions of ppc
> binutils didn't properly reference count the plt, and check_relocs
> is too early to decide whether a symbol is really local.

This should cure the reference counting problem (note that the subject
line is a little misleading in that this really doesn't have anything
to do with copy relocs, the only connection being that I introduced
ELIMINATE_COPY_RELOCS at the same time as enabling plt reference
counting).  I'm in the middle of a glibc build, and won't apply unless
that's successful.  Also, I'd like to hear from Geoff as to why we
have both SYMBOL_REFERENCES_LOCAL and SYMBOL_CALLS_LOCAL, introduced
by http://sources.redhat.com/ml/binutils/2000-10/msg00184.html.  They
differ in that SYMBOL_REFERENCES_LOCAL doesn't consider STV_PROTECTED
syms as local, which seems a bit strange to me.  Perhaps the original
SYMBOL_REFERECES_LOCAL was trying to work around the fact that
check_relocs is too early to decide whether a sym is really local,
or some other generic linker bug?

	* elf32-ppc.c (SYMBOL_CALLS_LOCAL): Delete.  Use its definition..
	(SYMBOL_REFERENCES_LOCAL): ..here.
	(ppc_elf_adjust_dynamic_symbol): Replace SYMBOL_CALLS_LOCAL.
	(ppc_elf_check_relocs): Don't test SYMBOL_REFERENCES_LOCAL here.
	(ppc_elf_gc_sweep_hook): Likewise.

Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.72
diff -u -p -r1.72 elf32-ppc.c
--- bfd/elf32-ppc.c	10 Mar 2003 23:25:13 -0000	1.72
+++ bfd/elf32-ppc.c	2 Apr 2003 23:39:36 -0000
@@ -152,15 +152,6 @@ static bfd_boolean ppc_elf_grok_psinfo
   ((! INFO->shared							\
     || INFO->symbolic							\
     || H->dynindx == -1							\
-    || ELF_ST_VISIBILITY (H->other) == STV_INTERNAL			\
-    || ELF_ST_VISIBILITY (H->other) == STV_HIDDEN)			\
-   && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
-
-/* Will _calls_ to this symbol always call the version in this object?  */
-#define SYMBOL_CALLS_LOCAL(INFO, H)				\
-  ((! INFO->shared							\
-    || INFO->symbolic							\
-    || H->dynindx == -1							\
     || ELF_ST_VISIBILITY (H->other) != STV_DEFAULT)			\
    && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
 
@@ -2496,7 +2487,7 @@ ppc_elf_adjust_dynamic_symbol (info, h)
       /* Clear procedure linkage table information for any symbol that
 	 won't need a .plt entry.  */
       if (! htab->elf.dynamic_sections_created
- 	  || SYMBOL_CALLS_LOCAL (info, h)
+ 	  || SYMBOL_REFERENCES_LOCAL (info, h)
 	  || h->plt.refcount <= 0)
 	{
 	  /* A PLT entry is not required/allowed when:
@@ -3459,8 +3450,7 @@ ppc_elf_check_relocs (abfd, info, sec, r
 	case R_PPC_REL14_BRNTAKEN:
 	case R_PPC_REL32:
 	  if (h == NULL
-	      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
-	      || SYMBOL_REFERENCES_LOCAL (info, h))
+	      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
 	    break;
 	  /* fall through */
 
@@ -3745,8 +3735,7 @@ ppc_elf_gc_sweep_hook (abfd, info, sec, 
 	case R_PPC_REL14_BRNTAKEN:
 	case R_PPC_REL32:
 	  if (h == NULL
-	      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
-	      || SYMBOL_REFERENCES_LOCAL (info, h))
+	      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
 	    break;
 	  /* Fall thru */
 
-- 
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]