Currently libomptarget.so finds plugins through LD_LIBRARY_PATH. This
patch changes the logic to look in the same directory as libomptarget.so.
This makes no change to current behaviour if libomptarget.so is found by
LD_LIBRARY_PATH (as the plugin would be found next to it the same way)
but enables finding libomptarget.so by --runpath instead.
It's not totally NFC in that someone might have moved one of the libraries
from the default location in the install or test tree, but in that case they're
debugging or doing their own packaging thing already so this shouldn't be
a hindrance.
Main benefit is that an executable which is linked with runpath to find
libomptarget.so, without relying on environment variables, will now be
able to find the plugins. A quirk of how dlopen works from shared libraries
prevents that working today.
Side benefit is increased certainty over which plugin is found from a given
libomptarget. We could make the dladdr lookup a hard failure if we prefer
total certainty.
Would rather use llvm filesystem here but that patch hasn't landed yet. Should we use std::filesystem?
I don't think dlopen works on windows anyway so one more unix convention in this file seems acceptable.