This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]