static linking error
Charles Lockhart
lockhart@jeans.ifa.hawaii.edu
Tue Jul 8 20:19:00 GMT 2003
Hello,
I've been able to build Xgcc toolchain for the ppc405 on a RH7.2 machine
using the crosstool scripts, but the build has failed on a machine
running RH9.
But that's not my question, just a statement, sorry. So I've gotten the
cross-gcc toolchain up. I've put together a makefile, and I can compile
code, looks fine. However when I try to statically link everything, I
get errors, and I don't understand what the root of the problem is.
I've stuck my makefile and the output to the bottom of this email. The
makefile is just a slight adaptation of what I found in K.Yaghmour's
BELS book.
btw, for submitting makefils/code/compiler output, is it ok to just put
it in an email (as I've seen most people do) or would it be preferred if
it was thrown into a webpage and a link to it was used instead?
Thanks,
-Charles
***Makefile*************************************************
# Tool names
CROSS_COMPILE = ${TARGET}-
AS = $(CROSS_COMPILE)as
AR = $(CROSS_COMPILE)ar
CC = $(CROSS_COMPILE)gcc
CPP = $(CC) -E
LD = $(CROSS_COMPILE)ld
NM = $(CROSS_COMPILE)nm
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
RANLIB = $(CROSS_COMPILE)ranlib
READELF = $(CROSS_COMPILE)readelf
SIZE = $(CROSS_COMPILE)size
STRINGS = $(CROSS_COMPILE)strings
STRIP = $(CROSS_COMPILE)strip
export AS AR CC CPP LD NM OBJCOPY OBJDUMP RANLIB READELF SIZE STRINGS STRIP
# Build settings
CFLAGS = -O2 -Wall -mcpu=ppc405
HEADER_OPS =
LDFLAGS = -static -nostdlib -L${TARGET_PREFIX}/lib
# Installation variables
EXEC_NAME = test
INSTALL = install
INSTALL_DIR = ${PRJROOT}/rootfs/bin
STARTUP_FILES = ${TARGET_PREFIX}/lib/crt1.o \
${TARGET_PREFIX}/lib/crti.o \
${PREFIX}/lib/gcc-lib/${TARGET}/3.2.3/crtbegin.o
END_FILES = ${PREFIX}/lib/gcc-lib/${TARGET}/3.2.3/crtend.o \
${TARGET_PREFIX}/lib/crtn.o
LIBS = -lc
OBJS = test.o
LINKED_FILES = ${STARTUP_FILES} ${OBJS} ${LIBS} ${END_FILES}
# Make rules
all: test
.c.o:
$(CC) $(CFLAGS) $(HEADER_OPS) -c $<
test: ${OBJS}
$(CC) -o $(EXEC_NAME) ${LINKED_FILES} $(LDFLAGS)
clean:
rm -f *.o $(EXEC_NAME) core
distclean:
rm -f *~
rm -f *.o $(EXEC_NAME) core
*******************************************************
output:
ppc-405-linux-gnu-gcc -o test
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/crt1.o
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/crti.o
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/lib/gcc-lib/ppc-405-linux-gnu/3.2.3/crtbegin.o
test.o -lc
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/lib/gcc-lib/ppc-405-linux-gnu/3.2.3/crtend.o
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/crtn.o -static -nostdlib
-L/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itoa.o)(.text+0x16c):
In function `_itoa':
: undefined reference to `__lshrdi3'
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itoa.o)(.text+0x16c):
In function `_itoa':
: relocation truncated to fit: R_PPC_REL24 __lshrdi3
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itoa.o)(.text+0x184):
In function `_itoa':
: undefined reference to `__lshrdi3'
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itoa.o)(.text+0x184):
In function `_itoa':
: relocation truncated to fit: R_PPC_REL24 __lshrdi3
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itoa.o)(.text+0x2fc):
In function `_itoa':
: undefined reference to `__ashldi3'
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itoa.o)(.text+0x2fc):
In function `_itoa':
: relocation truncated to fit: R_PPC_REL24 __ashldi3
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itowa.o)(.text+0x170):
In function `_itowa':
: undefined reference to `__lshrdi3'
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itowa.o)(.text+0x170):
In function `_itowa':
: relocation truncated to fit: R_PPC_REL24 __lshrdi3
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itowa.o)(.text+0x188):
In function `_itowa':
: undefined reference to `__lshrdi3'
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itowa.o)(.text+0x188):
In function `_itowa':
: relocation truncated to fit: R_PPC_REL24 __lshrdi3
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itowa.o)(.text+0x300):
In function `_itowa':
: undefined reference to `__ashldi3'
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(_itowa.o)(.text+0x300):
In function `_itowa':
: relocation truncated to fit: R_PPC_REL24 __ashldi3
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(strtoll.o)(.text+0x2d0):
In function `__strtoll_internal':
: undefined reference to `__udivdi3'
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(strtoll.o)(.text+0x2d0):
In function `__strtoll_internal':
: relocation truncated to fit: R_PPC_REL24 __udivdi3
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(strtoll.o)(.text+0x2f0):
In function `__strtoll_internal':
: undefined reference to `__umoddi3'
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(strtoll.o)(.text+0x2f0):
In function `__strtoll_internal':
: relocation truncated to fit: R_PPC_REL24 __umoddi3
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(strtoull.o)(.text+0x2d0):
In function `__strtoull_internal':
: undefined reference to `__udivdi3'
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(strtoull.o)(.text+0x2d0):
In function `__strtoull_internal':
: relocation truncated to fit: R_PPC_REL24 __udivdi3
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(strtoull.o)(.text+0x2f0):
In function `__strtoull_internal':
: undefined reference to `__umoddi3'
/home/skunkworks/crosscompiler/crosstool-0.10/result/ppc-405-linux-gnu/
gcc-3.2.3-glibc-2.2.5/ppc-405-linux-gnu/lib/libc.a(strtoull.o)(.text+0x2f0):
In function `__strtoull_internal':
: relocation truncated to fit: R_PPC_REL24 __umoddi3
collect2: ld returned 1 exit status
make: *** [test] Error 1
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list