Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/runtime/hexagon/rpc/simulator/rpc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include <HAP_farf.h>
#include <dlfcn.h>

#include <algorithm>
#include <cassert>
Expand Down Expand Up @@ -288,7 +289,16 @@ int DISPATCH_FUNCTION_NAME(void* serverp) {
return 0;
}

int main() {
int main(int argc, char* argv[]) {
// Load C++RT and ourselves as "global" to make all the symbols defined
// there be visible to any subsequent libraries loaded via dlopen.
void* cxx_abi = dlopen("libc++abi.so", RTLD_GLOBAL);
ICHECK(cxx_abi != nullptr);
void* cxx = dlopen("libc++.so", RTLD_GLOBAL);
ICHECK(cxx != nullptr);
void* self = dlopen(argv[0], RTLD_GLOBAL);
ICHECK(self != nullptr);

const auto* api = tvm::runtime::Registry::Get("device_api.hexagon");
ICHECK(api != nullptr);
tvm::runtime::Registry::Register("device_api.cpu", true).set_body(*api);
Expand All @@ -308,6 +318,9 @@ int main() {
// nothing
}

dlclose(self);
dlclose(cxx);
dlclose(cxx_abi);
return 0;
}

Expand Down