JonChesterfield added a comment. In D101960#2960657 <https://reviews.llvm.org/D101960#2960657>, @jdoerfert wrote:
> Do I understand correctly that adding runpath to libomp.so will help it find > libomptarget.so *and* still allows users to use LD_LIBRARY_PATH to make sure > a different libomptarget.so is found? > > If the above is the case, can't we do the same for clang? > > Asked differently, how does clang find things like compiler-rt? If we set runpath on libomp.so it'll be able to find libomptarget.so without environment variables. If the user sets LD_LIBRARY_PATH, a libomptarget.so on that path will be used instead. Clang can definitely set rpath or runpath on the user binary, that's what addOpenMPRuntimeSpecificRPath does. That way no environment variables are needed. The set of options are then: - User has otherwise set nothing on the binary, either rpath or runpath works great - User has set runpath and we set runpath, linker should put both in. Not sure which will go first. Probably fine - User has set rpath and we set runpath. Linker will ignore the user rpath, so we've probably broken the binary - User has set runpath and we set rpath. Harmless, but we'll be ignored compiler-rt is different because it's statically linked into every binary and every shared library, and is carefully written so that it doesn't matter if the final running system has loads of copies of it as a result. If we statically linked our libraries none of the above would be an issue but developers (and I suppose users) would no longer be able to pick and choose at runtime. There might be a linker flag (which might even exist on all the linkers users might use) to control the behaviour where any runpath means ignore all rpath. What we'd really like is to set r(un)path on the user binary unless something else is already doing so, but I don't think we can have that information. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D101960/new/ https://reviews.llvm.org/D101960 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits