"Bob" == Bob Koninckx <bob dot koninckx at mech dot kuleuven dot ac dot be> writes:
Bob> Hi Bart,
Bob> I applied your patch to get the __impure_ptr fix in the INFRA
Bob> package. pure.cxx is included and when I check libtarget.a
Bob> with powerpc-eabi-nm, the function __cxa_pure_virtual is
Bob> present.
Bob> However, when linking my application with the command
Bob> powerpc-eabi-g++
Bob> -L/home/bob/software/build/eCos/ec555/vbcom/library/ecos/install/lib
Bob> -Wl,-static -Wl,--gc-sections -nostartfiles -nostdlib -Xlinker -Map
Bob> -Xlinker vbcom.map -o bin/vbcom.elf .obj/vbcom.o library/vbcom.a
Bob> library/vbcom_extras.o -Ttarget.ld
Bob> /home/bob/software/build/eCos/ec555/vbcom/library/sigc++/install/lib/libsigc++.a -lsupc++
Bob> I still get the unresolved errors for __impure_ptr (i tried
Bob> to put -lsupc++) on every possible location on the command
Bob> line.
Bob> If on the other hand, I change the group statement in the
Bob> eCos linker script from GROUP(libtarget.a libgcc.a) to
Bob> GROUP(libtarget.a libgcc.a libsupc++.a) and I remove -lsupc++
Bob> from the command line, everything links (and appears to run)
Bob> fine.
Bob> Did I still miss something, or is a patch to powerpc.ld (and
Bob> the other target files also necessary) ?
I thought that all the .ld files had been updated to pull in -lsupc++,
but this is not the case: only arm.ld, sh.ld and mn10300_am31.ld
mention libsupc++. I don't know the exact history here, hopefully
somebody else remembers.
As to what is going on, I suspect that vbcom.o, vbcom.a and
vbcom_extras.o don't contain any pure virtual functions so don't
reference __cxa_pure_virtual(). Hence that function does not get
pulled in when -Ttarget.ld is processed. Next libsigc++ is pulled in,
containing pure virtual functions, so there is now an unresolved
reference to __cxa_pure_virtual() which gets resolved by the next
entry, -lsupc++.
I suggest something like the following:
.obj/vbcom.o library/vbcom.a library/vbcom_extras.o \
-L/home/bob/.../lib -lsigc++ -Ttarget.ld -lsupc++
Note the -l for libsigc++, currently you are pulling in everything in
that library whether it is needed or not.