aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gold/archive.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/gold/archive.cc b/gold/archive.cc
index 5862f34..1442731 100644
--- a/gold/archive.cc
+++ b/gold/archive.cc
@@ -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);