public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: coff-sh.c keep_relocs, keep_contents and keep_syms
Date: Thu, 9 Feb 2023 09:44:23 +1030	[thread overview]
Message-ID: <Y+QszzU2zl+ApZy4@squeak.grove.modra.org> (raw)

keep_relocs and keep_contents are unused nowadays except by
xcofflink.c, and I can't see a reason why keep_syms needs to be set.
The external syms are read and used by sh_relax_section and used by
sh_relax_delete_bytes.  There doesn't appear to be any way that
freeing them will cause trouble.

	* coff-sh.c (sh_relax_section): Don't set keep_relocs,
	keep_contents or keep_syms.
	(sh_relax_delete_bytes): Don't set keep_contents.

diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index cc6faac4e80..314b796ac8b 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -905,12 +905,7 @@ sh_relax_section (bfd *abfd,
 	 the linker is run.  */
 
       coff_section_data (abfd, sec)->relocs = internal_relocs;
-      coff_section_data (abfd, sec)->keep_relocs = true;
-
       coff_section_data (abfd, sec)->contents = contents;
-      coff_section_data (abfd, sec)->keep_contents = true;
-
-      obj_coff_keep_syms (abfd) = true;
 
       /* Replace the jsr with a bsr.  */
 
@@ -1027,12 +1022,7 @@ sh_relax_section (bfd *abfd,
       if (swapped)
 	{
 	  coff_section_data (abfd, sec)->relocs = internal_relocs;
-	  coff_section_data (abfd, sec)->keep_relocs = true;
-
 	  coff_section_data (abfd, sec)->contents = contents;
-	  coff_section_data (abfd, sec)->keep_contents = true;
-
-	  obj_coff_keep_syms (abfd) = true;
 	}
     }
 
@@ -1435,8 +1425,6 @@ sh_relax_delete_bytes (bfd *abfd,
 	      if (val > addr && val < toaddr)
 		bfd_put_32 (abfd, val - count,
 			    ocontents + irelscan->r_vaddr - o->vma);
-
-	      coff_section_data (abfd, o)->keep_contents = true;
 	    }
 	}
     }

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2023-02-08 23:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Y+QszzU2zl+ApZy4@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /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).