-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[lld] resolve dylib paths before caching #137649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lld-macho @llvm/pr-subscribers-lld Author: Richard Howell (rmaz) ChangesWhen loading frameworks it is possible to have load commands for the same framework through symlinks and the real path. To avoid loading these multiple times find the real path before checking the dylib cache. Full diff: https://github.com/llvm/llvm-project/pull/137649.diff 1 Files Affected:
diff --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp
index 69d023c23b3c7..7f3ffa83c0cf0 100644
--- a/lld/MachO/DriverUtils.cpp
+++ b/lld/MachO/DriverUtils.cpp
@@ -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);
+ CachedHashStringRef path(uniqueSaver().save(StringRef(realPath)));
DylibFile *&file = loadedDylibs[path];
if (file) {
if (explicitlyLinked)
|
When loading frameworks it is possible to have load commands for the same framework through symlinks and the real path. To avoid loading these multiple times find the real path before checking the dylib cache.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/16885 Here is the relevant piece of the build log for the reference
|
When loading frameworks it is possible to have load commands for the same framework through symlinks and the real path. To avoid loading these multiple times find the real path before checking the dylib cache.