[PATCH] elf: Don't load archive element after dynamic definition
H.J. Lu
hjl.tools@gmail.com
Wed Sep 2 11:56:48 GMT 2020
On Wed, Sep 2, 2020 at 1:12 AM Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, Sep 02, 2020 at 08:52:06AM +0200, Martin Liška wrote:
> > On 8/28/20 4:50 PM, H.J. Lu via Binutils wrote:
> > > PR ld/26530 test still failed.
> >
> > Hello.
> >
> > Is there any progress on this please?
>
> I think what we want is the following, and some tweaking of the
> testsuite to remove FAIL: PR ld/15146 (1). That test relied on not
> loading a shared lib due to an IR symbol reference, but the logic
> added by git commit 3d5bef4c0871 has already been reverted.
>
> diff --git a/bfd/elflink.c b/bfd/elflink.c
> index 5c085b14b7..346f534911 100644
> --- a/bfd/elflink.c
> +++ b/bfd/elflink.c
> @@ -4977,11 +4977,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
> object and a shared object. */
> bfd_boolean dynsym = FALSE;
>
> - /* Plugin symbols aren't normal. Don't set def_regular or
> - ref_regular for them, or make them dynamic. */
> - if ((abfd->flags & BFD_PLUGIN) != 0)
> - ;
> - else if (! dynamic)
> + if (! dynamic)
> {
> if (! definition)
> {
> @@ -5162,10 +5158,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
> && !bfd_link_relocatable (info))
> dynsym = FALSE;
>
> - /* Nor should we make plugin symbols dynamic. */
> - if ((abfd->flags & BFD_PLUGIN) != 0)
> - dynsym = FALSE;
> -
> if (definition)
> {
> h->target_internal = isym->st_target_internal;
> @@ -5192,7 +5184,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
> }
> }
>
> - if (dynsym && h->dynindx == -1)
> + if (dynsym && (abfd->flags & BFD_PLUGIN) == 0 && h->dynindx == -1)
> {
> if (! bfd_elf_link_record_dynamic_symbol (info, h))
> goto error_free_vers;
Will it add a shared library to DT_NEEDED even if the IR symbol reference is
removed by LTO?
--
H.J.
More information about the Binutils
mailing list