namespace gold
{
+class General_options;
class Input_file;
class Input_objects;
+class Input_group;
+class Layout;
class Symbol_table;
// This class represents an archive--generally a libNAME.a file.
void
setup();
+ // Get a reference to the underlying file.
+ File_read&
+ file()
+ { return this->input_file_->file(); }
+
// Lock the underlying file.
void
lock()
// Select members from the archive as needed and add them to the
// link.
void
- add_symbols(Symbol_table*, Input_objects*);
+ add_symbols(const General_options&, Symbol_table*, Layout*, Input_objects*);
private:
Archive(const Archive&);
Archive& operator=(const Archive&);
struct Archive_header;
- class Add_archive_symbols_locker;
// Get a view into the underlying file.
const unsigned char*
- get_view(off_t start, off_t size);
+ get_view(off_t start, off_t size)
+ { return this->input_file_->file().get_view(start, size); }
// Read an archive member header at OFF. Return the size of the
// member, and set *PNAME to the name.
// Include an archive member in the link.
void
- include_member(Symbol_table*, Input_objects*, off_t off);
+ include_member(const General_options&, Symbol_table*, Layout*,
+ Input_objects*, off_t off);
// An entry in the archive map of symbols to object files.
struct Armap_entry
std::vector<Armap_entry> armap_;
// The extended name table.
std::string extended_names_;
+ // Track which symbols in the archive map are for elements which
+ // have already been included in the link.
+ std::vector<bool> seen_;
};
// This class is used to read an archive and pick out the desired
class Add_archive_symbols : public Task
{
public:
- Add_archive_symbols(Symbol_table* symtab, Input_objects* input_objects,
- Archive* archive, Task_token* this_blocker,
+ Add_archive_symbols(const General_options& options, Symbol_table* symtab,
+ Layout* layout, Input_objects* input_objects,
+ Archive* archive, Input_group* input_group,
+ Task_token* this_blocker,
Task_token* next_blocker)
- : symtab_(symtab), input_objects_(input_objects), archive_(archive),
- this_blocker_(this_blocker), next_blocker_(next_blocker)
+ : options_(options), symtab_(symtab), layout_(layout),
+ input_objects_(input_objects), archive_(archive),
+ input_group_(input_group), this_blocker_(this_blocker),
+ next_blocker_(next_blocker)
{ }
~Add_archive_symbols();
private:
class Add_archive_symbols_locker;
+ const General_options& options_;
Symbol_table* symtab_;
+ Layout* layout_;
Input_objects* input_objects_;
Archive* archive_;
+ Input_group* input_group_;
Task_token* this_blocker_;
Task_token* next_blocker_;
};