*BSD News Article 5060


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!spool.mu.edu!yale.edu!qt.cs.utexas.edu!news.Brown.EDU!noc.near.net!news.cs.brandeis.edu!ST923150@pip.cc.brandeis.edu
From: st923150@pip.cc.brandeis.edu
Subject: Re: Shared Libs for X11?, was Re: 386bsd -- The New Newsgroup
Message-ID: <1992Sep15.143458.15689@news.cs.brandeis.edu>
Sender: news@news.cs.brandeis.edu (USENET News System)
Reply-To: st923150@pip.cc.brandeis.edu
Organization: Brandeis University
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: Tue, 15 Sep 1992 14:34:58 GMT
Lines: 19

Well, in a way, the mechanism involved by SunOS does use self-modifying code.
Sorta, that is.  The executable image is modified in place immediately before
execution begins.  A small kernel extension may be needed to alias the text
segment to a r/w data segment (as Intel text segments are either execute only
or execute/read, but not e/r/w).  Still, this is the simplest way I can think
of to do good (i.e.- not fixed offset dependent where if you recompile the lib
you must recompile all the executables that need it) shared libs.  All that is
needed is writing a C code-generator preamble to call the dynamic linker in
all executables, the dynamic linker itself, and maybe very small kernel mods
to allow the dynamic linker to find the text and alias it as data.  There
would be no need to reverse-engineer anything Sun did, and I doubt that the
_concept_ is patentable (lawyer's opinion appreciated here).  The dynamic
linker needed is actually _almost_ ld itself, and, indeed, were I to write
it, I would do so by patching ld.  Small modifications to ld are also necessary,
so that we get the needed library names (stuff that Sun puts in a struct
called __DYNAMIC in each executable) into the executables, too.  Well, those
are my thoughts.  I might volunteer to work on this, or at least part of it,
if people think it is a viable approach...
-ben