This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Global Constructors and Shared Libraries


Would someone please take a brief moment and explain to me how
shared libraries and linking is done on Unix boxes?

I'm back to working on my port of g++ to the HP3000 and need
to figure out how to get the equivalent functionality to work
on MPE. Here's the issue:

MPE is late binding. By definition, all code on MPE is
"shared", yet we don't require position independence. (In
fact our linkedit program complains if the code is PIC).
The final link stage takes place at load time. This allows
our shared libraries to be replaced at anytime without
relinking all other dependent libraries or code. As a
result, programs built 15 years ago on MPE can still
run and get the latest/greatest functionality, and they
needn't be relinked to do so.

My problem now is due to the late binding feature, I need
to figure out how to make programs be able to invoke the
global constructors in the shared library. I see in the
collect2 code some stuff meant to do that, but it appears
that this requires the program be linked and reference the
shared library in order to scan it for these references.
(Is that true whenever a shared library is replaced?)

Collect2 runs something called "ldd" that doesn't exist on
MPE. Since I don't know how this works on other platforms,
I'm  a bit at a loss to emulate it on MPE.

Any help would be appreciated.

TIA,



Mark
--
Mark Klein                                 DIS International, Ltd.
http://www.dis.com                         415-892-8400
PGP Public Key Available			

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]