This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos 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: Re: linking problem when using "fopen"


Jonathan Larmour <jlarmour@redhat.com> wrote:

>jyl087@netscape.net wrote:
>> 
>> Basically, I figured out that the
>>  "../arm-elf/2.95.2/libgcc.a" contains the "new" implementation,
>> which is needed by "fopen", and that object code requires all the
>> C++ cruft for exception handling. That's why the linker is barfing!
>> 
>> Obviously, my libgcc.a is different from yours. I built my tools
>> using the instructions found on the eCos site, and got these results.
>> I probably missed a step somewhere to build libgcc clean from C++
>> exception handling. Is that the case, or is it a matter of the
>> particular version (2.95.2) that I'm using?
>[snip]
>/usr/local/tools/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o):/usr/local/src/gcc/gcc-2.95.2/gcc/cp/tinfo.cc:134:
>undefined reference to `type_info type_info node'
>> collect2: ld returned 1 exit status
>
>I've just looked a bit closer at this. I tried a simple test myself with
>some genuine 2.95.2 tools:
>
>#include <stdlib.h>
>
>int main(int argc, char *argv[])
>{
>    int *foo = new int;
>    *foo = rand();
>    return *foo;
>}
>
>Compiled with arm-elf-g++ -fno-exceptions -fno-rtti -ISOMETHING/include
>-LSOMETHING/lib  flib.cxx -Ttarget.ld -nostdlib -Wl,-Map,foo
>
>It worked fine, and the linker map includes:
>type_info type_info node
>                    0x8              
>/home/jlarmour/sourceware/gcc/egcs-2.95.2/build/arm-elf/install/H-i686-pc-linux-gnu/lib/gcc-lib/arm-elf/2.95.2/libgcc.a(tinfo.o)
>
>i.e. "type_info type_info node" is defined in tinfo.cc, which makes it all
>the more odd that you are seeing an undefined reference from that very
>file!
>
>An "arm-elf-nm -C" of the libgcc.a reveals that it should be defined as:
>00000008 C type_info type_info node, i.e. a "common" symbol. The same
>applies to other symbols that you are having problems with. It would be
>interesting to see what it says about your libgcc.a.
>
>So given the same gcc sources, I suspect the real problem here is something
>to do with your binutils.
>
>Jifl

Jonathan,

You've gone a bit over my head...  Naturally the above test
of "int *foo = new int" fails on my setup.

By the way, when you say that "type_info type_info node" is declared
in tinfo.cc... do you mean that there is a static var called "node"
of class "type_info" declared? I'm not sure I see that in my tinfo.cc.
What line?

Here's the "arm-elf-nm" dump of my libgcc.a. Only the "tinfo.o"
section is shown. 

Could it be that my binutils were compiled with a flag like
-fvtable-gc that caused my libgcc.a to be incomplete?

Let me know if there's anything else I should try...

Thanks,
/Jim

PS: On another subject - I think my previous difficulties with 
GDB over serial were due to hardware handshaking problems. I'm 
not exactly sure what I did to fix it, but it seems to work now...


---------------------------------------------------tinfo.o:
00000000 t .gcc2_compiled.
00000000 W _._14__si_type_info
00000000 W _._16__user_type_info
00000000 W _._17__class_type_info
00000000 T _._9type_info
00000624 T __14__si_type_infoPCcRC16__user_type_info
0000058c T __16__user_type_infoPCc
00000718 T __17__class_type_infoPCcPCQ217__class_type_info9base_infoUl
         U __builtin_delete
00000028 T __eq__C9type_infoRC9type_info
         U __get_eh_context
00000060 T __rtti_class
00000188 T __rtti_si
000002a4 T __rtti_user
00000000 W __tf14__si_type_info
00000000 W __tf16__user_type_info
00000000 W __tf17__class_type_info
         U __tf9type_info
0000000c C __ti14__si_type_info
0000000c C __ti16__user_type_info
0000000c C __ti17__class_type_info
         U __ti9type_info
00000000 V _vt.14__si_type_info
00000000 V _vt.16__user_type_info
00000000 V _vt.17__class_type_info
         U _vt.9type_info
00000394 T dcast__C14__si_type_infoRC9type_infoiPvPC9type_infoT3
00000370 T dcast__C16__user_type_infoRC9type_infoiPvPC9type_infoT3
00000400 T dcast__C17__class_type_infoRC9type_infoiPvPC9type_infoT3
         U strcmp



__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


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