aboutsummaryrefslogtreecommitdiff
path: root/elfcpp
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2021-03-17 21:31:15 -0700
committerCary Coutant <ccoutant@gmail.com>2021-03-19 13:55:35 -0700
commit5cde809b7b9da3ad3aa0d65f0e5e92ab199d64f0 (patch)
tree35266cd948da34e9848af2519d2faef4b813d260 /elfcpp
parente0d6d274068b02d952852b18adb3feaca1d2bb8a (diff)
downloadfsf-binutils-gdb-5cde809b7b9da3ad3aa0d65f0e5e92ab199d64f0.zip
fsf-binutils-gdb-5cde809b7b9da3ad3aa0d65f0e5e92ab199d64f0.tar.gz
fsf-binutils-gdb-5cde809b7b9da3ad3aa0d65f0e5e92ab199d64f0.tar.bz2
Add DWARF 5 support in gold.
elfcpp/ PR gold/27246 * dwarf.h (enum DW_LNCT): Add line number table content type codes. (enum DW_LINE_OPS): Reformat. (enum DW_LINE_EXTENDED_OPS): Reformat. (enum DW_CHILDREN): Reformat. (enum DW_RLE): Add range list entry types. (enum DW_SECT): Update values for DWARF 5. gold/ PR gold/27246 * dwarf_reader.cc (Dwarf_abbrev_table::do_get_abbrev): Handle DW_FORM_implicit_const. (Dwarf_ranges_table::read_ranges_table): Add version parameter; Adjust all callers. Look for .debug_rnglists section if DWARF 5. (Dwarf_ranges_table::read_range_list_v5): New method. (Dwarf_die::read_attributes): Handle new DWARF 5 DW_FORM codes. (Dwarf_die::skip_attributes): Likewise. (Dwarf_info_reader::do_parse): Support DWARF 5 unit header format. (Dwarf_info_reader::read_3bytes_from_pointer): New method. (Sized_dwarf_line_info::Sized_dwarf_line_info): Initialize str_buffer_, str_buffer_start, reloc_map_, line_number_map_. Look for .debug_line_str section. (Sized_dwarf_line_info::read_header_prolog): Support DWARF 5 prolog. (Sized_dwarf_line_info::read_header_tables): Rename to... (Sized_dwarf_line_info::read_header_tables_v2): ... this. (Sized_dwarf_line_info::read_header_tables_v5): New method. (Sized_dwarf_line_info::process_one_opcode): Insert missing "this->". Change advance_line to signed int64_t. (Sized_dwarf_line_info::read_lines): Add endptr parameter; adjust callers. Insert missing "this->". (Sized_dwarf_line_info::read_line_mappings): Support DWARF 5. (Sized_dwarf_line_info::do_addr2line): Add debug code. * dwarf_reader.h (Dwarf_abbrev_table::Attribute): Add implicit_const field. Adjust constructor. (Dwarf_abbrev_table::add_sttribute): Add implicit_const parameter. (Dwarf_ranges_table::read_ranges_table): Add version parameter. (Dwarf_ranges_table::read_range_list_v5): New method. (Dwarf_die): Remove unused attr_off field. (Dwarf_info_reader::Dwarf_info_reader): Initialize unit_type_ field. (Dwarf_info_reader::is_type_unit): New method. (Dwarf_info_reader::read_3bytes_from_pointer): New method. (Dwarf_info_reader::read_range_list): Call read_range_list_v5 for DWARF 5 range lists. (Dwarf_info_reader::is_type_unit_): Remove. (Dwarf_info_reader::unit_type_): New field. (Sized_dwarf_line_info::~Sized_dwarf_line_info): Delete str_buffer_start_. (Sized_dwarf_line_info::read_header_tables): Rename to... (Sized_dwarf_line_info::read_header_tables_v2): ... this. (Sized_dwarf_line_info::read_header_tables_v5): New method. (Sized_dwarf_line_info::read_lines): Add endptr parameter. (Sized_dwarf_line_info::Dwarf_line_infoHeader): Add address_size field. (Sized_dwarf_line_info::str_buffer_): New field. (Sized_dwarf_line_info::str_buffer_end_): New field. (Sized_dwarf_line_info::str_buffer_start_): New field. (Sized_dwarf_line_info::end_of_header_length_): New field. (Sized_dwarf_line_info::end_of_unit_): New field.
Diffstat (limited to 'elfcpp')
-rw-r--r--elfcpp/ChangeLog10
-rw-r--r--elfcpp/dwarf.h89
2 files changed, 71 insertions, 28 deletions
diff --git a/elfcpp/ChangeLog b/elfcpp/ChangeLog
index 069b7dc..afc32c9 100644
--- a/elfcpp/ChangeLog
+++ b/elfcpp/ChangeLog
@@ -1,3 +1,13 @@
+2021-03-19 Cary Coutant <ccoutant@gmail.com>
+
+ PR gold/27246
+ * dwarf.h (enum DW_LNCT): Add line number table content type codes.
+ (enum DW_LINE_OPS): Reformat.
+ (enum DW_LINE_EXTENDED_OPS): Reformat.
+ (enum DW_CHILDREN): Reformat.
+ (enum DW_RLE): Add range list entry types.
+ (enum DW_SECT): Update values for DWARF 5.
+
2021-01-09 Nick Clifton <nickc@redhat.com>
* 2.36 release branch crated.
diff --git a/elfcpp/dwarf.h b/elfcpp/dwarf.h
index e24347f..c9a9e02 100644
--- a/elfcpp/dwarf.h
+++ b/elfcpp/dwarf.h
@@ -152,35 +152,48 @@ enum DW_EH_PE
DW_EH_PE_indirect = 0x80
};
+// Line number table content type codes.
+
+enum DW_LNCT
+{
+ DW_LNCT_path = 0x1,
+ DW_LNCT_directory_index = 0x2,
+ DW_LNCT_timestamp = 0x3,
+ DW_LNCT_size = 0x4,
+ DW_LNCT_MD5 = 0x5,
+ DW_LNCT_lo_user = 0x2000,
+ DW_LNCT_hi_user = 0x3fff
+};
+
// Line number opcodes.
enum DW_LINE_OPS
{
- DW_LNS_extended_op = 0,
- DW_LNS_copy = 1,
- DW_LNS_advance_pc = 2,
- DW_LNS_advance_line = 3,
- DW_LNS_set_file = 4,
- DW_LNS_set_column = 5,
- DW_LNS_negate_stmt = 6,
- DW_LNS_set_basic_block = 7,
- DW_LNS_const_add_pc = 8,
- DW_LNS_fixed_advance_pc = 9,
+ DW_LNS_extended_op = 0x00,
+ DW_LNS_copy = 0x01,
+ DW_LNS_advance_pc = 0x02,
+ DW_LNS_advance_line = 0x03,
+ DW_LNS_set_file = 0x04,
+ DW_LNS_set_column = 0x05,
+ DW_LNS_negate_stmt = 0x06,
+ DW_LNS_set_basic_block = 0x07,
+ DW_LNS_const_add_pc = 0x08,
+ DW_LNS_fixed_advance_pc = 0x09,
// DWARF 3.
- DW_LNS_set_prologue_end = 10,
- DW_LNS_set_epilogue_begin = 11,
- DW_LNS_set_isa = 12
+ DW_LNS_set_prologue_end = 0x0a,
+ DW_LNS_set_epilogue_begin = 0x0b,
+ DW_LNS_set_isa = 0x0c
};
// Line number extended opcodes.
enum DW_LINE_EXTENDED_OPS
{
- DW_LNE_end_sequence = 1,
- DW_LNE_set_address = 2,
- DW_LNE_define_file = 3,
+ DW_LNE_end_sequence = 0x01,
+ DW_LNE_set_address = 0x02,
+ DW_LNE_define_file = 0x03,
// DWARF4.
- DW_LNE_set_discriminator = 4,
+ DW_LNE_set_discriminator = 0x04,
// HP extensions.
DW_LNE_HP_negate_is_UV_update = 0x11,
DW_LNE_HP_push_context = 0x12,
@@ -191,13 +204,15 @@ enum DW_LINE_EXTENDED_OPS
DW_LNE_HP_negate_post_semantics = 0x17,
DW_LNE_HP_negate_function_exit = 0x18,
DW_LNE_HP_negate_front_end_logical = 0x19,
- DW_LNE_HP_define_proc = 0x20
+ DW_LNE_HP_define_proc = 0x20,
+ DW_LNE_lo_user = 0x80,
+ DW_LNE_hi_user = 0xff
};
enum DW_CHILDREN
{
- DW_CHILDREN_no =0x00,
- DW_CHILDREN_yes =0x01
+ DW_CHILDREN_no = 0,
+ DW_CHILDREN_yes = 1
};
// Source language names and codes.
@@ -247,20 +262,38 @@ enum DW_LANG
DW_LANG_HP_Assembler = 0x8007
};
+// Range list entry kinds in .debug_rnglists* section.
+
+enum DW_RLE
+{
+ DW_RLE_end_of_list = 0x00,
+ DW_RLE_base_addressx = 0x01,
+ DW_RLE_startx_endx = 0x02,
+ DW_RLE_startx_length = 0x03,
+ DW_RLE_offset_pair = 0x04,
+ DW_RLE_base_address = 0x05,
+ DW_RLE_start_end = 0x06,
+ DW_RLE_start_length = 0x07
+};
+
// DWARF section identifiers used in the package format.
// Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFissionDWP.
+// Added (with changes) in DWARF 5.
enum DW_SECT
{
- DW_SECT_INFO = 1,
- DW_SECT_TYPES = 2,
- DW_SECT_ABBREV = 3,
- DW_SECT_LINE = 4,
- DW_SECT_LOC = 5,
+ DW_SECT_INFO = 1,
+ DW_SECT_ABBREV = 3,
+ DW_SECT_LINE = 4,
+ DW_SECT_LOCLISTS = 5,
DW_SECT_STR_OFFSETS = 6,
- DW_SECT_MACINFO = 7,
- DW_SECT_MACRO = 8,
- DW_SECT_MAX = DW_SECT_MACRO,
+ DW_SECT_MACINFO = 7,
+ DW_SECT_RNGLISTS = 8,
+ DW_SECT_MAX = DW_SECT_RNGLISTS,
+ // These were used only for the experimental Fission support in DWARF 4.
+ DW_SECT_TYPES = 2,
+ DW_SECT_LOC = 5,
+ DW_SECT_MACRO = 8
};
} // End namespace elfcpp.