Skip to content

Commit

Permalink
[onert] Use dlmopen for codegen lib (Samsung#13198)
Browse files Browse the repository at this point in the history
This commit changes dlopen() to dlmopen() for codegen library.
It's hard to control dependent library version with runtime's core.
It can help to find internally linked static library version first in dynamic library.
This feature is not supported on android.

ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <[email protected]>
  • Loading branch information
hseok-oh authored Jun 17, 2024
1 parent 86afda5 commit f4e1654
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions runtime/onert/core/src/odc/CodegenLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ void CodegenLoader::loadLibrary(const char *target)
return;

const std::string codegen_so = "lib" + std::string{target} + SHARED_LIB_EXT;
#ifdef __ANDROID__
void *handle = dlopen(codegen_so.c_str(), RTLD_LAZY | RTLD_LOCAL);
#else
void *handle = dlmopen(LM_ID_NEWLM, codegen_so.c_str(), RTLD_LAZY | RTLD_LOCAL);
#endif
if (handle == nullptr)
{
throw std::runtime_error("CodegenLoader: " + std::string{dlerror()});
Expand Down

0 comments on commit f4e1654

Please sign in to comment.