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 05/09/2014 03:50 PM, Yao Qi wrote:
> Patch below is updated per your advice here.  I configured binutils as
> "--disable-gdb  --enable-targets=all --enable-64-bit-bfd" on
> x86_64-linux and run 'make check'.  There is no change in binutils.sum,
> gas.sum and ld.sum.  Let me know if testing in other ways is needed.

> bfd:
> 
> 2014-05-09  Yao Qi  <yao@codesourcery.com>
> 
> 	PR ld/16910
> 	* elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): If the symbol is from a
> 	debug section and is wrapped, look for it instead of the wrapped
> 	one.
> ---
>  bfd/elf-bfd.h | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
> index 2c02135..791ece9 100644
> --- a/bfd/elf-bfd.h
> +++ b/bfd/elf-bfd.h
> @@ -2431,6 +2431,33 @@ extern asection _bfd_elf_large_com_section;
>  									\
>        h = sym_hashes[r_symndx - symtab_hdr->sh_info];			\
>  									\
> +      if (info->wrap_hash != NULL					\
> +	  && (input_section->flags & SEC_DEBUGGING) != 0)		\
> +	{								\
> +	  const char *l;						\
> +									\
> +	  l = h->root.root.string;					\
> +	  if (*l == bfd_get_symbol_leading_char (input_bfd)		\
> +	      || *l == info->wrap_char)				\
> +	    ++l; /* Strip off possible prefix.  */			\
> +									\
> +	  if (CONST_STRNEQ (l, "__wrap_")				\
> +	      && bfd_hash_lookup (info->wrap_hash,			\
> +				  l + sizeof "__wrap_" - 1, FALSE,	\
> +				  FALSE) != NULL)			\
> +	    {								\
> +	      /* If the string L starts with "__wrap_" and the		\
> +		 remainder is found in wrap_hash, the symbol is	\
> +		 wrapped.  The attributes of debugging information	\
> +		 are about the original symbol instead of the wrapped	\
> +		 one.  Look up the remainder in the main hash.  */	\
> +	      h = ((struct elf_link_hash_entry *)			\
> +		   bfd_link_hash_lookup (info->hash,			\
> +					 l + sizeof "__wrap_" - 1,	\
> +					 FALSE, TRUE, FALSE));		\
> +	    }								\
> +	}								\
> +									\
>        while (h->root.type == bfd_link_hash_indirect			\
>  	     || h->root.type == bfd_link_hash_warning)			\
>  	h = (struct elf_link_hash_entry *) h->root.u.i.link;		\

Ping.  Could you take a look at this patch?

-- 
Yao Qi


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