public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: YunQiang Su <wzssyqa@gmail.com>
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>,
	YunQiang Su <yunqiang.su@cipunited.com>,
	binutils@sourceware.org, Nick Clifton <nickc@redhat.com>
Subject: Re: [PATCH v2] MIPS: Don't move __gnu_lto_slim to .scommon
Date: Thu, 20 Jul 2023 18:35:30 +0930	[thread overview]
Message-ID: <ZLj42hHY/Wf/T5DK@squeak.grove.modra.org> (raw)
In-Reply-To: <CAKcpw6Wr-Ot+0CBTO722xCVJB1D3r6=zcNk4KTY7xuNVtL6XMw@mail.gmail.com>

I think the patch is OK, but the same should be applied to another
place to stop objcopy modifying __gnu_lto_slim.

mips-linux-gnu testcase after running make check:
  binutils/objcopy ld/tmpdir/pr15323a-r.o ld/tmpdir/xxx
then inspect ld/tmpdir/xxx with readelf.

I'm going to apply the following to mainline, and will also apply to
the 2.41 branch tomorrow if no one objects.

	* elfxx-mips.c (_bfd_mips_elf_symbol_processing): Don't treat
	__gnu_lto_slim as SHN_MIPS_SCOMMON.
	(_bfd_mips_elf_add_symbol_hook): Likewise.

diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 71f2dc9d779..1e9851c3190 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -7176,10 +7176,11 @@ _bfd_mips_elf_symbol_processing (bfd *abfd, asymbol *asym)
 
     case SHN_COMMON:
       /* Common symbols less than the GP size are automatically
-	 treated as SHN_MIPS_SCOMMON symbols on IRIX5.  */
+	 treated as SHN_MIPS_SCOMMON symbols, with some exceptions.  */
       if (asym->value > elf_gp_size (abfd)
 	  || ELF_ST_TYPE (elfsym->internal_elf_sym.st_info) == STT_TLS
-	  || IRIX_COMPAT (abfd) == ict_irix6)
+	  || IRIX_COMPAT (abfd) == ict_irix6
+	  || strcmp (asym->name, "__gnu_lto_slim") == 0)
 	break;
       /* Fall through.  */
     case SHN_MIPS_SCOMMON:
@@ -7862,10 +7863,11 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
     {
     case SHN_COMMON:
       /* Common symbols less than the GP size are automatically
-	 treated as SHN_MIPS_SCOMMON symbols.  */
+	 treated as SHN_MIPS_SCOMMON symbols, with some exceptions.  */
       if (sym->st_size > elf_gp_size (abfd)
 	  || ELF_ST_TYPE (sym->st_info) == STT_TLS
-	  || IRIX_COMPAT (abfd) == ict_irix6)
+	  || IRIX_COMPAT (abfd) == ict_irix6
+	  || strcmp (*namep, "__gnu_lto_slim") == 0)
 	break;
       /* Fall through.  */
     case SHN_MIPS_SCOMMON:

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2023-07-20  9:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 10:36 [PATCH] MIPS: Don't " YunQiang Su
2023-07-03 10:50 ` [PATCH v2] MIPS: Don't move " YunQiang Su
2023-07-05  1:42   ` YunQiang Su
2023-07-13  5:39     ` YunQiang Su
2023-07-19 14:55     ` Maciej W. Rozycki
2023-07-19 17:26       ` YunQiang Su
2023-07-20  9:05         ` Alan Modra [this message]
2023-07-20  9:34           ` Maciej W. Rozycki
2023-07-20 11:23             ` Alan Modra
2023-07-20 14:32               ` Maciej W. Rozycki
2023-07-20 22:44                 ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZLj42hHY/Wf/T5DK@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=macro@orcam.me.uk \
    --cc=nickc@redhat.com \
    --cc=wzssyqa@gmail.com \
    --cc=yunqiang.su@cipunited.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).