Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!mcvax!botter!ast
From: ast@cs.vu.nl (Andy Tanenbaum)
Newsgroups: comp.os.minix
Subject: Re: a question about ar
Message-ID: <1542@botter.cs.vu.nl>
Date: Mon, 27-Jul-87 17:09:13 EDT
Article-I.D.: botter.1542
Posted: Mon Jul 27 17:09:13 1987
Date-Received: Wed, 29-Jul-87 04:18:16 EDT
References: <310@galbp.LBP.HARRIS.COM>
Reply-To: ast@cs.vu.nl (Andy Tanenbaum)
Organization: VU Informatica, Amsterdam
Lines: 23

In article <310@galbp.LBP.HARRIS.COM> bing@galbp.UUCP (Bing Bang) writes:
>Yesterday I modified ioctl.c (I wrote a serial tty driver)
>and replaced it in libc.a by doing:
>
>        ar r libc.a ioctl.s
>
>When I tried to cc a program that called ioctl, however, it failed.

The linker is a one-pass linker, so you can't have forward references.  If
procedure x calls y and z, x must appear in the library before y and z so
that after loading x asld will know that it needs y and z.  (I presume you
compiled with the -LIB option, which is needed).  Unfortunately there is
no easy way to insert a module at an arbitrary place.  You have to dismember
the archive, and then build a new one from scratch using
   ar r newlib.a file1 file2 file3 ...
There should be an option to ar so you could say:
   ar rb module libc.a file1
to replace before 'module'.  Any volunteers on this one?

If you have a serial line driver that works, please post it.  There will be
a lot of interest.  One was posted earlier, but that one is not fully debugged.

Andy Tanenbaum (ast@cs.vu.nl)