[lld] [lld] resolve dylib paths before caching (PR #137649)

Richard Howell via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 11:13:58 PDT 2025


================
@@ -229,7 +229,11 @@ static DenseMap<CachedHashStringRef, DylibFile *> loadedDylibs;
 
 DylibFile *macho::loadDylib(MemoryBufferRef mbref, DylibFile *umbrella,
                             bool isBundleLoader, bool explicitlyLinked) {
-  CachedHashStringRef path(mbref.getBufferIdentifier());
+  // Frameworks can be found from different symlink paths, so resolve
+  // symlinks before looking up in the dylib cache.
+  SmallString<128> realPath;
+  fs::real_path(mbref.getBufferIdentifier(), realPath);
----------------
rmaz wrote:

That sounds sensible, yes. Seems like we're going to fail either way if realpath fails, but better to keep the original error handling path.

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


More information about the llvm-commits mailing list