Hi Ross,

[EMAIL PROTECTED] wrote on 27.11.2008 23:36:22:

> Kai Tietz writes:
> >Well, you mean the SEH tables on stack.
> 
> No, I mean the ABI required unwind information. 

So you speak about .pdata and .xdata. Well, those aren't implemented. 
First step would be to teach gas to generate those structures by new 
keywords. Then afterwards gcc can emit them on function entry. By this 
.pdata and .xdata can be generated. 

> > Well, those aren't implemented (as they aren't for 32-bit).
> 
> 64-bit SEH handling is completely different from 32-bit SEH handling.
> In the 64-bit Windows ABI exceptions are handled using unwind tables
> similar in concept to DWARF2 exceptions.  There are no SEH tables on
> the stack.  In the 32-bit ABI exceptions are handled using a linked list
> of records on the stack, similar to SJLJ exceptions.

Hmm, yes and no. First the exception handler uses the .pdata and .xdata 
section for checking throws. But there is still the stack based exception 
mechanism as for 32-bit IIRC. Just the segment is %gs and offsets used to 
TEB are different (reasoned by different pointer sizes).

> > But the the unwinding via  RtlUnwind and RtlUnwindEx do their job even
> >for gcc compiled code quite well
> 
> I don't see how it would be possible in the general case.  Without the
> unwind talbes Windows doesn't have the required information to unwind
> through GCC compiled functions.

No, this isn't that curious as you mean. In the link you sent me, it is 
explained. The exception handler tables (.pdata/.xdata) are optional and 
not necessarily required. The major point here is that the epilogue has 
conformancy (as it has for general functions in gcc). The constrains on 
prologue are also kept by gcc already. The interesting issue is that the 
Unwind code will search for the stack frame adjustment by a 'leaq 
constant(%rsp),%rsp'. This is in general (but not in all cases) generated 
by gcc w64. So the RtlUnwind is still able to do its job, even when there 
is no Unwind information in .pdata/.xdata.

But in general I agree, that the generation of .pdata/.xdata sections 
would be a good thing for better support of MS abis by gcc.

Cheers,
Kai

|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.

Reply via email to