diff options
author | Martin Liska <mliska@suse.cz> | 2019-07-04 16:39:08 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2019-07-29 10:11:44 +0200 |
commit | cc5277b173701364c10204f316db28198f2c683b (patch) | |
tree | a8f2b4749dc337a6e2b265785fe818c247329371 /bfd/elf.c | |
parent | ac50aea1311b01c745afc4dba102a8d20d0eea6e (diff) | |
download | gdb-cc5277b173701364c10204f316db28198f2c683b.zip gdb-cc5277b173701364c10204f316db28198f2c683b.tar.gz gdb-cc5277b173701364c10204f316db28198f2c683b.tar.bz2 |
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.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -999,6 +999,18 @@ convert_zdebug_to_debug (bfd *abfd, const char *name) return new_name; } +/* 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; +}; + /* Make a BFD section from an ELF section. We store a pointer to the BFD section in the bfd_section field of the header. */ @@ -1275,6 +1287,17 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, newsect->flags |= SEC_ELF_RENAME; } + /* 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) + { + struct lto_section lsection; + if (bfd_get_section_contents (abfd, newsect, &lsection, 0, + sizeof (struct lto_section))) + abfd->lto_slim_object = lsection.slim_object; + } + return TRUE; } |