diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-11-26 22:24:00 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-11-26 22:24:00 +0100 |
commit | 14fac4364c49414c386efe334533740555bfdf41 (patch) | |
tree | 812b66a91be99c09eccb6c134e6922742b9b3dc1 /gcc | |
parent | 3cf50fcdac65b4174270915d5024fced130b7133 (diff) | |
download | gcc-14fac4364c49414c386efe334533740555bfdf41.zip gcc-14fac4364c49414c386efe334533740555bfdf41.tar.gz gcc-14fac4364c49414c386efe334533740555bfdf41.tar.bz2 |
re PR c++/86900 (-gdwarf-5 -O2 -ffunction-sections = assembler error)
PR c++/86900
* dwarf2out.c (secname_for_decl): For functions with
DECL_SECTION_NAME if in_cold_section_p, try to return
current_function_section's name if it is a named section.
* g++.dg/debug/dwarf2/pr86900.C: New test.
From-SVN: r266485
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/debug/dwarf2/pr86900.C | 14 |
4 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4d6079..42f2ff0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-11-26 Jakub Jelinek <jakub@redhat.com> + + PR c++/86900 + * dwarf2out.c (secname_for_decl): For functions with + DECL_SECTION_NAME if in_cold_section_p, try to return + current_function_section's name if it is a named section. + 2018-11-26 Maya Rashish <coypu@sdf.org> PR target/58397 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9933650..8b64c87 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -16742,7 +16742,15 @@ secname_for_decl (const_tree decl) && DECL_SECTION_NAME (decl)) secname = DECL_SECTION_NAME (decl); else if (current_function_decl && DECL_SECTION_NAME (current_function_decl)) - secname = DECL_SECTION_NAME (current_function_decl); + { + if (in_cold_section_p) + { + section *sec = current_function_section (); + if (sec->common.flags & SECTION_NAMED) + return sec->named.name; + } + secname = DECL_SECTION_NAME (current_function_decl); + } else if (cfun && in_cold_section_p) secname = crtl->subsections.cold_section_label; else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ef9ad1d..7d65607 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-11-26 Jakub Jelinek <jakub@redhat.com> + + PR c++/86900 + * g++.dg/debug/dwarf2/pr86900.C: New test. + 2018-11-26 Jozef Lawrynowicz <jozef.l@mittosystems.com> * gcc.c-torture/compile/20151204.c: Add dg-require-effective-target diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr86900.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr86900.C new file mode 100644 index 0000000..6250f06 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr86900.C @@ -0,0 +1,14 @@ +// PR c++/86900 +// { dg-do assemble { target function_sections } } +// { dg-options "-O2 -gdwarf-5 -ffunction-sections" } + +struct A; +struct B { B (A); }; +struct A { A (int); ~A (); }; + +void +foo (int x) +{ + A d(0); + B e(d); +} |