aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-08-27 16:22:48 +0000
committerNick Clifton <nickc@redhat.com>2013-08-27 16:22:48 +0000
commit0e135a02da8fc068153959bfd940f88a03c66ec4 (patch)
treed6c3f69a53a41666b3fcf53c52414296b56f74d1
parent44f3886761962fabfb0d92dbc1fed83e5a510d16 (diff)
downloadgdb-0e135a02da8fc068153959bfd940f88a03c66ec4.zip
gdb-0e135a02da8fc068153959bfd940f88a03c66ec4.tar.gz
gdb-0e135a02da8fc068153959bfd940f88a03c66ec4.tar.bz2
PR binutils/15796
* ar.c (map_over_members): Correctly handle multiple same-name entries on the command line and in the archive.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/ar.c18
2 files changed, 24 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 0805981..5a4872c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-27 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/15796
+ * ar.c (map_over_members): Correctly handle multiple same-name
+ entries on the command line and in the archive.
+
2013-08-23 H.J. Lu <hongjiu.lu@intel.com>
* doc/binutils.texi: Remove the extra space.
diff --git a/binutils/ar.c b/binutils/ar.c
index af5694d..987b46c 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -189,6 +189,9 @@ map_over_members (bfd *arch, void (*function)(bfd *), char **files, int count)
mapping over each file each time -- we want to hack multiple
references. */
+ for (head = arch->archive_next; head; head = head->archive_next)
+ head->archive_pass = 0;
+
for (; count > 0; files++, count--)
{
bfd_boolean found = FALSE;
@@ -199,6 +202,14 @@ map_over_members (bfd *arch, void (*function)(bfd *), char **files, int count)
const char * filename;
PROGRESS (1);
+ /* PR binutils/15796: Once an archive element has been matched
+ do not match it again. If the user provides multiple same-named
+ parameters on the command line their intent is to match multiple
+ same-named entries in the archive, not the same entry multiple
+ times. */
+ if (head->archive_pass)
+ continue;
+
filename = head->filename;
if (filename == NULL)
{
@@ -227,6 +238,13 @@ map_over_members (bfd *arch, void (*function)(bfd *), char **files, int count)
found = TRUE;
function (head);
+ head->archive_pass = 1;
+ /* PR binutils/15796: Once a file has been matched, do not
+ match any more same-named files in the archive. If the
+ user does want to match multiple same-name files in an
+ archive they should provide multiple same-name parameters
+ to the ar command. */
+ break;
}
}