Linking problem , powerPC w/ gcc 3.4.0 c++ program and newlib

Jeff Johnston jjohnstn@redhat.com
Tue Jul 27 20:27:00 GMT 2004


Don Russell wrote:
> Hi,
> I have built the gcc 3.4.0  and 3.2  toolchains for powerpc eabi. Im trying
> to build a
> project that  previously has successfully compiled linked and run with the
> Wind River
> Diab compiler and tools.
> 
>  This is  embedded  SW w/o an operating system.
> The modules which are C++ (.cpp) all compile,  but I can't get a successful
> link.
> I built the tools with newlib .
> 
>  Having tried every combo of libs in the tool chain, the best I get  is two
> unresolved symbols
>          _Unwind_Resume and _gxx_personality_v0 .
> 
> Is there a missing switch?  Does newlib support C++ ?
> Searching the web, many have this problem none seem to have an answer
> .

The symbol _Unwind_Resume is in libgcc (-lgcc).  The symbol _gxx_personality_v0 
is in libsupc++ (-lsupc++).  I didn't see mention of what level of libstdc++ you 
are using.

> Thanks
> Don Russell
> 
> packages :
> gcc-3.4.0
> binutils-2.15
> newlib-1.12.0
> 
> The makefile is very straightforward.
> 
> # File: Makefile
> PROJECT       = HLram2
> LINK_FILE     = HLram2
> ######################
> # Target-Version-Tools
> ######################
> TARG=powerpc-pc-eabi
> GCCVER=3.4.0
> PPCROOT=/usr/local/powerpc
> TOOLS=$(PPCROOT)/bin
> ###########
> # Object files
> ###########
> 
> OBJECTS =   crt0.o \
>      main.o  \
>      memtsts2.o \
>      tables.o \
>      int8560.o \
>      ppccore2.o \
>      upmtable.o \
>      conio2.o  \
>      dispatch2.o \
>      tstsuite.o  \
>      tstsuite1.o  \
>      psccuart2.o  \
>      sccuart2.o  \
>      cpmtimer.o \
>      fccenet2.o \
>      tsecdrvr.o \
>      i2c.o \
>      pcix.o \
>      enetphy2.o \
>      flashutils.o \
>      fdrvintel.o  \
>      fdrvcf.o
> 
> ###########
> # Include paths
> ###########
> INCLUDES = -I$(PPCROOT)/include \
>  -I$(PPCROOT)/$(TARG)/include \
>  -I$(PPCROOT)/lib/gcc-lib/$(TARG)/$(GCCVER)/include \
>  -I$(PPCROOT)/include/c++/$(GCCVER)/$(TARG)/bits \
>  -I ../../common -I ../../8560_Headers  \
>  -I ../../ -I ./
> 
> ###########
> # Build Flags
> ###########
> CFLAGS = -ansi  -DRW_MULTI_THREAD -D_REENTRANT -DSYSCTL_ONLY   \
>  -Wall -g
> 
> CFLAGS_AS=-v -g -mbooke32 -ansi -mregnames
> 
> ######################
> #  PPC Tools and Rules
> ######################
> # -B$(PPCROOT)/lib/gcc-lib/
> 
> CC = $(TOOLS)/$(TARG)-gcc  -B$(PPCROOT)/lib/gcc-lib/
> LD = $(TOOLS)/$(TARG)-ld
> AR = $(TOOLS)/$(TARG)-ar
> AS = $(TOOLS)/$(TARG)-as
> OBJDUMP = $(TOOLS)/$(TARG)-objdump
> OBJCOPY = $(TOOLS)/$(TARG)-objcopy
> 
> %.o : %.c
>  $(CC) -c $(CFLAGS) $(INCLUDES) -o $@  $<
> 
> %.o : %.cpp
>  $(CC) -c $(CFLAGS) $(INCLUDES) -o $@  $<
> 
> %.o : %.s
>  $(CC) $(CFLAGS_AS) $(INCLUDES) -o $@ $<
> 
> %.o : %.S
>  $(CC) $(CFLAGS_AS) $(INCLUDES) -o $@ $<
> 
> ###########
> # Libraries
> ###########
> 
> # $(LIBDIRGCC)/libgcc.a $(LIBDIR)/libc.a $(LIBDIR)/libnosys.a
> $(LIBDIR)/libstdc++.a
> # $(LIBDIR)/libiberty.a
> 
> LIBDIRGCC = $(PPCROOT)/lib/gcc-lib/$(TARG)/$(GCCVER)
> LIBDIR=$(PPCROOT)/$(TARG)/lib
> 
> ################ This gives the fewest unresolved external errors
> ##############
> LIBS = $(LIBDIR)/libnosys.a $(LIBDIR)/libc.a
> 
> # -nostdlib -nodefaultlibs
> # LDFLAGS=  -lstdc++ -lc -lnosys
> # $(LDFLAGS)
> 
> #################
> # Linker Commands
> #################
> 
> ENTRY = start
> 
> $(PROJECT).bin : $(OBJECTS)
>  $(LD)  -T $(PROJECT).lnk  -o $(PROJECT).elf $(OBJECTS)  \
>         $(LIBS)  > $(PROJECT).map
>  $(OBJCOPY) -O binary -R .comment $(PROJECT).elf $@
> 
> ####################
> # Objects Build Rules
> ####################
> crt0.o : ../../crt0.s
>  $(CC) -c $(CFLAGS_AS) $(INCLUDES) ../../crt0.s
> 
> tables.o : ../../tables.cpp
>  $(CC) -c $(CFLAGS) $(INCLUDES)  ../../tables.cpp
> 
> main.o : ../../main.cpp
> #  ../../../timestamp
>   $(CC) -c $(CFLAGS) $(INCLUDES) ../../main.cpp
> 
> ETC.
> 



More information about the Newlib mailing list