[uClinux-dev] GCC-3.4.6 toolchain and libstdc++ on ARM no-mmu target

Luis Fernando Curci Chavier lfchavier at lfchavier.info
Fri Feb 1 09:45:15 EST 2008


> Date: Wed, 30 Jan 2008 18:19:57 +0100
> From: Wolfgang M?es <wolfgang at iksw-muees.de>
> Subject: Re: [uClinux-dev] GCC-3.4.6 toolchain and libstdc++ on ARM
> 	no-mmu	target
> To: uclinux-dev at uclinux.org
> Message-ID: <200801301819.57716.wolfgang at iksw-muees.de>
> Content-Type: text/plain;  charset="iso-8859-1"
> 
> Fernando,
> 
> On Dienstag, 29. Januar 2008, Luis Fernando Chavier wrote:
> > Hi all,
> >
> > I was able to build a gcc-3.4.6-based toolchain with C++ support for
> > a no-mmu arm target (arm7tdmi - NXP LPC2468), but it's not working
> > quite as expected. I can compile and run C code nicely on the target,
> > but I have some problems with C++ support. I built and run the
> > uClinux distribution with this toolchain and had no problems.
> >
> > I compiled some C++ code without iostream (just some C++ string
> > manipulation and output with printf) and it worked fine, but when I
> > use iostream things go bad... I built this simple hello world
> > application:
> 
> This is because in ucfront, the standard libraries are EXCLUDED from the 
> link. For global constructors/destructors in C++, you NEED to include 
> crtbegin.o as the FIRST file in the link list, and crtend.o as the LAST 
> file in the list of linked objects/libraries.
> 
> I have "solved" the problem by modifying config.arch to have some 
> #defines for crtbegin and crtend, and include these defines in the 
> linker command:
> 
> Modified: trunk/vendors/config/armnommu/config.arch
> ===================================================================
> --- trunk/vendors/config/armnommu/config.arch2007-09-11 16:16:59 UTC 
> @@ -209,12 +209,15 @@
> # Definitions for the inclusion of static constructors
> CRTBEGIN := $(shell $(CXX) $(CXXFLAGS) -print-file-name=crtbegin.o)
> CRTEND  := $(shell $(CXX) $(CXXFLAGS) -print-file-name=crtend.o)
> 
> and in the makefile:
> ================
> # This is the rule that builds(links) the executable.
> # CXX: name of the c++ compiler, set by environment
> # CRTBEGIN/CRTEND: enclosure for inclusion of static constructors.
> #         CRTBEGIN must be the first link object
> #         CRTEND must be the last link object
> # LDFLAGS: common flags for the linker
> # CXXLIBS: needed libraries for C++ programs, including uClibc++
> # LDLIBS: standard c libraries
> $(EXEC): $(OBJS)
> $(CXX) -o $@ $(CRTBEGIN) $(LDFLAGS) $(OBJS) $(CXXLIBS) $(LDLIBS) 
> $(CRTEND)
> # set the stack size (default = 4096 Bytes)
> arm-linux-elf-flthdr -s 8192 $@
> 
> best regards
> 
> Wolfgang
> -- 
> Das Leben kann nur rckwrts verstanden,
> mu aber vorwrts gelebt werden.
> 
> 
> ------------------------------

Yep, it worked! Thank you VERY much.

Best regards,

Fernando




More information about the uClinux-dev mailing list