This is the mail archive of the binutils@sourceware.org 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: [RFC] Fix PR 16910: Relocate symbol correctly if it is wrapped


On Thu, May 08, 2014 at 05:30:08PM +0800, Yao Qi wrote:
> --- a/bfd/elf-bfd.h
> +++ b/bfd/elf-bfd.h
> @@ -2429,7 +2429,28 @@ extern asection _bfd_elf_large_com_section;
>        if (sym_hashes == NULL)						\
>  	return FALSE;							\
>  									\
> -      h = sym_hashes[r_symndx - symtab_hdr->sh_info];			\
> +      if (strcmp (input_section->name, ".debug_info") == 0)		\
> +	{								\
> +	  char *name1							\
> +	    =  bfd_elf_string_from_elf_section (input_bfd,		\
> +						symtab_hdr->sh_link,	\
> +						symtab_hdr->sh_name);	\

The above function call is looking up the name of the .symtab section,
but using .strtab rather than the correct string table for section
names, .shstrtab.  I'm sure that's not what you intended, and it says
that this patch hasn't been tested very well, if at all..

I suspect that the right approach is

      h = sym_hashes[r_symndx - symtab_hdr->sh_info];
      if (info->wrap_hash != NULL
	  && (input_section->flags & SEC_DEBUGGING) != 0)
	{
	  retrieve name from h->root.root.string, strip off possible
	  prefix (see bfd_wrapped_link_hash_lookup)
	  if we now have a string starting with "__wrap_", look up
	  the remainder in wrap_hash, and if that matches, look up
	  the remainder in the main hash.
	}

-- 
Alan Modra
Australia Development Lab, IBM


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