X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gold%2Fobject.cc;h=c486a2011d5c4d5167272ca83d93cd20f90bbf3d;hb=7ef412cf72a197d68e532604cc1fa21351adc858;hp=689448f50c8a784d1142032875203ffc1d28661f;hpb=827041555ac443bd57340060f3e034fd7b199dd8;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/object.cc b/gold/object.cc index 689448f50c..c486a2011d 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -1,6 +1,6 @@ // object.cc -- support for an object file for linking in gold -// Copyright (C) 2006-2019 Free Software Foundation, Inc. +// Copyright (C) 2006-2020 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -1380,6 +1380,18 @@ Sized_relobj_file::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,23 @@ Sized_relobj_file::do_layout(Symbol_table* symtab, debug_types_sections.push_back(i); } } + + /* GCC uses .gnu.lto_.lto. 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); + if (contents_len >= sizeof(lto_section)) + { + const lto_section* lsection + = reinterpret_cast(pcontents); + if (lsection->slim_object) + layout->set_lto_slim_object(); + } + } } if (!is_pass_two) @@ -2083,7 +2112,7 @@ template void Sized_relobj_file::do_add_symbols(Symbol_table* symtab, Read_symbols_data* sd, - Layout*) + Layout* layout) { if (sd->symbols == NULL) { @@ -2102,6 +2131,11 @@ Sized_relobj_file::do_add_symbols(Symbol_table* symtab, this->symbols_.resize(symcount); + if (!parameters->options().relocatable() + && layout->is_lto_slim_object ()) + gold_info(_("%s: plugin needed to handle lto object"), + this->name().c_str()); + const char* sym_names = reinterpret_cast(sd->symbol_names->data()); symtab->add_from_relobj(this, @@ -2612,6 +2646,10 @@ Sized_relobj_file::do_finalize_local_symbols( lv->set_output_symtab_index(index); ++index; } + if (lv->is_ifunc_symbol() + && (lv->has_output_symtab_entry() + || lv->needs_output_dynsym_entry())) + symtab->set_has_gnu_output(); break; case CFLV_DISCARDED: case CFLV_ERROR: