🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #6475

Building shared Libraries

#6475
From: Jim Herson
Date: Fri, 11 Jan 1991 18:42
35 lines
2208 bytes
A few questions about building shared libraries. In particular I'm
confused on how to build the .sa files.

It seems that it's important to separate out shared/read-write data from
shared/read-only text. If you mix the two much of the library won't be
shared. 

Initialized exported (C global) variables need to be broken out into a
separate .c file. This file is compiled/linked into both the .so and .sa
files. Question: why do the globals  need to go into both files? Why
aren't un-initialized exported variables handled in the same way? How are
initialized and uninitialized static variables handled within a procedure
and within a module?

There also seems to be an efficient way to allocate string constants.
That is to make strings read-only data. xstr() yanks out all source code
strings and replaces it with a reference to a (newly created) global
string table called xstr[]. Then a file sx.c is produced with the
definition and initialization of this xstr[] global string table.
Question: how should this sx.c file be compiled? Should the -R (read-only
initialization data) compile flag be set for xs.c? Should the -R flag be
set for all modules within the library? Does the xs.o file go into the .so
library only or both the .so and .sa libraries?

Finally, is there anyway to get a link map inorder to verify the
efficiency of the shared library? Which variables are read-only. Which
procedures share the same physical page etc. 

The only documentation I've been able to locate is the ld() man page and 
chapter one of the Programming Utilities and Libraries manual. Are there
any other references out there?


Thanks,
Jim Herson <HERSON@ERG.SRI.COM>
Technical Details
Message-ID: <1218@brchh104.bnr.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request
From: herson@erg.sri.com (Jim Herson)
Newsgroups: comp.sys.sun
Subject: Building shared Libraries
Keywords: Miscellaneous
Message-ID: <1218@brchh104.bnr.ca>
Date: 11 Jan 91 18:42:25 GMT
Sender: news@brchh104.bnr.ca
Organization: Sun-Spots
Lines: 35
Approved: Sun-Spots@rice.edu
X-Sun-Spots-Digest: Volume 10, Issue 19, message 3
X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu