Subject: ntp4: ELF and missing objects in the shared library.
To: None <tech-toolchain@netbsd.org, tech-userlevel@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: tech-toolchain
Date: 01/20/2000 12:45:07
Folks,

I'm working on integrating ntp4 into NetBSD, and have come across an old
problem where one library module has a reference to a function that the
calling program is expected to define, but the program doesn't call that
module.  It links fine with the normal ".a" library.  A similar problem
exists with libwrap and it's "allow_severity" and "deny_severity".

	alpha:src/usr.sbin/ntp 37> make
	all ===> ntpd
	all ===> ntpdate
	all ===> ntpdc
	cc   -o ntpdc ntpdc.o ntpdc_ops.o version.o -lntp
	/usr/lib/libntp.so: undefined reference to `input_handler'
	collect2: ld returned 1 exit status
	*** Error code 1

	Stop.
	*** Error code 1

	Stop.
	Exit 1
	alpha:src/usr.sbin/ntp 38> cd ntpdc/obj.alpha/
	alpha:ntp/ntpdc/obj.alpha 39> cc   -o ntpdc ntpdc.o ntpdc_ops.o version.o /usr/lib/libntp.a 
	alpha:ntp/ntpdc/obj.alpha 40> ls -l ntpdc
	-rwxrwxr-x  1 simonb  wsrc  357088 Jan 20 12:24 ntpdc*

Two questions then:

 1) Why do we have a libntp as a shared object (or a library at all in
    /usr/lib)?  The ntp distribution doesn't seem to install it, and
    it's not as if we get a huge saving - on an alpha:

	alpha:usr.sbin/ntp/ntpd 30> size /usr/lib/libntp.so
	text    data    bss     dec     hex     filename
	63690   15044   2612    81346   13dc2   /usr/lib/libntp.so

 2) Failing that, do I just define a dummy routine in the programs that
    don't have an input_handler function?  Kinda gross...

 3) Is this something that weak aliases can handle?  Not a guru here...

Simon.