[windows] : Fix regression about -gcoff1

Submitted by Kai Tietz on Jan. 9, 2011, 2:04 p.m.

Details

Message ID AANLkTikj=2u2SnTqjdBcTArrxQpuUOJhQH1OqJDPJAHp@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Jan. 9, 2011, 2:04 p.m.
Hello,

While running g++.dg/debug testsuite I noticed regression about
-gcoff1 and wrong section use. The coff1 debugging information changes
section to .text and doesn't restore it back to function decl's
section. This is cause that function gets placed within wrong section.

2011-01-09  Kai Tietz

	* config/i386/winnt.c (i386_pe_start_function): Make sure
        to switch back to function's section.

Tested for x86_64-w64-mingw32 and i686-pc-mingw32. I'll apply it in a
couple of hours if there are no objections.

Regards,
Kai

Comments

Kai Tietz Jan. 9, 2011, 4:20 p.m.
2011/1/9 Kai Tietz <ktietz70@googlemail.com>:
> Hello,
>
> While running g++.dg/debug testsuite I noticed regression about
> -gcoff1 and wrong section use. The coff1 debugging information changes
> section to .text and doesn't restore it back to function decl's
> section. This is cause that function gets placed within wrong section.
>
> 2011-01-09  Kai Tietz
>
>        * config/i386/winnt.c (i386_pe_start_function): Make sure
>        to switch back to function's section.
>
> Tested for x86_64-w64-mingw32 and i686-pc-mingw32. I'll apply it in a
> couple of hours if there are no objections.
>
> Regards,
> Kai
>
> Index: winnt.c
> ===================================================================
> --- winnt.c     (revision 168611)
> +++ winnt.c     (working copy)
> @@ -1101,6 +1101,9 @@
>   i386_pe_maybe_record_exported_symbol (decl, name, 0);
>   if (write_symbols != SDB_DEBUG)
>     i386_pe_declare_function_type (f, name, TREE_PUBLIC (decl));
> +  /* In case section was altered by debugging output.  */
> +  if (decl != NULL_TREE)
> +    switch_to_section (function_section (decl));
>   ASM_OUTPUT_FUNCTION_LABEL (f, name, decl);
>  }
>

Applied at revision 168615.

Kai

Patch hide | download patch | download mbox

Index: winnt.c
===================================================================
--- winnt.c     (revision 168611)
+++ winnt.c     (working copy)
@@ -1101,6 +1101,9 @@ 
   i386_pe_maybe_record_exported_symbol (decl, name, 0);
   if (write_symbols != SDB_DEBUG)
     i386_pe_declare_function_type (f, name, TREE_PUBLIC (decl));
+  /* In case section was altered by debugging output.  */
+  if (decl != NULL_TREE)
+    switch_to_section (function_section (decl));
   ASM_OUTPUT_FUNCTION_LABEL (f, name, decl);
 }