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]

Bug in handling high PLT entries on sparc64


Hi,

while running some tests on the FreeBSD/sparc64 dynamic linker, I
think I have run into a bug in the way bfd handles "high" PLT
entries (i.e. entries above 32768) on sparc64: in
sparc64_elf_adjust_dynamic_symbol(), the code that filled in the
symbol value for symbols which have PLT entries generated assumes that
the PLT is built as a simple array, which is not true for the high
slots. This would lead to bogus relocations of references to the
corresponding functions.

The patch below should fix this. Thoughts?

Thanks,
	- Thomas

-- 
Thomas Moestl <tmoestl@gmx.net>	http://www.tu-bs.de/~y0015675/
              <tmm@FreeBSD.org>	http://people.FreeBSD.org/~tmm/
PGP fingerprint: 1C97 A604 2BD0 E492 51D0  9C0F 1FE6 4F1D 419C 776C

--- elf64-sparc.c	11 Oct 2002 05:59:11 -0000	1.1.1.10
+++ elf64-sparc.c	9 Nov 2002 21:00:39 -0000
@@ -1563,6 +1563,9 @@
       if (s->_raw_size == 0)
 	s->_raw_size = PLT_HEADER_SIZE;
 
+      /* To simplify matters later, just store the plt index here.  */
+      h->plt.offset = s->_raw_size / PLT_ENTRY_SIZE;
+
       /* If this symbol is not defined in a regular file, and we are
 	 not generating a shared library, then set the symbol to this
 	 location in the .plt.  This is required to make function
@@ -1572,12 +1575,9 @@
 	  && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
 	{
 	  h->root.u.def.section = s;
-	  h->root.u.def.value = s->_raw_size;
+	  h->root.u.def.value = sparc64_elf_plt_entry_offset (h->plt.offset);
 	}
 
-      /* To simplify matters later, just store the plt index here.  */
-      h->plt.offset = s->_raw_size / PLT_ENTRY_SIZE;
-
       /* Make room for this entry.  */
       s->_raw_size += PLT_ENTRY_SIZE;


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