[PATCH v2] MIPS: Don't move __gnu_lto_slim to .scommon

YunQiang Su wzssyqa@gmail.com
Wed Jul 19 17:26:19 GMT 2023


Maciej W. Rozycki <macro@orcam.me.uk> 于2023年7月19日周三 22:55写道:
>
> On Wed, 5 Jul 2023, YunQiang Su wrote:
>
> > > The LTO plugin doesn't expect __gnu_lto_slim is marked as
> > > COMMOM or moved .scommon section.
> > >
> >
> > @Maciej W. Rozycki This is a tiny patch, and I think that it should be
> > in 2.41 release.
> > Any idea?
>
>  What produces this symbol and why is it a common symbol in the first
> place if it's not supposed to?
>

The symbol is produced by GCC LTO, and it has SHN_COMMON, while no
SEC_IS_COMMON flag is set.

When gcc -r -flto, this symbol is collected into .scommon and marked
as SEC_IS_COMMON,
which is rejected by linker.

I have no idea why gcc lto uses SHN_COMMON, while it is used by other
architectures.
That's why I block  `__gnu_lto_slim` out .scommon and SEC_IS_COMMON flag.

See bfd/linker.c (_bfd_generic_link_add_one_symbol):
  else if (bfd_is_com_section (section))
    {
      row = COMMON_ROW;
      if (!bfd_link_relocatable (info)
          && name != NULL
          && name[0] == '_'
          && name[1] == '_'
          && strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
        _bfd_error_handler
          (_("%pB: plugin needed to handle lto object"), abfd);
    }

>  NB the mail server for your @gmail.com address rejects e-mail coming from
> my system.  Please sort this out with your ISP.
>
>   Maciej



-- 
YunQiang Su


More information about the Binutils mailing list