Re: Help- selective symbol exposure after link

"Thomas M. Maslen" <maslen@best.com>
29 Jan 1997 11:52:55 -0500

          From comp.compilers

Related articles
Help- selective symbol exposure after link jason@interval.net (Jason Spielman) (1997-01-22)
Re: Help- selective symbol exposure after link kaz@nt.com (1997-01-25)
Re: Help- selective symbol exposure after link maslen@best.com (Thomas M. Maslen) (1997-01-25)
Re: Help- selective symbol exposure after link mac@coos.dartmouth.edu (1997-01-25)
Re: Help- selective symbol exposure after link dlmoore@ix.netcom.com (David L Moore) (1997-01-26)
Re: Help- selective symbol exposure after link whsieh@cs.washington.edu (1997-01-29)
Re: Help- selective symbol exposure after link maslen@best.com (Thomas M. Maslen) (1997-01-29)
Re: Help- selective symbol exposure after link aeb@saltfarm.bt.co.uk (1997-01-29)
Re: Help- selective symbol exposure after link albaugh@agames.com (1997-01-30)
Re: Help- selective symbol exposure after link leichter@smarts.com (Jerry Leichter) (1997-01-30)
Re: Help- selective symbol exposure after link root@jacob.remcomp.fr (1997-02-02)
Re: Help- selective symbol exposure after link Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-02-07)
Re: Help- selective symbol exposure after link Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-02-07)
[6 later articles]
| List of all articles for this month |
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]


--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.