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: G++ bug and test case...


On Thu, Jun 06, 2002 at 01:46:52PM -0500, Peter Bergner wrote:
>     #include <stdio.h>
> 
>     int
>     main(int argc, char *argv[])
>     {
>         printf("\n");
>         return 0;
>     }
> 
[snip]
> ld: /tmp/ccc88n4Q.o(.opd+0x18): unresolvable relocation against symbol `.putchar@@GLIBC_2.2.5'

The comment below explains why this was happening.

bfd/ChangeLog
	* elf64-ppc.c (ppc64_elf_relocate_section): Allow unresolved
	relocs in opd for non-shared too.

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.51
diff -u -p -r1.51 elf64-ppc.c
--- bfd/elf64-ppc.c	6 Jun 2002 00:29:21 -0000	1.51
+++ bfd/elf64-ppc.c	7 Jun 2002 10:00:09 -0000
@@ -5614,12 +5614,17 @@ ppc64_elf_relocate_section (output_bfd, 
 		  relocate = true;
 		  if (r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC)
 		    {
-		      if (is_opd && h != NULL && info->shared)
+		      if (is_opd && h != NULL)
 			{
 			  /* Lie about opd entries.  This case occurs
 			     when building shared libraries and we
 			     reference a function in another shared
-			     lib.  In that case we won't use the opd
+			     lib.  The same thing happens for a weak
+			     definition in an application that's
+			     overridden by a strong definition in a
+			     shared lib.  (I believe this is a generic
+			     bug in binutils handling of weak syms.)
+			     In these cases we won't use the opd
 			     entry in this lib;  We ought to edit the
 			     opd section to remove unused entries.  */
 			  unresolved_reloc = 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]