Undefined libgcc symbols and i386-linux-newlib
Jeff Johnston
jjohnstn@redhat.com
Mon Nov 28 22:09:00 GMT 2005
Shaun Jackman wrote:
> Hello,
>
> 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
> _divdi3.o:
> 00000000 T __divdi3
> _udivdi3.o:
> 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
> -B/home/sjackman/src/toolchain/newlib-cvs/i386-linux-newlib/i386-linux-newlib/newlib/
> -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
> dynamically?
>
Yes, that would make sense. The Makefile.am file libc_la_LDFLAGS and
libm_la_LDFLAGS currently hard-code -lgcc.
> When I run ldd on .libs/libc.so, it reports the file is statically
> linked. Is that normal?
>
In this case, it is. The library itself has no dynamic links due to the
fact it has been linked to the static libgcc.
> 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.
>
> Thanks,
> Shaun
More information about the Newlib
mailing list