[lld] [lld][MachO] Respect dylibs linked with `-allowable_client` (PR #114638)

Carlo Cabrera via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 2 08:02:22 PDT 2024


================
@@ -1863,6 +1890,17 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
     config->installName = config->finalOutput;
   }
 
+  auto getClientName = [&]() {
+    StringRef cn = path::filename(config->finalOutput);
+    cn.consume_front("lib");
+    auto firstDot = cn.find_first_of('.');
+    cn = cn.take_front(firstDot);
+    auto firstUnderscore = cn.find_first_of('_');
+    cn = cn.take_front(firstUnderscore);
+    return cn;
----------------
carlocab wrote:

This is a little inefficient, but I erred on mirroring [how `ld64` does it](https://github.com/apple-oss-distributions/ld64/blob/47f477cb721755419018f7530038b272e9d0cdea/src/ld/InputFiles.cpp#L904-L919) as closely as possible. Happy to change this up to something more efficient if desired.

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


More information about the llvm-commits mailing list