This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


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

Re: glibc 2.1.95 (5th test release)


> Cc: howarth@bromo.med.uc.edu, libc-alpha@sources.redhat.com
> Reply-To: drepper@cygnus.com (Ulrich Drepper)
> From: Ulrich Drepper <drepper@redhat.com>
> Date: 14 Oct 2000 13:33:27 -0700
> User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Capitol Reef)
> 
> Geoff Keating <geoffk@cygnus.com> writes:
> 
> > OK, then, I think what we have to do is go back to the old way of
> > doing __gmon_start__ until this is fixed.
> 
> This won't help since some other tests will fail.  The old code is
> plainly wrong.

Happily, I now have a patch which I think fixes it.  It's a _linker_
patch.

I haven't fully tested it, but I think it will work, and it at least
doesn't break the ld testsuite.

It affects applications, so you need to re-link all applications
built under the new glibc.  If it's good, I'd like to try to get it
into binutils 2.10.1.

With this patch, weak symbols should work everywhere on ppc except for
_non-pic_ code in applications (where they never worked properly
anyway, and I can't see any easy way to make them work).

-- 
- Geoffrey Keating <geoffk@cygnus.com>

===File ~/patches/cygnus/glibc-ld-weakplt.patch=============
2000-10-14  Geoffrey Keating  <geoffk@shoggoth.cygnus.com>

	* elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Don't make PLT
	entries that could serve as a definition for a weak symbol.

Index: elf32-ppc.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elf32-ppc.c,v
retrieving revision 1.105
diff -u -p -r1.105 elf32-ppc.c
--- elf32-ppc.c	2000/07/29 20:23:09	1.105
+++ elf32-ppc.c	2000/10/14 20:46:57
@@ -1715,7 +1716,8 @@ ppc_elf_adjust_dynamic_symbol (info, h)
 
 	     2. We know for certain that a symbol is defined in
 	     this object, because this object is the application,
-	     is linked with -Bsymbolic, or because the symbol is local.
+	     is linked with -Bsymbolic, the symbol is local,
+	     or because the symbol is protected or hidden.
 
 	     3. GC has rendered the entry unused.
 	     Note, however, that in an executable all references to the
@@ -2675,6 +2677,13 @@ ppc_elf_finish_dynamic_symbol (output_bf
 	  /* Mark the symbol as undefined, rather than as defined in
 	     the .plt section.  Leave the value alone.  */
 	  sym->st_shndx = SHN_UNDEF;
+	  /* If the symbol is weak, we do need to clear the value.
+	     Otherwise, the PLT entry would provide a definition for
+	     the symbol even if the symbol wasn't defined anywhere,
+	     and so the symbol would never be NULL.  */
+	  if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) 
+	      == 0)
+	    sym->st_value = 0;
 	}
     }
 
============================================================

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