This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Objective C/C++ Compiler Drivers


On 18 August 2010 18:14, Mike Stump <mikestump@comcast.net> wrote:
> On Aug 17, 2010, at 9:37 PM, Philip Herron wrote:
>> I added a objc and objcp compiler drivers,
>
> First, formalities... ?Do you have your paper work for gcc done? ?If not, if you want to contribute larger chunks, it is required.
>
>> the objc one works so far as much as i can tell i tested a hello world program with gccobjc hello.m and the resulting a.out worked.
>
> The likelihood of getting it wrong should be low. ?I glanced at the patch, looks mostly fine to me.
>
>> The compiler driver code i added for both is a vanilla driver, which
>> could fail though, since i don't tell anything to explicitly link their
>> respective runtime libraries though i would doubt the objc front-end i
>> just tested would generate working code without doing that so i may be
>> fine as is.
>
> Mostly fine as is, but, we'd solicit the next step, which would be adding the -l flags as appropriate, and defaulting to objc for .c files... ?As the C++ driver comes up, defaulting it to obj-c++ for the normal C++ extensions would be nice. ?After that, well, can't recall anything that would need doing. ?If anyone else can think of something, let them speak up!
>
>> I am having problems with the objcp one so far it doesn't seem to get installed so i need to look into this though i would like to get a review on the patch as it stands so as i know i am on the right track.
>
> If you exactly copy the g++ driver, you should be able to copy is semantics... ?That'd be the first step. ?I didn't diff between the two to look at the differences... ?[ pause ] Ok, I looked at some of the differences... ?In general, you want to get rid of the differences... ?For example, I didn't see a use of program_transform_name. ?Copy exactly, and only change the parts you are certain are wrong or don't apply and you'll have an easier time.
>
> The other thing I'd change are the names, gccobjcp, mouthful. ?Please use objc++ and objc as the driver names. ?The long form of the drivers would be gobjc and gobjc++. ?For ++less systems, following what they do for those system would be best.

Thanks for all the pointers you guys gave, when i started i wasnt
quite sure what would work or not! And yes i do have gnu copy
approval. I will endeavour to clean this up and do the changes in
driver names and let you guys know how i get on soon, i couldn't work
on this today had to help a friend move house but will work on this
tomorrow :)

That test you told me to try didnt work since i dont link in the objc
runtime library:

redbrain@omicron:~ $ gccobjc -fdump-tree-gimple test.m
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../i686-pc-linux-gnu/bin/ld:
/tmp/cc95Hin0.o: in function main:test.m(.text+0x1d): error: undefined
reference to 'objc_get_class'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../i686-pc-linux-gnu/bin/ld:
/tmp/cc95Hin0.o: in function main:test.m(.text+0x2f): error: undefined
reference to 'objc_msg_lookup'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../i686-pc-linux-gnu/bin/ld:
/tmp/cc95Hin0.o: in function main:test.m(.text+0x54): error: undefined
reference to 'objc_msg_lookup'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../i686-pc-linux-gnu/bin/ld:
/tmp/cc95Hin0.o: in function __objc_gnu_init:test.m(.text+0x9d):
error: undefined reference to '__objc_exec_class'
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../i686-pc-linux-gnu/bin/ld:
/tmp/cc95Hin0.o: in function
__objc_class_ref_Object:test.m(.data+0x100): error: undefined
reference to '__objc_class_name_Object'
collect2: ld returned 1 exit status

But i can do that now the program which did work for me was:

#import <stdio.h>

int main( int argc, const char *argv[] ) {
    printf( "hello world\n" );
    return 0;
}

But i guess since all what's going on there is a c program with some
different c-preprocessor statements so no extra objc features were
actually being used.

--Phil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]