Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Kalev Lember <kalev-xCKnek0IedZUkzwZOSb9wg <at> public.gmane.org>
Subject: Re: Switching to DWARF2 exceptions
Newsgroups: gmane.linux.redhat.fedora.mingw
Date: Monday 30th November 2009 10:53:53 UTC (over 8 years ago)
On 11/30/2009 12:19 PM, Richard W.M. Jones wrote:
> On Mon, Nov 30, 2009 at 11:56:46AM +0200, Kalev Lember wrote:
>> To work around that, upstream mingw has a patch to annotate
>> functions which support unwinding with SEH with
>> __attribute__((seh_aware)). I've tested that patch and it really
>> does fix binary compatibility with binaries produced by Visual
>> Studio.
>
> I'm not quite sure I understand this bit - which functions
> need to be annotated?

Lets say we have function a() in a.dll (compiled with mingw), b() in 
b.dll (compiled with Visual Studio) and main() in c.exe (compiled with 
mingw). c.exe is linked against b.dll, and b.dll is linked against 
a.dll. Now if an exception is thrown in a() and rethrown in b(), then 
b() prototype in header file has to be annotated like this to make it 
possible to catch it in main() in c.exe:

void b() __attribute__((seh_aware));

MinGW unwinder supports unwinding either DWARF2 or SEH, but the runtime 
has no way of knowing whether a function supports unwinding with SEH. 
The patch is a workaround to add seh_aware attribute to foreign (SEH) 
function declarations. MinGW release notes [3] explain that it's only a 
temporary measure and future versions of w32api will have a way of doing 
it automatically.

[3] http://sourceforge.net/project/shownotes.php?release_id=691876


>> Switching to DWARF2 is needed to fix binary compatibility with
>> upstream mingw gcc 4 compiler. Besides that, SJLJ has runtime cost
>> in the common case when no exceptions are thrown; DWARF2 doesn't
>> have that problem.  MinGW upstream also thinks that DWARF2 should be
>> made default in FSF GCC in the future [2].
>>
>> [2] http://thread.gmane.org/gmane.comp.gnu.mingw.devel/3331/focus=3348
>
> MinGW thinks this, but what about the GCC developers?  I think I
> trust GCC upstream much more than MinGW ...

I'd like to hear Kevin Kofler comment on that as he appears to have a 
strong opinion about that and knows a great deal more than me about 
compiler internals.


> OTOH if it's just a matter of setting a configure flag, then it
> doesn't matter too much.

Yes, it's configure flag + the hacky seh_aware patch.


-- 
Kalev
 
CD: 5ms