Undefined libgcc symbols and i386-linux-newlib

Shaun Jackman sjackman@gmail.com
Mon Nov 21 22:39:00 GMT 2005


The i386-linux-newlib toolchain I've been attempting to build is
nearing completion. I'm working on shared libraries at the moment.
When I build libc.so, for whatever reason the resulting binary has
undefined references to symbols in libgcc.

i386-linux-newlib/newlib$ nm .libs/libc.so | grep ' U '
         U __divdi3
         U __moddi3
         U __udivdi3
         U __umoddi3

libgcc appeared to build and install correctly though:

$ nm /usr/local/i386-linux-newlib/lib/libgcc_s.so.1 | grep divdi3
00004aec T __divdi3
00004e54 T __udivdi3
$ nm /usr/local/lib/gcc/i386-linux-newlib/4.1.0/libgcc.a | grep divdi3
00000000 T __divdi3
00000000 T __udivdi3

libc.la is being linked against -lgcc, so I think libgcc.a should be
statically linked:

/bin/sh ./libtool --mode=link i386-linux-newlib-gcc
-isystem /home/sjackman/src/toolchain/newlib-cvs/i386-linux-newlib/i386-linux-newlib/newlib/targ-include
-isystem /home/sjackman/src/toolchain/newlib-cvs/newlib/libc/include 
-O2 -g-O2   -o libc.la -rpath /usr/local/i386-linux-newlib/lib
-version-info 0:0:0 -release newlib -Xcompiler -nostdlib -Xlinker
--version-script=../../../newlib/libc/sys/linux/shared.ld -lgcc
-objectlist libc-libtool-objectlist

Should it be linked against -lgcc_s perhaps instead of -lgcc to link

When I run ldd on .libs/libc.so, it reports the file is statically
linked. Is that normal?

newlib$ ldd .libs/libc.so
        statically linked

I know I'm into new ground here, but I'd appreciate very much any help
you could give me.


More information about the Newlib mailing list