Support .gnu.lto_.lto section in ELF files (PR 24768).

bfd/ChangeLog:

2019-07-22  Martin Liska  <mliska@suse.cz>

	PR 24768
	* archive.c (_bfd_compute_and_write_armap): Come up with
	report_plugin_err variable.
	* bfd-in2.h (struct bfd): Add lto_slim_object flag.
	* elf.c (struct lto_section): New.
	(_bfd_elf_make_section_from_shdr): Parse content of
	.gnu_lto_.lto section.
	* elflink.c: Report error for a missing LTO plugin.
	* linker.c (_bfd_generic_link_add_one_symbol): Likewise.

binutils/ChangeLog:

2019-07-22  Martin Liska  <mliska@suse.cz>

	PR 24768
	* nm.c (filter_symbols): Set report_plugin_err if
	error is reported.
	(display_rel_file): Report error for a missing LTO plugin.

gold/ChangeLog:

2019-07-22  Martin Liska  <mliska@suse.cz>

	PR 24768
	* layout.h (class Layout): Add is_lto_slim_object and
	set_lto_slim_object.
	* object.cc (struct lto_section): Add lto_slim_object_.
	(big_endian>::do_layout): Parse content of
	.gnu_lto_.lto section.
	(big_endian>::do_add_symbols): Report error for a missing
	LTO plugin.
This commit is contained in:
Martin Liska
2019-07-04 16:39:08 +02:00
parent ac50aea131
commit cc5277b173
11 changed files with 157 additions and 14 deletions

View File

@@ -438,6 +438,10 @@ print_symdef_entry (bfd *abfd)
}
}
/* True when we can report missing plugin error. */
bfd_boolean report_plugin_err = TRUE;
/* Choose which symbol entries to print;
compact them downward to get rid of the rest.
Return the number of symbols to be printed. */
@@ -470,9 +474,13 @@ filter_symbols (bfd *abfd, bfd_boolean is_dynamic, void *minisyms,
if (sym->name[0] == '_'
&& sym->name[1] == '_'
&& strcmp (sym->name + (sym->name[2] == '_'), "__gnu_lto_slim") == 0)
non_fatal (_("%s: plugin needed to handle lto object"),
bfd_get_filename (abfd));
&& strcmp (sym->name + (sym->name[2] == '_'), "__gnu_lto_slim") == 0
&& report_plugin_err)
{
report_plugin_err = FALSE;
non_fatal (_("%s: plugin needed to handle lto object"),
bfd_get_filename (abfd));
}
if (undefined_only)
keep = bfd_is_und_section (sym->section);
@@ -1164,6 +1172,15 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
}
}
/* lto_slim_object is set to false when a bfd is loaded with a compiler
LTO plugin. */
if (abfd->lto_slim_object)
{
report_plugin_err = FALSE;
non_fatal (_("%s: plugin needed to handle lto object"),
bfd_get_filename (abfd));
}
/* Discard the symbols we don't want to print.
It's OK to do this in place; we'll free the storage anyway
(after printing). */