Patchwork [ping] couple of fixes for DWARF2 EH on Win32

login
register
mail settings
Submitter Eric Botcazou
Date Nov. 5, 2010, 7:10 p.m.
Message ID <201011052010.02409.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/70284/
State New
Headers show

Comments

Eric Botcazou - Nov. 5, 2010, 7:10 p.m.
> yeah both patches are ok. The changes in t-mingw* should be superflous
> for newer mingw runtimes. For compatiblility sake they are ok.

Thanks.

> As the dw2 unwinder code is just of use for 32-bit, I have no
> objections (there are some pointer/long casts withing that code, which
> are fitting well to x64 win32's LLP64).

FWIW we do use 64-bit DWARF-2 EH on Windows in our compilers and this works 
almost out of the box (you have to enable it of course).  For the sake of 
completeness, I'm posting the attached patchlet that is needed to make it 
work with GCC 4.5 and later, but might be of interest to those playing with 
the DWARF-2 unwinder on 64-bit Windows and so worth integrating in the tree.
It is necessary in order to avoid buffer overruns caused by the different set 
of call-used registers with the MS ABI.


2010-11-05  Eric Botcazou  <ebotcazou@adacore.com>
            Pascal Obry  <obry@adacore.com>

	* config/i386/cygming.h (DWARF_FRAME_REGISTERS): Redefine.  Use 33
	in 64-bit mode and 17 otherwise.
Kai Tietz - Nov. 5, 2010, 7:25 p.m.
2010/11/5 Eric Botcazou <ebotcazou@adacore.com>:
>> yeah both patches are ok. The changes in t-mingw* should be superflous
>> for newer mingw runtimes. For compatiblility sake they are ok.
>
> Thanks.
>
>> As the dw2 unwinder code is just of use for 32-bit, I have no
>> objections (there are some pointer/long casts withing that code, which
>> are fitting well to x64 win32's LLP64).
>
> FWIW we do use 64-bit DWARF-2 EH on Windows in our compilers and this works
> almost out of the box (you have to enable it of course).  For the sake of
> completeness, I'm posting the attached patchlet that is needed to make it
> work with GCC 4.5 and later, but might be of interest to those playing with
> the DWARF-2 unwinder on 64-bit Windows and so worth integrating in the tree.
> It is necessary in order to avoid buffer overruns caused by the different set
> of call-used registers with the MS ABI.
>
>
> 2010-11-05  Eric Botcazou  <ebotcazou@adacore.com>
>            Pascal Obry  <obry@adacore.com>
>
>        * config/i386/cygming.h (DWARF_FRAME_REGISTERS): Redefine.  Use 33
>        in 64-bit mode and 17 otherwise.
>
>
> --
> Eric Botcazou
>

Thanks, patch is ok. Yes, dw2 unwinding support is of course of some
interest for x64 (at least as long x64 SEH isn't active).

Regards,
Kai
Dave Korn - Nov. 5, 2010, 7:46 p.m.
On 05/11/2010 19:10, Eric Botcazou wrote:

> FWIW we do use 64-bit DWARF-2 EH on Windows in our compilers and this works 
> almost out of the box (you have to enable it of course).  For the sake of 
> completeness, I'm posting the attached patchlet that is needed to make it 
> work with GCC 4.5 and later, but might be of interest to those playing with 
> the DWARF-2 unwinder on 64-bit Windows and so worth integrating in the tree.
> It is necessary in order to avoid buffer overruns caused by the different set 
> of call-used registers with the MS ABI.
> 
> 
> 2010-11-05  Eric Botcazou  <ebotcazou@adacore.com>
>             Pascal Obry  <obry@adacore.com>
> 
> 	* config/i386/cygming.h (DWARF_FRAME_REGISTERS): Redefine.  Use 33
> 	in 64-bit mode and 17 otherwise.

  That's OK.  Thank you.

    cheers,
      DaveK

Patch

Index: config/i386/cygming.h
===================================================================
--- config/i386/cygming.h	(revision 166350)
+++ config/i386/cygming.h	(working copy)
@@ -84,6 +84,10 @@  along with GCC; see the file COPYING3.
   (TARGET_64BIT ? dbx64_register_map[(n)]		\
 		: svr4_dbx_register_map[(n)])
 
+/* The MS_ABI changes the set of call-used registers.  */
+#undef DWARF_FRAME_REGISTERS
+#define DWARF_FRAME_REGISTERS (TARGET_64BIT ? 33 : 17)
+
 #ifdef HAVE_GAS_PE_SECREL32_RELOC
 /* Use section relative relocations for debugging offsets.  Unlike
    other targets that fake this by putting the section VMA at 0, PE