This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [RFC] Fix PR 16910: Relocate symbol correctly if it is wrapped
- From: "Qi, Yao" <Yao_Qi at mentor dot com>
- To: <binutils at sourceware dot org>
- Cc: <amodra at gmail dot com>
- Date: Tue, 10 Jun 2014 08:11:15 +0800
- Subject: Re: [RFC] Fix PR 16910: Relocate symbol correctly if it is wrapped
- Authentication-results: sourceware.org; auth=none
- References: <1399541408-12698-1-git-send-email-yao at codesourcery dot com> <20140509040512 dot GG5162 at bubble dot grove dot modra dot org> <536C88E2 dot 4000509 at codesourcery dot com>
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