PATCH COMMITTED: Fix gold so that --whole-archive works with thin archives

Cary Coutant ccoutant@google.com
Fri May 30 21:58:00 GMT 2008


I've committed the following trivial patch to fix gold so that it
correctly steps over the symbol table and extended name table in a
thin archive when linking whole archives.

-cary

	* archive.cc (Archive::include_all_members) Correct to step
	over symbol table and extended name table in thin archives.

Index: archive.cc
===================================================================
RCS file: /cvs/src/src/gold/archive.cc,v
retrieving revision 1.31
diff -u -p -r1.31 archive.cc
--- archive.cc	21 May 2008 21:37:44 -0000	1.31
+++ archive.cc	30 May 2008 21:23:25 -0000
@@ -386,20 +386,23 @@ Archive::include_all_members(Symbol_tabl
 	reinterpret_cast<const Archive_header*>(hdr_buf);
       std::string name;
       off_t size = this->interpret_header(hdr, off, &name, NULL);
+      bool special_member = false;
       if (name.empty())
         {
           // Symbol table.
+          special_member = true;
         }
       else if (name == "/")
         {
           // Extended name table.
+          special_member = true;
         }
       else
         this->include_member(symtab, layout, input_objects, off,
 			     mapfile, NULL, "--whole-archive");

       off += sizeof(Archive_header);
-      if (!this->is_thin_archive_)
+      if (special_member || !this->is_thin_archive_)
         off += size;
       if ((off & 1) != 0)
         ++off;



More information about the Binutils mailing list