[lld] [lld] check cache before real_path in loadDylib (PR #140791)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Tue May 20 13:54:00 PDT 2025


================
@@ -253,6 +265,7 @@ DylibFile *macho::loadDylib(MemoryBufferRef mbref, DylibFile *umbrella,
     }
     file =
         make<DylibFile>(**result, umbrella, isBundleLoader, explicitlyLinked);
+    realfile = file;
----------------
ellishg wrote:

In the common case we have
```
DylibFile *&file = loadedDylibs[path];
DylibFile *&realfile = file;
```

Then what happens on this line? It does a load and a store to the same address? I'm sure it does the right thing it just looks funny to me.

Also, if we set `file` later in the future, how can we make sure to not forget to also set `realfile`? Is there a better way of doing this?

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


More information about the llvm-commits mailing list