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: Bug in handling high PLT entries on sparc64


On Tue, Nov 12, 2002 at 12:07:31AM +0100, Thomas Moestl wrote:
> 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?

Looks ok.
Will commit tomorrow unless somebody beats me to do it.

> --- 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;

	Jakub


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