Force exporting morestack from llgoi, so that
the symbol is available to the execution engine
when linking with libLLVM.so. The engine does
not reference morestack explicitly, so must
be provided by the host program.
Details
Diff Detail
Event Timeline
Can you explain why the stuff in lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp doesn't help here?
The problem is when ExceptionEngine is built as a shared library. In this case, libLLVMExecutionEngine.so (or libLLVM.so, as in my case) has a weak symbol reference to __morestack, rather than the main program having the weak symbol. That weak symbol reference is never resolved because neither llgoi nor libgo-llgo exports it.
Is there a better, more general solution? This feels a bit kludgey, but I'm not sure what else to do about it. Perhaps a mode in which ExecutionEngine can be compiled with a non-weak reference to __morestack?
LGTM
Another solution would be to have LLVMExecutionEngine contain a strong reference to __morestack conditional on whether the symbol is found at configure time. That seems kind of bad as well, since we try to avoid adding new configure-time checks. Up to you on which way to go though.