[PATCH] LTO: Handle __real_SYM reference in IR
Alan Modra
amodra@gmail.com
Wed May 4 04:12:00 GMT 2022
On Fri, Apr 29, 2022 at 10:59:32AM -0700, H.J. Lu via Binutils wrote:
> --- a/bfd/elflink.c
> +++ b/bfd/elflink.c
> @@ -1101,8 +1101,19 @@ _bfd_elf_merge_symbol (bfd *abfd,
> if (! bfd_is_und_section (sec))
> h = elf_link_hash_lookup (elf_hash_table (info), name, true, false, false);
> else
> - h = ((struct elf_link_hash_entry *)
> - bfd_wrapped_link_hash_lookup (abfd, info, name, true, false, false));
> + {
> + h = ((struct elf_link_hash_entry *)
> + bfd_wrapped_link_hash_lookup (abfd, info, name, true, false,
> + false));
> + /* Mark SYM is referenced in IR if __real_SYM is referenced in
> + IR. */
> + if (h != NULL
> + && info->wrap_hash != NULL
> + && (abfd->flags & BFD_PLUGIN) != 0
> + && strcmp (h->root.root.string,
> + name + sizeof "__real_" - 1) == 0)
> + h->root.ir_ref_real = 1;
> + }
> if (h == NULL)
> return false;
> *sym_hash = h;
How about putting the above in linker.c:bfd_wrapped_link_hash_lookup
instead, to avoid the extra strcmp? That seems like a better place to
me since there isn't really anything ELF specific about wrapped symbol
lookup.
Hmm, and maybe without the BFD_PLUGIN test and losing "ir" from the
flag name.
If that works for you, OK with those changes.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list