From d29bd378ab8da3e646e3735c5ba140ec07f3c9fa Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 11 Jan 2017 17:46:15 +0100 Subject: [PATCH] dwarf2out.c (DWARF_COMPILE_UNIT_HEADER_SIZE): For DWARF5 decrease by 12. * dwarf2out.c (DWARF_COMPILE_UNIT_HEADER_SIZE): For DWARF5 decrease by 12. (DWARF_COMDAT_TYPE_UNIT_HEADER_SIZE): Always DWARF_COMPILE_UNIT_HEADER_SIZE plus 12. (DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE): Define. (calc_base_type_die_sizes): Use DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE for initial die_offset if dwarf_split_debug_info. (output_comp_unit): Use DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE for initial next_die_offset if dwo_id is non-NULL. Don't emit padding fields. (output_skeleton_debug_sections): Formatting fix. Use DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE instead of DWARF_COMPILE_UNIT_HEADER_SIZE. Don't emit padding. From-SVN: r244323 --- gcc/ChangeLog | 16 ++++++++++++++++ gcc/dwarf2out.c | 37 +++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d0aae19cc41..c9a17625565 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2017-01-11 Jakub Jelinek + + * dwarf2out.c (DWARF_COMPILE_UNIT_HEADER_SIZE): For DWARF5 decrease + by 12. + (DWARF_COMDAT_TYPE_UNIT_HEADER_SIZE): Always + DWARF_COMPILE_UNIT_HEADER_SIZE plus 12. + (DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE): Define. + (calc_base_type_die_sizes): Use DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE + for initial die_offset if dwarf_split_debug_info. + (output_comp_unit): Use DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE for + initial next_die_offset if dwo_id is non-NULL. Don't emit padding + fields. + (output_skeleton_debug_sections): Formatting fix. Use + DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE instead of + DWARF_COMPILE_UNIT_HEADER_SIZE. Don't emit padding. + 2017-01-11 Wilco Dijkstra * config/arm/cortex-a53.md: Add bypasses for diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9da69dfa2c6..d3b268ad037 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -2996,14 +2996,16 @@ skeleton_chain_node; /* Fixed size portion of the DWARF compilation unit header. */ #define DWARF_COMPILE_UNIT_HEADER_SIZE \ (DWARF_INITIAL_LENGTH_SIZE + DWARF_OFFSET_SIZE \ - + (dwarf_version >= 5 \ - ? 4 + DWARF_TYPE_SIGNATURE_SIZE + DWARF_OFFSET_SIZE : 3)) + + (dwarf_version >= 5 ? 4 : 3)) /* Fixed size portion of the DWARF comdat type unit header. */ #define DWARF_COMDAT_TYPE_UNIT_HEADER_SIZE \ (DWARF_COMPILE_UNIT_HEADER_SIZE \ - + (dwarf_version >= 5 \ - ? 0 : DWARF_TYPE_SIGNATURE_SIZE + DWARF_OFFSET_SIZE)) + + DWARF_TYPE_SIGNATURE_SIZE + DWARF_OFFSET_SIZE) + +/* Fixed size portion of the DWARF skeleton compilation unit header. */ +#define DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE \ + (DWARF_COMPILE_UNIT_HEADER_SIZE + (dwarf_version >= 5 ? 8 : 0)) /* Fixed size portion of public names info. */ #define DWARF_PUBNAMES_HEADER_SIZE (2 * DWARF_OFFSET_SIZE + 2) @@ -9066,7 +9068,9 @@ calc_die_sizes (dw_die_ref die) static void calc_base_type_die_sizes (void) { - unsigned long die_offset = DWARF_COMPILE_UNIT_HEADER_SIZE; + unsigned long die_offset = (dwarf_split_debug_info + ? DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE + : DWARF_COMPILE_UNIT_HEADER_SIZE); unsigned int i; dw_die_ref base_type; #if ENABLE_ASSERT_CHECKING @@ -10327,7 +10331,9 @@ output_comp_unit (dw_die_ref die, int output_if_empty, delete extern_map; /* Initialize the beginning DIE offset - and calculate sizes/offsets. */ - next_die_offset = DWARF_COMPILE_UNIT_HEADER_SIZE; + next_die_offset = (dwo_id + ? DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE + : DWARF_COMPILE_UNIT_HEADER_SIZE); calc_die_sizes (die); oldsym = die->die_id.die_symbol; @@ -10355,12 +10361,6 @@ output_comp_unit (dw_die_ref die, int output_if_empty, if (dwo_id != NULL) for (int i = 0; i < 8; i++) dw2_asm_output_data (1, dwo_id[i], i == 0 ? "DWO id" : NULL); - else - /* Hope all the padding will be removed for DWARF 5 final for - DW_AT_compile and DW_AT_partial. */ - dw2_asm_output_data (8, 0, "Padding 1"); - - dw2_asm_output_data (DWARF_OFFSET_SIZE, 0, "Padding 2"); } output_die (die); @@ -10455,10 +10455,11 @@ output_skeleton_debug_sections (dw_die_ref comp_unit, header. */ if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4) dw2_asm_output_data (4, 0xffffffff, - "Initial length escape value indicating 64-bit DWARF extension"); + "Initial length escape value indicating 64-bit " + "DWARF extension"); dw2_asm_output_data (DWARF_OFFSET_SIZE, - DWARF_COMPILE_UNIT_HEADER_SIZE + DWARF_COMPILE_UNIT_SKELETON_HEADER_SIZE - DWARF_INITIAL_LENGTH_SIZE + size_of_die (comp_unit), "Length of Compilation Unit Info"); @@ -10474,12 +10475,8 @@ output_skeleton_debug_sections (dw_die_ref comp_unit, if (dwarf_version < 5) dw2_asm_output_data (1, DWARF2_ADDR_SIZE, "Pointer Size (in bytes)"); else - { - for (int i = 0; i < 8; i++) - dw2_asm_output_data (1, dwo_id[i], i == 0 ? "DWO id" : NULL); - - dw2_asm_output_data (DWARF_OFFSET_SIZE, 0, "Padding 2"); - } + for (int i = 0; i < 8; i++) + dw2_asm_output_data (1, dwo_id[i], i == 0 ? "DWO id" : NULL); comp_unit->die_abbrev = SKELETON_COMP_DIE_ABBREV; output_die (comp_unit); -- 2.30.2