Jivin kitefree lays it down ...
> Hi Wolfgang,
> I have tried your suggestion, to add ""-fpic -msingle-pic-base" for linker, 
> but
> C++ construction is still not working. 
> 
> Hi Erwin,
> >It's generally true that you have to supply -fpic -msingle-pic->base to
> >the linker. With the 3.4.4 snapgear toolchain, this won't help >either,
> >because the compilers libs are compiled without -msingle-pic-base. >There
> >are other reasons why c++ won't work. As far as I remember, >ucfront-g++
> >doesn't supply the right libraries for calling the
> >constructors/destructors, and the elf2flt ld script is for old >compilers
> >with a different format of the ctor table.
> 
> From your comments I guess there are 3 problems causing that my C++ 
> construction is not working.
>
> 1. ucfront-g++ doesn't supply the right libraries for calling 
> constructors/destructors.

Can't say I agree,  we build C++ apps here for arm, mips and x86,  all
using ucfront-g++.  I know you are using !MMU,  but that statement is a
little too generic ;-)

IMO something else is wrong, either with your toolchain or your config.arch.

> 2. elf2flt ld script is for old compilers.

Again,  I disagree.  Blackfin are a prime example of newer compilers
that are working fine using the existing elf2flt.ld.  They have fully
functional C++ compilers as well.

Again,  compiler/config.arch.

> 3. gcc 3.4.4 compilers libs ae compiled without -msingle-pic-base.
> Actually the package I am working on is "uClinux-dist-20070130.tar.gz" for 
> source package, and "arm-linux-tools-20061213.tar.gz" for oolchain. And my 
> testing platform is using a no-MMU CPU. "ucfront-g++" tool
> is from "uClinux-dist-
> 20070130.tar.gz", gcc 3.4.4 libs and elf2flt.ld is from "arm-linux-tools-
> 20061213.tar.gz" which seems to have only binary package.

All the toolchains have source and build instructions available.  Either
from uclinux.org or from snapgear.org (if you are using one of those).

It is fairly well known,  but probably not documented, that the
arm-linux-tools-20061213.tar.gz is an MMU toolchain with elf2flt added
in.  It has not been multi-libed to deal with -fpic and
-msingle-pic-base and thus can only be used to build NON-xip executables
for !MMU systems.

If you need to build a working arm !MMU toolchain have a look at the
build script here:

        http://www.uclinux.org/pub/uClinux/arm-elf-tools/gcc-3/

and work from there,  though I am sure that someone here has a much
newer toolchain and example you can follow its the best I have at this
point.

To get a newer compiler with XIP you will need to build your own unless
someone here steps up with one for you.

> Could you be kindly
> to help tell me how to modify my environment to solving above 3 problems and 
> to make C++ construction/destruction work? Thanks a
> lot.

The constructor/destructor problems you are having are due to the
elf2flt.ld,  but there is a good reason.

Older compilers,  and for a while there the newer ones would mess up the
CTORS/DTORS or not include them at all.  What elf2flt.ld does is direct from
the linker manual pages, and providing the compiler doesn't try and do
it's own thing with constructors (ie., include the crtbegin.o and crtend.o)
all is fine.

One thought would be to have ucfront-ld remove all crtbegin* and crtend*
files from the link line when using elf2flt.

Another thing to try for a quick check is to remove the crtbegin/crtend
files from your compiler specs file.

Cheers,
Davidm

-- 
David McCullough,  [EMAIL PROTECTED],   Ph:+61 734352815
Secure Computing - SnapGear  http://www.uCdot.org http://www.cyberguard.com
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to