Thank you very much! The more I meet with clang the more I like one. <div><br></div><div>Suppose our Unix has libobjc.so, can it be done in this way:</div><div><br></div><div><i>clang -fnext-runtime -fobjc-nonfragile-abi2 -llibobjc -o test test.m</i><br>

<div><br></div><div>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? <br><div class="gmail_quote"><br></div><div class="gmail_quote">

On Sat, Sep 18, 2010 at 2:24 AM, Fariborz Jahanian <span dir="ltr"><<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Some corrections below:<div class="im"><br>
<br>
On Sep 17, 2010, at 4:00 PM, David Chisnall wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 17 Sep 2010, at 23:29, Ariel V Feinerman wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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 <a href="http://llvm.org" target="_blank">llvm.org</a> 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.<br>


</blockquote>
<br>
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.<br>


<br>
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.<br>


</blockquote>
<br></div>
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.<br>
To get legacy runtime, you can either add -m32 or -triple i386-apple-darwin9 on clang's command line.<br><font color="#888888">
<br>
- Fariborz<br>
<br>
<br>
</font><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
<br>
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.<br>


<br>
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).<br>


<br>
David<br></div><div class="im">
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></blockquote>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>best regards<br>Ariel<br>
</div></div>