This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][LTO] Use string table in LTO info -- 2nd attempt with support for relocations


[once again, with the patch this time...]

This patch modifies the LTO reader to read the .debug_str section,
if present, and to resolve DW_FORM_strp attributes.  It also removes
the workaround in dwarf2out.c for the previous inability of LTO to grok
string table references.  My previous patch failed on x86_64 and
other platforms that use RELA-style relocation records.  This patch
applies relocations to the .debug_info section using code adapted
from binutils/readelf.c.  This code uses a "shortcut" method that is
believed to be adequate for our purposes, and avoids the need to
pull in the BFD library or introduce target platform dependent code
into the LTO front end.  We note that it does not handle all possible
relocations correctly. however, and is intended to resolve only
DWARF reference-class attributes.  This patch has been tested with
the C torture test suite on both i686 and x86_64.

gcc/
     * dwarf2out.c (AT_string_form): Remove code to suppress
     the use of the DWARF string table.

gcc/lto
     * lto.c (lto_str_fd_init): New function.
     (lto_str_fd_close): New function.
     (lto_file_init): Call lto_str_fd_init.
     (lto_file_close): Call lto_str_fd_close.
     (lto_str_read): New function. Read debug string table.
     (lto_str_lookup): New function. Get string for debug
     string table offset.
     (lto_read_form): Recognize DW_FORM_strp.
     (lto_file_read): Invoke lto_str_read.

     * lto-elf.c (lto_elf_byte_get): New function.
     (lto_elf_byte_put): New function.
     (lto_elf_apply_rela_addends): New function.
     (lto_elf_relocate_debug_info): New function.
     (lto_elf_file_open): Read raw section data
     for the .debug_str section, if present. Read and
     apply relocations to .debug_info section if needed.

     * lto.h (struct lto_str_fd_struct): New struct.
     (struct lto_file_struct): Added new field DEBUG_STR
     to hold the file descriptor for the debug string table.

Attachment: stringtable-patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]