__udivdi3 seems to be defined in libgcc.a, but in openssh ld complains of undefined reference

David Daney ddaney@avtrex.com
Sat Apr 1 00:03:00 GMT 2006


David Wuertele wrote:
> I used crosstool-0.42 to build a gcc-3.3.3-glibc-2.3.2
> "mipsel-dave-linux-gnu" toolchain.  This toolchain works great for me
> in every way but one: I'm unable to compile openssh.  The
> openssh-4.3p2 build complains:
> 
>   mipsel-dave-linux-gnu-ld: warning: cannot find entry symbol __start; defaulting to 0000000000411290
>   /tools/targets/RELEASE/staging/lib/libcrypto.a(bn_div.o)(.text+0x338): In function `BN_div':
>   : undefined reference to `__udivdi3'
> 
> There are other symbols that it complains about (see below for my
> entire openssh build log -- the errors are at the very bottom).  
> 
> I ran nm on my libgcc.a thusly, does this output mean that the
> required object is defined?
> 
>   $ /tools/gcc-3.3.3-glibc-2.3.2/mipsel-dave-linux-gnu/bin/mipsel-dave-linux-gnu-nm /tools/gcc-3.3.3-glibc-2.3.2/mipsel-dave-linux-gnu/lib/gcc-lib/mipsel-dave-linux-gnu/3.3.3/libgcc.a | grep -C 1 udivdi3
> 
>   _udivdi3.oS:
>            U __clz_tab
>            U _gp_disp
>   00000000 T __udivdi3
> 

Yes, there it is marked with a 'T' as expected.

>   $ 
> 
> Any suggestions on how to get ld to link openssh?
> Thanks.
> 
.
.
.
>   mipsel-dave-linux-gnu-gcc -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -std=gnu99  -I. -I. -I/tools/targets/RELEASE/staging/include  -DSSHDIR=\"/tools/targets/RELEASE/staging/etc\" -D_PATH_SSH_PROGRAM=\"/tools/targets/RELEASE/staging/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/tools/targets/RELEASE/staging/libexec/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/tools/targets/RELEASE/staging/libexec/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/tools/targets/RELEASE/staging/libexec/ssh-keysign\" -D_PATH_SSH_PIDDIR=\"/var/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DSSH_RAND_HELPER=\"/tools/targets/RELEASE/staging/libexec/ssh-rand-helper\" -DHAVE_CONFIG_H -c sshconnect1.c
>   mipsel-dave-linux-gnu-gcc -g -O2 -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -std=gnu99  -I. -I. -I/tools/targets/RELEASE/staging/include  -DSSHDIR=\"/tools/targets/RELEASE/staging/etc\" -D_PATH_SSH_PROGRAM=\"/tools/targets/RELEASE/staging/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/tools/targets/RELEASE/staging/libexec/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/tools/targets/RELEASE/staging/libexec/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/tools/targets/RELEASE/staging/libexec/ssh-keysign\" -D_PATH_SSH_PIDDIR=\"/var/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DSSH_RAND_HELPER=\"/tools/targets/RELEASE/staging/libexec/ssh-rand-helper\" -DHAVE_CONFIG_H -c sshconnect2.c
>   mipsel-dave-linux-gnu-ld -o ssh ssh.o readconf.o clientloop.o sshtty.o sshconnect.o sshconnect1.o sshconnect2.o -L. -Lopenbsd-compat/ -L/tools/targets/RELEASE/staging/lib  -lssh -lopenbsd-compat -lresolv -lcrypto -lutil -lz -lnsl  -lcrypt
>   mipsel-dave-linux-gnu-ld: warning: cannot find entry symbol __start; defaulting to 0000000000411290
>   /tools/targets/RELEASE/staging/lib/libcrypto.a(bn_div.o)(.text+0x338): In function `BN_div':
>   : undefined reference to `__udivdi3'

Typically you link with gcc instead of ld to avoid just these types of 
problems.

I would either change it to link using gcc, or add the proper -L and -l 
options to get it to use the proper libgcc

David Daney

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list