public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: Remove redundant code
Date: Wed, 20 Apr 2011 07:01:00 -0000	[thread overview]
Message-ID: <20110420070127.GI19947@bubble.grove.modra.org> (raw)

More than one bfd_release in a row on the same bfd is never necessary,
and in the archive.c case is potentially wrong.

	* archive.c (_bfd_get_elt_at_filepos): Don't release n_nfd.
	* elflink.c (elf_link_add_object_symbols): Delete redundant code.

Index: bfd/archive.c
===================================================================
RCS file: /cvs/src/src/bfd/archive.c,v
retrieving revision 1.74
diff -u -p -r1.74 archive.c
--- bfd/archive.c	4 Mar 2011 01:43:24 -0000	1.74
+++ bfd/archive.c	20 Apr 2011 00:49:55 -0000
@@ -661,10 +661,6 @@ _bfd_get_elt_at_filepos (bfd *archive, f
   if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd))
     return n_nfd;
 
-  /* Huh?  */
-  /* FIXME:  n_nfd isn't allocated in the archive's memory pool.
-     If we reach this point, I think bfd_release will abort.  */
-  bfd_release (archive, n_nfd);
   bfd_release (archive, new_areldata);
   return NULL;
 }
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.399
diff -u -p -r1.399 elflink.c
--- bfd/elflink.c	20 Apr 2011 00:22:08 -0000	1.399
+++ bfd/elflink.c	20 Apr 2011 00:50:22 -0000
@@ -4237,10 +4237,7 @@ error_free_dyn:
 		 We need to get the alignment from the section.  */
 	      align = new_sec->alignment_power;
 	    }
-	  if (align > old_alignment
-	      /* Permit an alignment power of zero if an alignment of one
-		 is specified and no other alignments have been specified.  */
-	      || (isym->st_value == 1 && old_alignment == 0))
+	  if (align > old_alignment)
 	    h->root.u.c.p->alignment_power = align;
 	  else
 	    h->root.u.c.p->alignment_power = old_alignment;

-- 
Alan Modra
Australia Development Lab, IBM

                 reply	other threads:[~2011-04-20  7:01 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=20110420070127.GI19947@bubble.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).