[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference smurf::unix_objsym

Title:Digital UNIX Object File/Symbol Table Notes Conference
Moderator:SMURF::LOWELL
Created:Mon Nov 25 1996
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:71
Total number of notes:314

63.0. "-B symbolic linker option proposal" by SMURF::COURTNEY () Mon Jan 20 1997 13:42

T.RTitleUserPersonal
Name
DateLines
63.1Will this affect "cc -Bstring"?DECC::SULLIVANJeff SullivanMon Jan 20 1997 15:3517
63.2SMURF::COURTNEYTue Jan 21 1997 15:555
63.3Does resolution *always* start with the current library if linked -B symbolic?WIBBIN::NOYCEPulling weeds, pickin' stonesFri Jan 24 1997 15:5628
Is my understanding correct?

If my shared library "test.so" contains two functions:
	libentry() { printf("in test.so/libentry\n"); test(); }
	test() { printf("in test.so/test\n"; }
and my main source file contains
	main() { test(); libentry(); }
	test() { printf("in main/test\n"); }

then by today's rules I see
  > cc main.c test.so
  > a.out
  in main/test
  in test.so/libentry
  in main/test

and if I built the library test.so using  -B symbolic  then I would see
  > cc main.c test.so
  > a.out
  in main/test
  in test.so/libentry
  in test.so/test

That is, references within the library are resolved to definitions within
the library if possible, even if there is already an active definition of
the same name?


63.4correctSMURF::LOWELLMon Jan 27 1997 09:296
re. .3

That's correct.  -B symbolic will essentially turn off
preemption.


63.5Please don't take this the wrong way...WIBBIN::NOYCEPulling weeds, pickin' stonesMon Jan 27 1997 10:354
It sounds as if this gives ld an opportunity to optimize intra-image
references in that case, such as turning JSR's into BSR's, and
eliminating loads from the GOT.  Perhaps this could reduce some of
the notorious overhead of using shared libraries on Digital UNIX.
63.6AOSG::LOWELLMon Jan 27 1997 11:1215
> It sounds as if this gives ld an opportunity to optimize intra-image
> references in that case, such as turning JSR's into BSR's, and
> eliminating loads from the GOT.  Perhaps this could reduce some of
> the notorious overhead of using shared libraries on Digital UNIX.

Good observation.  If memory serves me, I believe the linker already
does this optimization for references to symbols defined in the main
executable (building on the assumption that the main executable's
symbols can only be the premptors, not the preemptees.)  Since the
basic optimization mechanism is already in place in ld, it may not
be too difficult to expand it to do the same thing for shared libraries,
when -B symbolic is specified.

Thanks for identifying this opportunity.

63.7approvedAOSG::LOWELLMon Jan 27 1997 11:358
The review minutes for this proposal will be
available online at 

   http://www.zk3.dec.com/~lowell/of_stwg/dmin012797.html

The proposal has been approved.

OF/STWG ECO ID = 9