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]

Re: weak symbols and PLT on sparc


Jakub Jelinek <jakub@redhat.com> writes:

> Hi!
> 
> I've commited following port of Geoff Keating's PPC patch which is needed on
> sparc* as well.

And also needed on x86-64, I'm committing to both branches (Jakub did
you commit to the binutils-2_11-branch?),

Andreas

2001-02-20  Andreas Jaeger  <aj@suse.de>

	* elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Don't make
	PLT entries that could serve as a definition for a weak symbol.

Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.7
diff -u -r1.7 elf64-x86-64.c
--- elf64-x86-64.c	2001/02/14 10:57:47	1.7
+++ elf64-x86-64.c	2001/02/20 07:56:37
@@ -1656,6 +1656,13 @@
 	  /* 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;
 	}
     }
 

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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