This is the mail archive of the ecos-patches@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: [ECOS] more __impure_pointer trouble


On Sat, 2003-03-29 at 00:48, Bart Veer wrote:
> >>>>> "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++

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 dot koninckx at mech dot kuleuven dot ac dot be
B-3001 Leuven Belgium               http://www.mech.kuleuven.ac.be/pma
----------------------------------------------------------------------
Index: powerpc.ld
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/powerpc/arch/current/src/powerpc.ld,v
retrieving revision 1.15
diff -u -5 -r1.15 powerpc.ld
--- powerpc.ld	23 May 2002 23:04:14 -0000	1.15
+++ powerpc.ld	29 Mar 2003 09:41:23 -0000
@@ -51,11 +51,16 @@
 STARTUP(vectors.o)
 ENTRY(__exception_reset)
 #ifdef EXTRAS
 INPUT(extras.o)
 #endif
+
+#if (__GNUC__ >= 3)
+GROUP(libtarget.a libgcc.a libsupc++.a)
+#else
 GROUP(libtarget.a libgcc.a)
+#endif
 
 #define ALIGN_LMA 8
 #define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1))
 #define LMA_EQ_VMA
 #define FORCE_OUTPUT . = .

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