From a12074662b645834b85211121257c82b7763f2a6 Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Tue, 1 Apr 2008 20:57:36 +0000 Subject: 2008-03-31 Cary Coutant Add thin archive support. * archive.cc (Archive::armagt): New const. (Archive::setup): Remove task parameter and calls to unlock. (Archive::unlock_nested_archives): New function. (Archive::read_header): Add nested_off parameter. Change all callers. (Archive::interpret_header): Likewise. (Archive::include_all_members): Change to handle thin archives. (Archive::include_member): Likewise. * archive.h (Archive::Archive): Add new parameters and initializers. (Archive::armagt): New const. (Archive::setup): Remove task parameter. (Archive::unlock_nested_archives): New function. (Archive::read_header): Add nested_off parameter. (Archive::interpret_header): Likewise. (Archive::Nested_archive_table): New typedef. (Archive::is_thin_archive_): New field. (Archive::nested_archives_): New field. (Archive::options_): New field. (Archive::dirpath_): New field. (Archive::task_): New field. * readsyms.cc (Read_symbols::do_read_symbols): Add check for thin archives. Pass additional parameters to Archive::Archive. Unlock the archive file after calling Archive::setup. --- gold/readsyms.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'gold/readsyms.cc') diff --git a/gold/readsyms.cc b/gold/readsyms.cc index 6c1369b..d0bf264 100644 --- a/gold/readsyms.cc +++ b/gold/readsyms.cc @@ -204,12 +204,19 @@ Read_symbols::do_read_symbols(Workqueue* workqueue) if (read_size >= Archive::sarmag) { - if (memcmp(ehdr_buf, Archive::armag, Archive::sarmag) == 0) + bool is_thin_archive + = memcmp(ehdr_buf, Archive::armagt, Archive::sarmag) == 0; + if (is_thin_archive + || memcmp(ehdr_buf, Archive::armag, Archive::sarmag) == 0) { // This is an archive. Archive* arch = new Archive(this->input_argument_->file().name(), - input_file); - arch->setup(this); + input_file, is_thin_archive, + this->dirpath_, this); + arch->setup(); + + // Unlock the archive so it can be used in the next task. + arch->unlock(this); workqueue->queue_next(new Add_archive_symbols(this->symtab_, this->layout_, -- cgit v1.1