From: | "Thomas M. Maslen" <maslen@best.com> |
Newsgroups: | comp.compilers,comp.lang.c |
Date: | 29 Jan 1997 11:52:55 -0500 |
Organization: | Compilers Central |
References: | 97-01-183 97-01-196 |
Keywords: | linker |
>> [I have long maintained that nested link-time scopes are a good
>> idea, but I've never seen a linker that actually provides them. -John]
>[It means what it sounds like, groups of modules which share symbols
>but export limited numbers of symbols to the outside. For small
>programs, it's overkill, but for large programs with lots of libraries
>and subsystems, it'd be nice not to have to prefix every symbol shared
>among routines in the foo subsystem with "foo_".
Oh, that's fine then; to me, "nested link-time scopes" conjured up a vision
of something much more elaborate (where "elaborate" is a perjorative).
>Re Solaris, I looked at the ld man page on a nearby 4.1.4 system and it
>looked like the same old dumb linker, just barely smart enough to create and
>defererence shared libraries.
Right. SunOS 4.x still has the old a.out linker. Solaris 2.x (SunOS
5.x) has the ELF linker, and it's there that the new stuff is being
done. In particular, the scoping stuff only showed up in Solaris 2.5
(October 1995).
>Is there something else I should look at? -John]
Hmmm. The Solaris 2.5 ld(1) entry itself doesn't offer much more than this:
-B local Cause any global symbols, not assigned to a
version definition, to be reduced to local.
Version definitions can be supplied via a map-
file, and indicate the global symbols that
should remain visible in the generated object.
This option achieves the same symbol reduction
as the auto-reduction directive available as
part of a mapfile version definition, and may be
useful when combining versioned and non-
versioned relocatable objects.
Most of the good stuff lives in the "Solaris 2.5 Linker and Libraries
Guide". I don't have a copy of this myself, and as far as I know it's
not on the Web. There's a table of contents at
<URL:http://sunexpress.usec.sun.com/sunexpress/pims_attr/BK_Linker_and_Libraries_Guide_1.Long_Description.UE.txt>,
but that's only there because SunExpress wants to sell the 280-page
printed version. Short of laying hands on a machine that has the
Solaris 2.5 developer documentation CD (not just the end-user docs)
installed, or on a printed copy, I don't know what to suggest.
The only other tidbit I have is this description from one of the SunSoft
linker guys:
The Solaris 2.5 ld(1) offers a facility we call scoping. Via a mapfile
you can select those symbols that should remain global in the output
file of the link-edit, any other global symbols will be demoted to locals
(as if they'ed been defined static). There is also a versioning scheme
associated with this scoping.
This facility has been used extensively in 2.6 to define the interfaces of
our shared objects. Yes this also reduces relocations and speeds startup,
but its real intent is to define the objects interface.
The technique is generic to any link-edit, and so it is also possible to
create a new object with ld(1) -r, and specify what global symbols will
remain in that object. So you can create nested link-time scopes.
Thomas
maslen@pobox.com
[Sounds promising. I should write up a note about what I think link-time
scopes should accomplish. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.