[llvm-dev] runStaticConstructorsDestructors() causes crash on exit

Geoff Levner via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 14 03:44:06 PDT 2018

Greetings, LLVM wizards.

I am using clang to compile a C++ module, and an ExecutionEngine (MCJIT) to
execute a function it defines. That works (or pretends to). However, if I
call the module's constructors first:

exec_engine->runFunctionAsMain(function, argvec, NULL);

execution still works, but my program crashes when it exits, in
__run_exit_handlers(). I can't tell from gdb what exit handler is crashing,
but no calls are made to atexit() or on_exit(); all exit handlers are
installed via __cxa_atexit().

This may or may not be meaningful, but I am forced to compile with
-fno-use-cxa-atexit, otherwise clang complains that __dso_handle could not
be resolved.

Any guidance would be MUCH appreciated. I am at a loss... Also, if you know
of a better place to look for help than this mailing list, that would be
appreciated, too.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180614/7dca7262/attachment.html>

More information about the llvm-dev mailing list