Shared C++ libs on i386-pc-solaris2.5.1

Richard Henderson rth@cygnus.com
Thu Sep 11 13:20:00 GMT 1997


> On some systems (PAs running hpux), you can't have a text/readonly data
> item which is initialized to the address of another item.
> 
> ie
> 
> 	.word foo
> 
> isn't valid if it's going into the text or readonly data section.

This is not the case on an i386 ELF system.

In the main application there is a nasty hack called .dynbss which the
linker creates to hold all of the variable references.  So the symbols
are really at constant addresses, and have their contents filled in at
run time.  (It is odeious and breaks when symbol sizes (read arrays)
change.)

A shared library, on the other hand, is tagged with DT_TEXTREL which
tells the loader that it should temporarily remap everything read-write.
Thus, while outputting read-only data that contains relocactions should
be avoided (because of the mprotect penalty), it does function correctly.

All this is if course how things are _supposed_ to work.  If you've got
a broken loader on some system...


r~



More information about the Gcc mailing list