OpenSSH 3.7.1p2 linked libs

Georg Schwarz geos at
Sun Feb 15 22:06:48 EST 2004

> > The linker should ignore unnecessary dependancies, shouldn't it?
> It doesn't (on Linux anyway, I suspect it's the same on other systems).

it doesn't on IRIX 5.3 either
> That said, it's already tricky to get the library path and link order 
> right on all supported configurations, and I would not like to see it 
> made harder by maintaing different ones for different binaries.

in this particular case I guess it should not be that hard. Have -lgen
not added to LIBS by configure but, say, to LIBGEN. LIBGEN is then either
-lgen or empty. Have LIBGEN added to the sshd link line only (assuming
this is the only place where you use basename, dirname; from my tests it
Similarly for, say, LIBCRYPTO, which you add everywhehe ehere LIBS already
is except for the scp link line. That way you gain a finer granularity
for selecting which libs to actually use.

> Georg, does this cause an actual problem?  libgen is part of the base 

well, things run nonetheless, but of course it is not optimum. libgen
is part of the OS, libcrypto is not. In any case we get unnecessary
dynamic library dependencies. I guess this will at least make binary
startup a bit slower and could add to overall runtime memory consumption.

> OS, right?  Also, there's no noticable difference in size on Linux.
> $ cat hello.c
> #include <stdio.h>
> int main(void) { puts("Hello, world."); }
> $ gcc hello.c -lcrypto
> $ ldd a.out
> => /lib/ (0x40028000)
> => /lib/ (0x4011f000)
> => /lib/ (0x40246000)
> => /usr/lib/ (0x40249000)
>          /lib/ => /lib/ (0x40000000)

lorenz 15% cc hello.c -lgen
lorenz 16% elfdump -Dl a.out

                        ***LIBRARY LIST SECTION***
        Name         Time-Stamp           CheckSum   Flags Version
.liblist    Nov  1 03:20:56 1994 0xe81f4ee2  NONE sgi1.0    Nov  1 03:18:58 1994 0x47ba9926  NONE sgi1.0

lorenz 17% cc hello.c -L/usr/local/pkg/lib -lcrypto
lorenz 18% elfdump -Dl a.out

                        ***LIBRARY LIST SECTION***
        Name         Time-Stamp           CheckSum   Flags Version
.liblist Feb  5 01:16:41 2004 0xb21379bb  NONE    Nov  1 03:18:58 1994 0x47ba9926  NONE sgi1.0

a.out sizes:

with no libs: 13020
with lgen: 13020
with lcrypto: 13116
with both: 13116

Georg Schwarz
 geos at     +49 177 8811442

More information about the openssh-unix-dev mailing list