[PATCH v2] LTO: Restore the wrapper symbol check for indirect reference
H.J. Lu
hjl.tools@gmail.com
Fri Aug 2 11:48:34 GMT 2024
On Fri, Aug 2, 2024 at 4:40 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Call unwrap_hash_lookup to restore the wrapper symbol check for indirect
> reference, like calloc@@GLIBC_2.2.5, which doesn't set wrapper_symbol
> on __wrap_calloc.
>
> PR ld/31956
> * plugin.c (get_symbols): Restore the wrapper symbol check for
> indirect reference.
>
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
> ld/plugin.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/ld/plugin.c b/ld/plugin.c
> index 03ee9880d10..51c4765cc5b 100644
> --- a/ld/plugin.c
> +++ b/ld/plugin.c
> @@ -778,8 +778,18 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms,
> {
> blhe = h;
> /* Check if a symbol is a wrapper symbol. */
> - if (blhe && blhe->wrapper_symbol)
> - wrap_status = wrapper;
> + if (blhe)
> + {
> + if (blhe->wrapper_symbol)
> + wrap_status = wrapper;
> + else if (link_info.wrap_hash != NULL)
> + {
> + struct bfd_link_hash_entry *unwrap
> + = unwrap_hash_lookup (&link_info, (bfd *) abfd, blhe);
> + if (unwrap != NULL && unwrap != h)
> + wrap_status = wrapper;
> + }
> + }
> }
> else
> {
> --
> 2.45.2
>
Please commit for me if it is OK since I may not have Internet access
in the next few days.
Thanks.
--
H.J.
More information about the Binutils
mailing list