]>
Commit | Line | Data |
---|---|---|
f0855b75 PS |
1 | --- a/gold/archive.cc |
2 | +++ a/gold/archive.cc | |
3 | @@ -179,7 +179,8 @@ Archive::Archive(const std::string& name, Input_file* input_file, | |
4 | : Library_base(task), name_(name), input_file_(input_file), armap_(), | |
5 | armap_names_(), extended_names_(), armap_checked_(), seen_offsets_(), | |
6 | members_(), is_thin_archive_(is_thin_archive), included_member_(false), | |
7 | - nested_archives_(), dirpath_(dirpath), num_members_(0) | |
8 | + nested_archives_(), dirpath_(dirpath), num_members_(0), | |
9 | + included_all_members_(false) | |
10 | { | |
11 | this->no_export_ = | |
12 | parameters->options().check_excluded_libs(input_file->found_name()); | |
13 | @@ -847,6 +848,13 @@ bool | |
14 | Archive::include_all_members(Symbol_table* symtab, Layout* layout, | |
15 | Input_objects* input_objects, Mapfile* mapfile) | |
16 | { | |
17 | + // Don't include the same archive twice. This can happen if | |
18 | + // --whole-archive is nested inside --start-group (PR gold/12163). | |
19 | + if (this->included_all_members_) | |
20 | + return true; | |
21 | + | |
22 | + this->included_all_members_ = true; | |
23 | + | |
24 | input_objects->archive_start(this); | |
25 | ||
26 | if (this->members_.size() > 0) | |
27 | --- a/gold/archive.h | |
28 | +++ a/gold/archive.h | |
29 | @@ -405,6 +405,8 @@ class Archive : public Library_base | |
30 | unsigned int num_members_; | |
31 | // True if we exclude this library archive from automatic export. | |
32 | bool no_export_; | |
33 | + // True if this library has been included as a --whole-archive. | |
34 | + bool included_all_members_; | |
35 | }; | |
36 | ||
37 | // This class is used to read an archive and pick out the desired |