[lld] [lld] check cache in loadDylib before real_path (PR #143595)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 11 10:48:25 PDT 2025
================
@@ -225,21 +225,42 @@ std::optional<StringRef> macho::resolveDylibPath(StringRef dylibPath) {
// especially if it's a commonly re-exported core library.
static DenseMap<CachedHashStringRef, DylibFile *> loadedDylibs;
+static StringRef realPathIfDifferent(StringRef path) {
+ SmallString<128> realPathBuf;
+ std::error_code err = fs::real_path(path, realPathBuf);
+ if (err)
+ return StringRef();
+
+ StringRef realPath(realPathBuf);
+ if (realPath.ends_with(path))
+ return StringRef();
----------------
ellishg wrote:
Is this suppose to detect symlinks? I don't think covers all cases. Imagine that in `/a/b/` you have a symlink `dir` to `/c/d/dir`. In the paths `dir` and `/c/d/dir`, the suffixes are the same, but they are different paths.
https://github.com/llvm/llvm-project/pull/143595
More information about the llvm-commits
mailing list