Lines Matching full:archive
0 // archive.cc -- archive support for gold
40 #include "archive.h"
49 // Determine whether a definition of SYM_NAME should cause an archive
61 // In an object file, and therefore in an archive map, an
104 // PR 12001: Do not include an archive when the undefined
151 // The header of an entry in the archive. This is all readable text,
152 // padded with spaces where necessary. If the contents of an archive
153 // are all text file, the entire archive is readable.
155 struct Archive::Archive_header
173 // Class Archive static variables.
174 unsigned int Archive::total_archives;
175 unsigned int Archive::total_members;
176 unsigned int Archive::total_members_loaded;
178 // Archive methods.
180 const char Archive::armag[sarmag] =
185 const char Archive::armagt[sarmag] =
190 const char Archive::arfmag[2] = { '`', '\n' };
192 Archive::Archive(const std::string& name, Input_file* input_file,
204 // Set up the archive: read the symbol map and the extended name
208 Archive::setup()
214 // The first member of the archive should be the symbol table.
228 gold_error(_("%s: no archive symbol table (run ranlib)"),
264 Archive::unlock_nested_archives()
274 // Read the archive symbol map.
277 Archive::read_armap(off_t start, section_size_type size)
279 // To count the total number of archive members, we'll just count
316 gold_error(_("%s: bad archive symbol table names"),
319 // This array keeps track of which symbols are for archive elements
324 // Read the header of an archive member at OFF. Fail if something
329 Archive::read_header(off_t off, bool cache, std::string* pname,
338 // Interpret the header of HDR, the header of the archive member at
343 Archive::interpret_header(const Archive_header* hdr, off_t off,
348 gold_error(_("%s: malformed archive header at %zu"),
368 gold_error(_("%s: malformed archive header size at %zu"),
379 gold_error(_("%s: malformed archive header name at %zu"),
432 // An archive member iterator.
434 class Archive::const_iterator
437 // The header of an archive member. This is what this iterator
445 // The file offset of a nested archive member.
451 const_iterator(Archive* archive, off_t off)
452 : archive_(archive), off_(off)
497 // The underlying archive.
498 Archive* archive_;
501 // The current archive header.
505 // Read the next archive header.
508 Archive::const_iterator::read_next_header()
517 gold_error(_("%s: short archive header at %zu"),
554 Archive::const_iterator
555 Archive::begin()
557 return Archive::const_iterator(this, sarmag);
562 Archive::const_iterator
563 Archive::end()
565 return Archive::const_iterator(this, this->input_file_->file().filesize());
568 // Get the file and offset for an archive member, which may be an
569 // external member of a thin archive. Set *INPUT_FILE to the
571 // within that file (0 if not a nested archive), and *MEMBER_NAME
572 // to the name of the archive member. Return TRUE on success.
575 Archive::get_file_and_offset(off_t off, Input_file** input_file, off_t* memoff,
591 // to the directory containing the archive.
603 // This is a member of a nested archive. Open the containing
604 // archive if we don't already have it open, then do a recursive
605 // call to include the member from that archive.
606 Archive* arch;
621 arch = new Archive(*member_name, *input_file, false, this->dirpath_,
632 // This is an external member of a thin archive. Open the
654 Archive::get_elf_object_for_member(off_t off, bool* punconfigured)
712 // Read the symbols from all the archive members in the link.
715 Archive::read_all_symbols()
717 for (Archive::const_iterator p = this->begin();
723 // Read the symbols from an archive member in the link. OFF is the file
727 Archive::read_symbols(off_t off)
739 // Select members from the archive and add them to the link. We walk
740 // through the elements in the archive map, and look each one up in
744 // may be satisfied by other objects in the archive. Return true in
746 // this archive had an incompatible target.
749 Archive::add_symbols(Symbol_table* symtab, Layout* layout,
752 ++Archive::total_archives;
758 Archive::total_members += this->num_members_;
800 Archive::Should_include t =
801 Archive::should_include_member(symtab, layout, sym_name, &sym,
804 if (t == Archive::SHOULD_INCLUDE_NO
805 || t == Archive::SHOULD_INCLUDE_YES)
808 if (t != Archive::SHOULD_INCLUDE_YES)
837 // Return whether the archive includes a member which defines the
841 Archive::defines_symbol(Symbol* sym) const
873 // Include all the archive members in the link. This is for --whole-archive.
876 Archive::include_all_members(Symbol_table* symtab, Layout* layout,
879 // Don't include the same archive twice. This can happen if
880 // --whole-archive is nested inside --start-group (PR gold/12163).
896 mapfile, NULL, "--whole-archive"))
898 ++Archive::total_members;
903 for (Archive::const_iterator p = this->begin();
908 mapfile, NULL, "--whole-archive"))
910 ++Archive::total_members;
919 // Return the number of members in the archive. This is only used for
923 Archive::count_members()
926 for (Archive::const_iterator p = this->begin();
934 // thin archive. We can't use Task_lock_obj in Archive::include_member
959 // Include an archive member in the link. OFF is the file offset of
963 // archive and it had an incompatible format.
966 Archive::include_member(Symbol_table* symtab, Layout* layout,
970 ++Archive::total_members_loaded;
990 // If this is the first object we are including from this archive,
991 // and we searched for this archive, most likely because it was
993 // to move on to the next archive found in the search path.
1002 // Return false to search for another archive, true if we found
1007 // If the object is an external member of a thin archive,
1045 Archive::do_for_all_unused_symbols(Symbol_visitor_base* v) const
1060 Archive::print_stats()
1062 fprintf(stderr, _("%s: archive libraries: %u\n"),
1063 program_name, Archive::total_archives);
1064 fprintf(stderr, _("%s: total archive members: %u\n"),
1065 program_name, Archive::total_members);
1066 fprintf(stderr, _("%s: loaded archive members: %u\n"),
1067 program_name, Archive::total_members_loaded);
1080 // Return whether we can add the archive symbols. We are blocked by
1121 // This archive holds object files which are incompatible with
1144 // We no longer need to know about this archive.
1149 // The plugin interface may want to rescan this archive.
1205 Archive::Should_include t = obj->should_include_member(symtab,
1210 if (t != Archive::SHOULD_INCLUDE_YES)