[ORC] Update lazyReexports to support aliases with different symbol names.
authorLang Hames <lhames@gmail.com>
Wed, 15 Jan 2020 01:09:02 +0000 (17:09 -0800)
committerLang Hames <lhames@gmail.com>
Wed, 15 Jan 2020 16:02:53 +0000 (08:02 -0800)
commitd2fabd70065edefacee0d8a3122c73bc15e0f848
tree03a6aac80752a848d865761b6e3f018c7f4efe77
parent63b428e3861bed666525b3af56cd50e14ab30495
[ORC] Update lazyReexports to support aliases with different symbol names.

A bug in the existing implementation meant that lazyReexports would not work if
the aliased name differed from the alias's name, i.e. all lazy reexports had to
be of the form (lib1, name) -> (lib2, name). This patch fixes the issue by
capturing the alias's name in the NotifyResolved callback. To simplify this
capture, and the LazyCallThroughManager code in general, the NotifyResolved
callback is updated to use llvm::unique_function rather than a custom class.

No test case yet: This can only be tested at runtime, and the only in-tree
client (lli) always uses aliases with matching names. I will add a new LLJIT
example shortly that will directly test the lazyReexports API and the
non-trivial alias use case.
llvm/include/llvm/ExecutionEngine/Orc/LazyReexports.h
llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp
llvm/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp