Position independent code and global destructor order (devel/ice)

Michael Gmelin freebsd at grem.de
Thu Dec 5 17:27:41 UTC 2013

On Thu, 5 Dec 2013 19:07:28 +0200
Konstantin Belousov <kostikbel at gmail.com> wrote:

> If you provided link to the original discussion, it would take much
> less energy and time to refresh the memory.

Forgot to include it, sorry. Thanks for you response and the patch.

> I looked over this, and I think that r211706 can be refined, by only
> calling atexit hooks for 'wrong' dso when the call to __cxa_finalize()
> is from the real dlclose(), as opposed to the process exit.  For me,
> with the world where the patch is applied, your 'major tom' test
> passes.

Makes sense.

> Of course, when dso1 registers __cxa_atexit hook located in dso2, and
> dso2 is unloaded before dso1, the hooks are called in the wrong order
> still, but the only alternatives there are either crash or do not call
> such hooks at all.

Sounds like a good solution. PHP (and similar) crashes are avoided
while clean code isn't affected. I will try the patch in my specific
use case to make sure it works there as well.

Michael Gmelin

More information about the freebsd-ports mailing list