Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!lll-crg!lll-lcc!pyramid!decwrl!sun!guy From: guy@sun.UUCP Newsgroups: net.unix-wizards Subject: Re: ranlib and ``ucb'' Message-ID: <4976@sun.uucp> Date: Thu, 10-Jul-86 14:54:04 EDT Article-I.D.: sun.4976 Posted: Thu Jul 10 14:54:04 1986 Date-Received: Fri, 11-Jul-86 22:47:07 EDT References: <1916@brl-smoke.ARPA> <1278@ncoast.UUCP> <292@foxvax5.UUCP> <2318@umcp-cs.UUCP> Organization: Sun Microsystems, Inc. Lines: 43 > As I understand it, the System V `ar' has a `virtual ranlib' built in > to it; running `ar' on an object file (one with an appropriate magic > number) automatically builds or updates the __.SYMDEF archive member. Yup. The symbol table archive member's name is a null string, rather than "__.SYMDEF". Actually, running "ar" with any command to update the archive, or with the "s" keyletter, builds, updates, or deletes the table-of-symbols member; if there were any object files in the archive, it's installed, otherwise it's not. The temporary intermediate-file version of the archive doesn't have the table of symbols, so if it's not installed it is in effect deleted, so if you have an archive with some object files and some non-object files, deleting all the object files makes the table of symbols disappear. > It seems to me that this is the correct external behaviour: the library > builder should manage its table of contents itself. Yes, it's less error-prone, which is presumably why most other OSes do it this way. (It's not perfect; if you copy an archive file, you have to do "ar ts >/dev/null" to reconstruct the table of symbols. You could, of course, write a script to do for i in "$@" do ar ts $i >/dev/null done and call it "ranlib".... The 4.3BSD "ranlib" has a "touch" option which merely updates the time on the table-of-symbols member, rather than rebuilding it, which is useful for the case described above.) > (I would be just as happy with a /usr/bin/ar shell script that invoked > ranlib when inserting an object file, although it would probably be slower.) Actually, the equivalent would be a script which ran "ranlib" if 1) any command to update the archive were run or 2) the "s" keyletter were specified. The only differences here would be that the table of symbols would always be installed, whether the archive had any object files in it or not, and would never be deleted. -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)