Ignore empty archives.
authorIan Lance Taylor <iant@google.com>
Fri, 16 Nov 2007 18:44:20 +0000 (18:44 +0000)
committerIan Lance Taylor <iant@google.com>
Fri, 16 Nov 2007 18:44:20 +0000 (18:44 +0000)
gold/archive.cc

index 5862f34a6f631cc213c91ddbb6082775eb01f1d0..1442731f045ef867507b3acc203df318802ae24e 100644 (file)
@@ -75,6 +75,13 @@ const char Archive::arfmag[2] = { '`', '\n' };
 void
 Archive::setup()
 {
+  // We need to ignore empty archives.
+  if (this->input_file_->file().filesize() == sarmag)
+    {
+      this->input_file_->file().unlock();
+      return;
+    }
+
   // The first member of the archive should be the symbol table.
   std::string armap_name;
   off_t armap_size = this->read_header(sarmag, &armap_name);