Introduce a fall back mechanism to load plugins from the same
directory as libomptarget.so if library does not exist or cannnot
be found. It avoids the need to set LD_LIBRARY_PATH to find
plugins.
Details
- Reviewers
ABataev jdoerfert RaviNarayanaswamy ronlieb
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
openmp/libomptarget/src/rtl.cpp | ||
---|---|---|
111–127 | Do we need to repeat this everytime in the for loop |
See comments below. High-level: Why don't we say FullPluginName = Name, then try to load, if that fails, get the CWD and prepend it to FullPluginName before trying again. So LoadLibFromCWD will become bool getOrCreateCWD(std::string &CachedCWD) { if (CachedCWD) return true; ... } and a lot of the logic should be simpler. Also consider moving the actual loading part DP("Loading library '%s'...\n", Name); void *dynlib_handle = dlopen(Name, RTLD_NOW); into a helper so you can just call it twice instead of duplicating logic there again.
openmp/libomptarget/src/rtl.cpp | ||
---|---|---|
65 | Why char** ? I mean, you fiddle with a char** here and below you handle both a char * and a std::string. Just go with the string. | |
123 | Now there are two problems.
|
clang-tidy: warning: invalid case style for function 'LoadLibFromCWD' [readability-identifier-naming]
not useful