Ariel V Feinerman | 18 Sep 00:29 2010
Picon

Objective-C runtime

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.

Thank you in advance.

--
best regards
Ariel
_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
David Chisnall | 18 Sep 01:00 2010

Re: Objective-C runtime

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.

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
Fariborz Jahanian | 18 Sep 01:24 2010
Picon

Re: Objective-C runtime

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@...
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Ariel V Feinerman | 19 Sep 17:53 2010
Picon

Re: Objective-C runtime

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-2kanFRK1NckAvxtiuMwx3w@public.gmane.org> 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-Tmj1lob9twrHfRtnQztjLA@public.gmane.orgu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




--
best regards
Ariel
_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Fariborz Jahanian | 21 Sep 00:52 2010
Picon

Re: Objective-C runtime


On Sep 19, 2010, at 8:53 AM, Ariel V Feinerman wrote:

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? 

-fobjc-nonfragile-abi2  does not mean a new abi so, no need for a new library. It was a temporary name and for testing
purposes which got out of hand. We are debating a suitable name for the feature which is essentially language enhancements
(within the existing nonfragile-abi).
Stay tuned. 

- fariborz




_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Fariborz Jahanian | 18 Sep 01:01 2010
Picon

Re: Objective-C runtime


On Sep 17, 2010, at 3:29 PM, Ariel V Feinerman wrote:

 In general, how do clang-llvm, llvm-gcc or gcc know what type of runtime you use? They may have some different interfaces.

gcc/clang/llvm-gcc use two kinds of runtime. Default is NeXt runtime (with several flavors). To use gnu runtime
add -fgnu-runtime on command line.

- fariborz




Thank you in advance.

--
best regards
Ariel
_______________________________________________
cfe-dev mailing list
cfe-dev-Tmj1lob9twqVc3sceRu5cw@public.gmane.org
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Gmane