Patchwork [Ada] Preliminary work to support SEH on Windows 64

login
register
mail settings
Submitter Arnaud Charlet
Date June 12, 2012, 12:33 p.m.
Message ID <20120612123340.GA23287@adacore.com>
Download mbox | patch
Permalink /patch/164408/
State New
Headers show

Comments

Arnaud Charlet - June 12, 2012, 12:33 p.m.
No functional change.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-06-12  Tristan Gingold  <gingold@adacore.com>

	* a-exexpr-gcc.adb (Unwind_Exception): Add 4 more private fields.
Gabriel Dos Reis - June 12, 2012, 3 p.m.
On Tue, Jun 12, 2012 at 7:33 AM, Arnaud Charlet <charlet@adacore.com> wrote:
> No functional change.
>
> Tested on x86_64-pc-linux-gnu, committed on trunk
>
> 2012-06-12  Tristan Gingold  <gingold@adacore.com>
>
>        * a-exexpr-gcc.adb (Unwind_Exception): Add 4 more private fields.
>

Does this mean that GCC will officially support SEH -- which surely is a
language-independent infrastructure, usable by other front ends?

-- Gaby
Tristan Gingold - June 12, 2012, 3:18 p.m.
On Jun 12, 2012, at 5:00 PM, Gabriel Dos Reis wrote:

> On Tue, Jun 12, 2012 at 7:33 AM, Arnaud Charlet <charlet@adacore.com> wrote:
>> No functional change.
>> 
>> Tested on x86_64-pc-linux-gnu, committed on trunk
>> 
>> 2012-06-12  Tristan Gingold  <gingold@adacore.com>
>> 
>>        * a-exexpr-gcc.adb (Unwind_Exception): Add 4 more private fields.
>> 
> 
> Does this mean that GCC will officially support SEH -- which surely is a
> language-independent infrastructure, usable by other front ends?

Richard Henderson has submitted (a few years ago) a patch to add SEH support for Windows 64.
We have rebased it and we are testing it for Ada with our tests.

I hope this work will be soon ready and I plan to resubmit the patch (which in fact was only
partially committed: only SEH unwinding info generation are currently in GCC).

I haven't tested it with C++ (I think Richard did), but it should work: the runtime interface routines to SEH is sane.

Tristan.
Gabriel Dos Reis - June 12, 2012, 3:21 p.m.
On Tue, Jun 12, 2012 at 10:18 AM, Tristan Gingold <gingold@adacore.com> wrote:
>
> On Jun 12, 2012, at 5:00 PM, Gabriel Dos Reis wrote:
>
>> On Tue, Jun 12, 2012 at 7:33 AM, Arnaud Charlet <charlet@adacore.com> wrote:
>>> No functional change.
>>>
>>> Tested on x86_64-pc-linux-gnu, committed on trunk
>>>
>>> 2012-06-12  Tristan Gingold  <gingold@adacore.com>
>>>
>>>        * a-exexpr-gcc.adb (Unwind_Exception): Add 4 more private fields.
>>>
>>
>> Does this mean that GCC will officially support SEH -- which surely is a
>> language-independent infrastructure, usable by other front ends?
>
> Richard Henderson has submitted (a few years ago) a patch to add SEH support for Windows 64.
> We have rebased it and we are testing it for Ada with our tests.

It appears I missed that. Florian just sent a link to that patch via
private mail. Thanks!

>
> I hope this work will be soon ready and I plan to resubmit the patch (which in fact was only
> partially committed: only SEH unwinding info generation are currently in GCC).
>
> I haven't tested it with C++ (I think Richard did), but it should work: the runtime interface routines to SEH is sane.

Fantastic!  Thanks.

-- Gaby

Patch

Index: a-exexpr-gcc.adb
===================================================================
--- a-exexpr-gcc.adb	(revision 188428)
+++ a-exexpr-gcc.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2012, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -108,6 +108,14 @@ 
       Cleanup  : System.Address;
       Private1 : Unwind_Word;
       Private2 : Unwind_Word;
+
+      --  Usual exception structure has only 2 private fields, but the SEH
+      --  one has 6.  To avoid makeing this file more complex, we use 6 fields
+      --  on all platforms, wasting a few bytes on some.
+      Private3 : Unwind_Word;
+      Private4 : Unwind_Word;
+      Private5 : Unwind_Word;
+      Private6 : Unwind_Word;
    end record;
    pragma Convention (C, Unwind_Exception);
    --  Map the GCC struct used for exception handling
@@ -475,8 +483,7 @@ 
         new GNAT_GCC_Exception'
           (Header     => (Class => GNAT_Exception_Class,
                           Cleanup => GNAT_GCC_Exception_Cleanup'Address,
-                          Private1 => 0,
-                          Private2 => 0),
+                          others => 0),
            Occurrence => Excep.all);
 
       --  Propagate it