[PATCH] D103990: [lld/mac] When handling @loader_path, use realpath() of symlinks

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 9 16:28:37 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:794
   } else if (path.consume_front("@loader_path/")) {
-    path::append(newPath, sys::path::parent_path(umbrella->getName()), path);
+    fs::real_path(umbrella->getName(), newPath);
+    path::remove_filename(newPath);
----------------
Would it make sense to call `realPath` before constructing MemoryBuffers in `readFile`, so that `getName()` always returns a canonicalized path? Or would that mess up other things?


================
Comment at: lld/MachO/InputFiles.cpp:798
     path = newPath;
+
   } else if (path.startswith("@rpath/")) {
----------------
intentional newline?


================
Comment at: lld/test/MachO/link-search-at-loader-path-symlink.s:24
+
+## 2. Test symlink with reexport to @loader_path-relative path directly..
+## The @loader_path-relative path is looked after resolving the symlink.
----------------



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103990/new/

https://reviews.llvm.org/D103990



More information about the llvm-commits mailing list