*BSD News Article 5125


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!uunet!mcsun!sun4nl!eur.nl!pk
From: pk@cs.few.eur.nl (Paul Kranenburg)
Subject: Re: Shared Libs for X11?, was Re: 386bsd -- The New Newsgroup
Message-ID: <1992Sep16.111456.28721@cs.few.eur.nl>
Sender: news@cs.few.eur.nl
Reply-To: pk@cs.eur.nl
Organization: Erasmus University Rotterdam
References: <18iprpINNg6e@agate.berkeley.edu> <1992Sep8.200625.2894@socrates.umd.edu> 	<veit.716026274@du9ds3> <18lkkkINN14d@agate.berkeley.edu> 	<veit.716107923@du9ds3> <7dnL02y821gh01@JUTS.ccc.amdahl.com> 	<veit.716291291@du9ds3> <1992Sep14.232949.9093@bby.com.au> <veit.716561866@du9ds3>
Date: Wed, 16 Sep 1992 11:14:56 GMT
Lines: 33

In <veit.716561866@du9ds3> veit@du9ds3.uni-duisburg.de (Holger Veit) writes:

>This is what I originally intended; I'm just sitting in front of a Sparc,
>and curiously watch what it is doing...:-). There are two possible problems:
>1. What will Sun say about using (or reverse-engineering) their solution
>   (in the light of AT&T vs. BSDI/UCB...)?
>2. It is rumoured that the whole Sun DL stuff depends on or contains 
>   self-modifying code, which caused/s problems with SunOS look-alikes 
>   like Solbourne OS/MP (was fixed by some strange patch in OS/MP). I don't
>   know whether this is needed (I suppose, not), but it make me think that
>   this can be not a clean solution.

>What is "the net's" opinion?

Sun's current dynamic library stuff is pretty much the same as described
in the SVR4 ABI documents. The major difference is the use of ELF format
in the latter in stead of SunOS 4.x.x's `a.out'.

A properly linked executable (linked with properly constructed dynamic
libraries) will only need fixups to be applied to the data segment(s)
at run-time. If improperly linked, ld.so may need to apply relocations
to one or more of the text segments resulting in unshareble pages (BTW, this
is the case with Sun's Openwin3.0 shared libraries). When this happens, ld.so
calls mprotect(2) to make the the pages in which the code it needs to fixup
reside, writable.

Given the fact that modern BSD systems support mmap(2) and mprotect(2), a
scheme like this looks possible. I've verified that an object file (linked
with `ld -A ..') can be `mapp'ed into a process's address and executed.
Next on the list are modifications to as, ld, crt0 to assist in the
construction of shared libraries.

-pk