[cfe-dev] Hack for FreeBSD ABI support

David Chisnall csdavec at swansea.ac.uk
Sun Aug 16 05:24:31 PDT 2009


Functions returning structures like NSPoint (two floats) work with  
this patch applied, but corrupt the stack without it.  I've attached a  
simple test which demonstrates the problem (compile one of these with  
clang and the other with the system compiler to see the result) - it  
uses Objective-C, but the same test with pure C functions fails in the  
same way.  I changed the test to ObjC to make sure that was fixed too  
- I was running into problems when every GNUstep app I tried crashed  
when I had Foundation compiled with clang and AppKit compiled with GCC  
because a call to an NSAffinePoint method was corrupting the stack.

There may be some differences between Darwin and FreeBSD (in  
particular in vector handling, which I didn't test), but with clang  
using the Darwin ABI I have programs compiled with Clang linking  
against AppKit compiled with gcc, Foundation compiled with Clang and  
other frameworks compiled with gcc and working without issue.

David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: from.m
Type: application/octet-stream
Size: 247 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090816/ad8b352c/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: to.m
Type: application/octet-stream
Size: 270 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090816/ad8b352c/attachment-0001.obj>
-------------- next part --------------


On 16 Aug 2009, at 01:36, Daniel Dunbar wrote:

> I don't understand this patch; Darwin doesn't use the "BSD" ABI for
> x86-32, it uses the crazy Darwin ABI which happens to match what gcc
> first did when Darwin switched to Intel (and as evolved slightly by
> time, I imagine). I'm pretty sure this is not the ABI that is used on
> FreeBSD (especially since we haven't already heard about it from the
> FreeBSD folks).
>
> What was the actual problem you were running into?
>
> - Daniel
>
> On Sat, Aug 15, 2009 at 9:41 AM, David  
> Chisnall<csdavec at swansea.ac.uk> wrote:
>> Currently Clang uses the DOS ABI (used by Linux) by default on x86  
>> and the
>> BSD ABI if the target triple contains 'darwin'.  This little hack  
>> selects
>> the correct ABI for FreeBSD.  It's almost certainly not the best  
>> way of
>> doing it, so feel free to select some other way.
>>
>> David
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list