[ECOS] more __impure_pointer trouble

Bob Koninckx bob.koninckx@mech.kuleuven.ac.be
Sat Mar 29 15:42:00 GMT 2003


On Sat, 2003-03-29 at 00:48, Bart Veer wrote:
> >>>>> "Bob" == Bob Koninckx <bob.koninckx@mech.kuleuven.ac.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++

Nope, still get the same link errors ...

> 
> Note the -l for libsigc++, currently you are pulling in everything in
> that library whether it is needed or not. You might also want to think
> about changing vbcom.a to libvbcom.a and using -Llibrary -lvbcom,
> depending on whether or not it is a real library or just a collection
> of object files.

Thanks for the tip :-) didn't know these subtle differences

> 
> Bart

Apparently, the only solution seems to be the change to the linker
script. And since it appears to be the correct solution also ... Patch
attached for the powerpc architecture

Bob

-- 
----------------------------------------------------------------------
ir. Bob Koninckx
Katholieke Universiteit Leuven
Division Production Engineering,                   tel.  +32 16 322535
Machine Design and Automation                      fax.  +32 16 322987
Celestijnenlaan 300B                  bob.koninckx@mech.kuleuven.ac.be
B-3001 Leuven Belgium               http://www.mech.kuleuven.ac.be/pma
----------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: powerpc.ld.patch
Type: text/x-patch
Size: 706 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/ecos-discuss/attachments/20030329/c9244b57/attachment.bin>
-------------- next part --------------
-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


More information about the Ecos-discuss mailing list