diff options
Diffstat (limited to 'gold/object.cc')
-rw-r--r-- | gold/object.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/gold/object.cc b/gold/object.cc index 689448f..86c519a 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -1380,6 +1380,18 @@ Sized_relobj_file<size, big_endian>::layout_gnu_property_section( } } +// This a copy of lto_section defined in GCC (lto-streamer.h) + +struct lto_section +{ + int16_t major_version; + int16_t minor_version; + unsigned char slim_object; + + /* Flags is a private field that is not defined publicly. */ + uint16_t flags; +}; + // Lay out the input sections. We walk through the sections and check // whether they should be included in the link. If they should, we // pass them to the Layout object, which will return an output section @@ -1865,6 +1877,19 @@ Sized_relobj_file<size, big_endian>::do_layout(Symbol_table* symtab, debug_types_sections.push_back(i); } } + + /* GCC uses .gnu.lto_.lto.<some_hash> as a LTO bytecode information + section. */ + const char *lto_section_name = ".gnu.lto_.lto."; + if (strncmp (name, lto_section_name, strlen (lto_section_name)) == 0) + { + section_size_type contents_len; + const unsigned char* pcontents = this->section_contents(i, &contents_len, false); + struct lto_section lsection = *(const lto_section*)pcontents; + if (lsection.slim_object) + gold_info(_("%s: plugin needed to handle lto object"), + this->name().c_str()); + } } if (!is_pass_two) @@ -2083,7 +2108,7 @@ template<int size, bool big_endian> void Sized_relobj_file<size, big_endian>::do_add_symbols(Symbol_table* symtab, Read_symbols_data* sd, - Layout*) + Layout* layout) { if (sd->symbols == NULL) { @@ -2102,6 +2127,10 @@ Sized_relobj_file<size, big_endian>::do_add_symbols(Symbol_table* symtab, this->symbols_.resize(symcount); + if (layout->is_lto_slim_object ()) + gold_info(_("%s: plugin needed to handle lto object"), + this->name().c_str()); + const char* sym_names = reinterpret_cast<const char*>(sd->symbol_names->data()); symtab->add_from_relobj(this, |