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

YunQiang Su wzssyqa@gmail.com
Wed Jul 5 01:42:40 GMT 2023


YunQiang Su <yunqiang.su@cipunited.com> 于2023年7月3日周一 18:51写道:
>
> 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?

> Let's skip __gnu_lto_slim when detect symbols to be moved to
> .scommon.
>
> This patch can fix testcase:
>         PR ld/15323 (3)
>         PR ld/15323 (4)
> for MIPS.
> ---
>  bfd/elfxx-mips.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
> index 71f2dc9d779..63742de009c 100644
> --- a/bfd/elfxx-mips.c
> +++ b/bfd/elfxx-mips.c
> @@ -7861,6 +7861,10 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
>    switch (sym->st_shndx)
>      {
>      case SHN_COMMON:
> +      /* __gnu_lto_slim shouldn't mark as COMMON and move to .scommon:
> +       lto plugin doesn't expect so.  */
> +      if (strcmp (*namep, "__gnu_lto_slim") == 0)
> +       break;
>        /* Common symbols less than the GP size are automatically
>          treated as SHN_MIPS_SCOMMON symbols.  */
>        if (sym->st_size > elf_gp_size (abfd)
> --
> 2.30.2
>


-- 
YunQiang Su


More information about the Binutils mailing list