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

Daniel Rodríguez Troitiño via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 10:48:53 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);
----------------
drodriguez wrote:

Should the error code return from `real_path` be at least checked and fallback to use the buffer identifier? The output variable `realPath` can be empty on return in that case.

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


More information about the llvm-commits mailing list