PR gold/12163
authorCary Coutant <ccoutant@google.com>
Thu, 2 Jun 2011 20:13:23 +0000 (20:13 +0000)
committerCary Coutant <ccoutant@google.com>
Thu, 2 Jun 2011 20:13:23 +0000 (20:13 +0000)
* gold/archive.cc (Archive::Archive): Initialize new data member.
(Archive::include_all_members): Return if archive has already been
included.
* gold/archive.h (Archive::include_all_members_): New data member.

gold/ChangeLog
gold/archive.cc
gold/archive.h

index 4691affafaf9cb6f960dfe0e50f4e251befb6dd9..a974f8f40d64e3a72242e6d6cc1aeb5d2f97e589 100644 (file)
@@ -1,3 +1,11 @@
+2011-06-02  Cary Coutant  <ccoutant@google.com>
+
+       PR gold/12163
+       * gold/archive.cc (Archive::Archive): Initialize new data member.
+       (Archive::include_all_members): Return if archive has already been
+       included.
+       * gold/archive.h (Archive::include_all_members_): New data member.
+
 2011-06-02  Nick Clifton  <nickc@redhat.com>
 
        * dynobj.h: Fix spelling mistake in comment.
index a7a5b93ed709b7dbd6fe26fe4da46b81f607bbd6..c3f7b946742f4a78ed32c204762606738819db76 100644 (file)
@@ -179,7 +179,8 @@ Archive::Archive(const std::string& name, Input_file* input_file,
   : Library_base(task), name_(name), input_file_(input_file), armap_(),
     armap_names_(), extended_names_(), armap_checked_(), seen_offsets_(),
     members_(), is_thin_archive_(is_thin_archive), included_member_(false),
-    nested_archives_(), dirpath_(dirpath), num_members_(0)
+    nested_archives_(), dirpath_(dirpath), num_members_(0),
+    included_all_members_(false)
 {
   this->no_export_ =
     parameters->options().check_excluded_libs(input_file->found_name());
@@ -847,6 +848,13 @@ bool
 Archive::include_all_members(Symbol_table* symtab, Layout* layout,
                              Input_objects* input_objects, Mapfile* mapfile)
 {
+  // Don't include the same archive twice.  This can happen if
+  // --whole-archive is nested inside --start-group (PR gold/12163).
+  if (this->included_all_members_)
+    return true;
+
+  this->included_all_members_ = true;
+
   input_objects->archive_start(this);
 
   if (this->members_.size() > 0)
index 78c2cc897950c7c6b3b9ac84b595c17d02c96081..e73a687e2c6e37efee1c17dad3cbc4b9b97952c9 100644 (file)
@@ -405,6 +405,8 @@ class Archive : public Library_base
   unsigned int num_members_;
   // True if we exclude this library archive from automatic export.
   bool no_export_;
+  // True if this library has been included as a --whole-archive.
+  bool included_all_members_;
 };
 
 // This class is used to read an archive and pick out the desired
This page took 0.032684 seconds and 4 git commands to generate.