>Dear Blazej, >My question is why when I do "gcc test.program.c" without -lgcc, I get the >error message? Isn't linker supposed to link the program with libgcc >automatically? >Best >David When you are using gcc (or using an old binary compiled with gcc) it is a common error. In such a case you should manually enter -L and -lgcc on the switches list. In other case you wouldn't do this. It's all about the linker. When you link something, the linker search through directory list you specify (-L). It assumes that -l(library_name) will be find there. But it doesn't work for gcc. Thanks, Blazej -----Original Message----- From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On Behalf Of Navid Toosizadeh Sent: Thursday, January 22, 2009 10:13 PM To: gcc-help@xxxxxxxxxxx Subject: Re: modifying libgcc.a Dear Blazej, My question is why when I do "gcc test.program.c" without -lgcc, I get the error message? Isn't linker supposed to link the program with libgcc automatically? Best Navid ----- Original Message ---- From: Blazej <riona@xxxxxxxxx> To: gcc-help@xxxxxxxxxxx Sent: Thursday, January 22, 2009 4:01:02 PM Subject: RE: modifying libgcc.a >Ok, I guess I have some updates on the problem below: >When I do "gcc test.program.c -lgcc", it works. Does that mean linker does >not link the output of gcc with libgcc? Should I seek for the problem in >gcc or in my linker? (perior to changing libgcc, I never needed to use >libgcc). >Thank you >David Everything is ok. The linker automatically adds the lib suffix. So when you execute -lgcc it means either -llibgcc.a or -llibgcc.so. This depends on what link option you choose (-static, -shared). Regards, Blazej ----- Original Message ---- From: Navid Toosizadeh <navid_toosizadeh@xxxxxxxxx> To: gcc-help@xxxxxxxxxxx Sent: Thursday, January 22, 2009 1:08:06 PM Subject: modifying libgcc.a Greetings, For some reason, I like to modify libgcc.a after GCC is built. I intend to add new definitions for macros such as mulsi3 existing in libgcc.a. Here's what I did: I compiled the new definition of mulsi3, made the object and then converted it to libgcc.a using "ar". Now, to test this, I wrote a small program that multiplies two numbers. When I do "gcc test_program.c libgcc.a" it compiles and the output is correct. But when I do : "gcc test_program.c", it throws an error complaining about undefined reference to __mulsi3, although I did put the libgcc.a in the path (and the linker doesn't complain there's no libgcc when I tried -lgcc). Could you help e understand why the definition of __mulsi3 is not used from libgcc.a when I test "gcc test_program.c"? Best regards Navid ---------------------------------------------------------------------- Sprawdz, co wyswietlaja kina w Twoim miescie! http://link.interia.pl/f2028 ---------------------------------------------------------------------- Kochanka - kobieta drugiej kategorii? sprawdz >>>http://link.interia.pl/f2026