[omniORB] linkHacks.h and "sophisticated" linkers
Wolfgang Textor
wtextor@codesco.com
Tue Jan 28 09:00:03 2003
Hi,
when compiling one of the latest builds using Metrowerks CodeWarrior
8.3 I encountered the problem, which has been described in the thread
"Problems with SGI and OmniORB-4.0.0". The solution presented in the
message archived as
<http://www.omniorb-support.com/pipermail/omniorb-list/2003-January/
022836.html> did work for me as well, and I suggest to change the
linkHacks mechanism according to this solution. I did, however, include
the "if" statement into the function omni_codeSet_initialiser::attach()
[exactly: after the line containing "omniCodeSet::logCodeSets();"].
Some technical background:
Even if they are forced to link any static initializers, some linkers
include only initializers from every source file THEY LOOK AT. As I had
to find out, the capitalized words are the important part. If those
linkers completely ignore a file, because no functions from this file
have to be included into the output, they never keep the initializers
from this source file. In this case the only solution is to force the
linker to include at least one function or variable from this file by
explicitly referencing it from active code.
I have posted the suggestion below onto one of the CodeWarrior
newsgroups and I am waiting for a response from Metrowerks. Maybe users
of other compilers should suggest the same to their respective compiler
manufacturers.
> At least for static initializers the following logic for determining
> "used code" should be added:
> "If a source file contains any static initialization code and this
> code references any variable from another source file, the
> initialization code must be included."
> This rule covers initializers with side effects and should allow
> dead-stripping in any case.
Regards,
Wolfgang Textor