diff options
author | Richard Biener <rguenther@suse.de> | 2018-07-17 12:26:21 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-07-17 12:26:21 +0000 |
commit | 3447025f2fcd2d0fde2e9f6778f633283fed2a48 (patch) | |
tree | 30117e4be50ee441b184938758cbebe909bc3554 | |
parent | 5211d26a2663bfb88992102952e809bd3da7e274 (diff) | |
download | gcc-3447025f2fcd2d0fde2e9f6778f633283fed2a48.zip gcc-3447025f2fcd2d0fde2e9f6778f633283fed2a48.tar.gz gcc-3447025f2fcd2d0fde2e9f6778f633283fed2a48.tar.bz2 |
re PR debug/86456 (Segfault in switch_to_section at gcc/varasm.c:7353 since r259317)
2018-07-17 Richard Biener <rguenther@suse.de>
PR lto/86456
* dwarf2out.c (init_sections_and_labels): Always generate
a debug_line_str_section for early LTO debug.
(dwarf2out_finish): Reset debug_line_str_hash output early.
Bump counter for extra dwarf5 .debug_loc labels to not conflict
with fat LTO part.
(dwarf2out_early_finish): Output debug_line_str.
* g++.dg/debug/dwarf2/pr86456.C: New testcase.
From-SVN: r262819
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/debug/dwarf2/pr86456.C | 5 |
4 files changed, 35 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53c4d24..b87c00a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-07-17 Richard Biener <rguenther@suse.de> + + PR lto/86456 + * dwarf2out.c (init_sections_and_labels): Always generate + a debug_line_str_section for early LTO debug. + (dwarf2out_finish): Reset debug_line_str_hash output early. + Bump counter for extra dwarf5 .debug_loc labels to not conflict + with fat LTO part. + (dwarf2out_early_finish): Output debug_line_str. + 2018-07-17 Robin Dapp <rdapp@linux.ibm.com> * config/s390/s390.c (preferred_la_operand_p): Do not use LA with diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 1e33cf0..bd45e0b 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -28488,7 +28488,7 @@ init_sections_and_labels (bool early_lto_debug) debug_str_section = get_section (DEBUG_LTO_STR_SECTION, DEBUG_STR_SECTION_FLAGS | SECTION_EXCLUDE, NULL); - if (!dwarf_split_debug_info && !output_asm_line_debug_info ()) + if (!dwarf_split_debug_info) debug_line_str_section = get_section (DEBUG_LTO_LINE_STR_SECTION, DEBUG_STR_SECTION_FLAGS | SECTION_EXCLUDE, NULL); @@ -31149,6 +31149,11 @@ dwarf2out_finish (const char *) /* Remove indirect string decisions. */ debug_str_hash->traverse<void *, reset_indirect_string> (NULL); + if (debug_line_str_hash) + { + debug_line_str_hash->traverse<void *, reset_indirect_string> (NULL); + debug_line_str_hash = NULL; + } } #if ENABLE_ASSERT_CHECKING @@ -31433,8 +31438,8 @@ dwarf2out_finish (const char *) switch_to_section (debug_loc_section); if (dwarf_version >= 5) { - ASM_GENERATE_INTERNAL_LABEL (l1, DEBUG_LOC_SECTION_LABEL, 1); - ASM_GENERATE_INTERNAL_LABEL (l2, DEBUG_LOC_SECTION_LABEL, 2); + ASM_GENERATE_INTERNAL_LABEL (l1, DEBUG_LOC_SECTION_LABEL, 2); + ASM_GENERATE_INTERNAL_LABEL (l2, DEBUG_LOC_SECTION_LABEL, 3); if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4) dw2_asm_output_data (4, 0xffffffff, "Initial length escape value indicating " @@ -32053,6 +32058,13 @@ dwarf2out_early_finish (const char *filename) /* If we emitted any indirect strings, output the string table too. */ if (debug_str_hash || skeleton_debug_str_hash) output_indirect_strings (); + if (debug_line_str_hash) + { + switch_to_section (debug_line_str_section); + const enum dwarf_form form = DW_FORM_line_strp; + debug_line_str_hash->traverse<enum dwarf_form, + output_indirect_string> (form); + } /* Switch back to the text section. */ switch_to_section (text_section); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index addeb04..ec76467 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-07-17 Richard Biener <rguenther@suse.de> + + PR lto/86456 + * g++.dg/debug/dwarf2/pr86456.C: New testcase. + 2018-07-17 Robin Dapp <rdapp@linux.ibm.com> * gcc.target/s390/function-align1.c: New test. diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr86456.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr86456.C new file mode 100644 index 0000000..56e08f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr86456.C @@ -0,0 +1,5 @@ +// { dg-do compile } +// { dg-require-effective-target lto } +// { dg-options "-g -gdwarf-5 -flto -ffat-lto-objects" } + +int a; |