[cfe-dev] Objective-C runtime

Ariel V Feinerman arielfeinerman at gmail.com
Sun Sep 19 08:53:54 PDT 2010


Thank you very much! The more I meet with clang the more I like one.

Suppose our Unix has libobjc.so, can it be done in this way:

*clang -fnext-runtime -fobjc-nonfragile-abi2 -llibobjc -o test test.m*

Is the technic to statically compile the libobjc or put it into the bundle,
ie relative to programme, ie the path to lib hasn`t been hardcoded?

On Sat, Sep 18, 2010 at 2:24 AM, Fariborz Jahanian <fjahanian at apple.com>wrote:

> Some corrections below:
>
>
> On Sep 17, 2010, at 4:00 PM, David Chisnall wrote:
>
>  On 17 Sep 2010, at 23:29, Ariel V Feinerman wrote:
>>
>>  Can I use a custom runtime with the clang-llvm included in Xcode or vice
>>> versa Apple runtime in other OS with the clang-llvm (I wish to get full
>>> Objective C 2.0 support in win, linux or mac with the same lib) from
>>> llvm.org or source? In general, how do clang-llvm, llvm-gcc or gcc know
>>> what type of runtime you use? They may have some different interfaces.
>>>
>>
>> By default, clang will target the GNU runtime on non-Darwin platforms and
>> the NeXT / Apple runtimes when on on Darwin.  You can control this in the
>> same way that you do with GCC, by providing the -fgnu-runtime or
>> -fnext-runtime flag, to select between the GNU and NeXT (Apple) runtimes
>> explicitly.
>>
>> Providing -fobjc-nonfragile-abi will also make some changes to the
>> runtime.  On Darwin it will use Apple's 'Modern' runtime, while not
>> specifying it will generate code for the 'Legacy' runtime.  If you specify
>> -fobjc-nonfragile-abi and -fgnu-runtime, then clang will generate code for
>> the GNUstep runtime, which you can find in GNUstep svn as libobjc2.  This
>> provides all of the ObjC 2 features except for GC, and a few others not
>> found in the Mac runtimes.
>>
>
> On Darwin, default in clang's TOT is -fobjc-nonfragile-abi2 (the more
> modern runtime). Older releases of clang have -fobjc-nonfragile-abi by
> default.
> To get legacy runtime, you can either add -m32 or -triple
> i386-apple-darwin9 on clang's command line.
>
> - Fariborz
>
>
>
>>
>> Apple GCC never merged the code for supporting non-NeXT/Apple runtimes, so
>> Apple GCC (which is used by llvm-gcc) only supports the NeXT / Apple
>> runtimes.  Dragon Egg uses FSF GCC, so it will be able to target the GNU and
>> Apple runtimes.  FSF GCC does not currently support Objective-C 2, but
>> Nicola Pero is currently working on that.
>>
>> If you want to cross-compile from XCode, then you will need to do a bit
>> more than just select a different runtime (for example, make sure you are
>> including only headers for your target platform, and probably using a
>> non-Darwin version of binutils).
>>
>> David
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>
>


-- 
best regards
Ariel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100919/feaceb04/attachment.html>


More information about the cfe-dev mailing list