I definitely think that you're going to need to look into
implementation guarantees not just the language standard to make
progress here.
There are certainly cases where constructors are called the first time
an object is used...and by that I mean that the linker performs the
first lazy relocation on that object.
I don't think that gives you the invocation follows reverse of
dependency graph you proposed in opening this discussion.
Although, it may give you hints for forcing a dependency order.
With such a linker, if you take the address of a function in a
trans/translation unit ((either by calling that function or putting the
address in a pointer in such a manner that you fully resolve the
relocation), you will generally trigger that unit to be constructed.
I don't know what happens if you are in the middle of your own init
processing--whether you or that unit will be considered first for fini
processing (assuming Elf).
Also, as you pointed out, the linker will need to have cycle-breaking
behavior, which can complicate things.
Having talked to Scott about this mess years ago, Shibboleth is designed with the assumptions that
the Windows linker cprovides, so you may run into problems on other
platforms.
If I were stuck with this mess I'd put effort into exit vs dlclose
detection on Windows and Linux.
I don't think mech_eap can expect its callers to call _exit. While that
might sort of work for tids, I've seen this problem pop up in other
processes as well.
--Sam
|