[llvm] [Offload] Try loading dynamic libraries at global scope first (PR #227020)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 08:56:59 PDT 2026


================
@@ -138,7 +138,33 @@ static void *findZeFallback(std::string_view Name) {
   return nullptr;
 }
 
+// Returns true if every symbol was found, missing symbols are left null.
+static bool resolveSymbols(llvm::sys::DynamicLibrary &Lib) {
+  bool FoundAll = true;
+  for (size_t I = 0; I < dlwrap::size(); I++) {
+    const char *Sym = dlwrap::symbol(I);
+
+    void *P = Lib.getAddressOfSymbol(Sym);
+    if (P)
+      ODBG(OLDT_Init) << "Implementing " << Sym << " with dlsym(" << Sym
+                      << ") -> " << P;
+    FoundAll &= P != nullptr;
----------------
jhuber6 wrote:

I couldn't reason about it so I just dropped it, the main motivating factor for this is a poor interaction on AMDGPU w/ HIP or compiler-rt interceptors, which are AMD specific. So, we can fix it separately when someone more knowledgeable about L0's special use-case takes a look.

https://github.com/llvm/llvm-project/pull/227020


More information about the llvm-commits mailing list