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

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 08:39:14 PST 2024


================
@@ -407,8 +407,28 @@ static InputFile *addFile(StringRef path, LoadType loadType,
   case file_magic::macho_dynamically_linked_shared_lib_stub:
   case file_magic::tapi_file:
     if (DylibFile *dylibFile =
-            loadDylib(mbref, nullptr, /*isBundleLoader=*/false, isExplicit))
+            loadDylib(mbref, nullptr, /*isBundleLoader=*/false, isExplicit)) {
+      if (isExplicit && !dylibFile->allowableClients.empty()) {
+        bool allowed = std::any_of(
+            dylibFile->allowableClients.begin(),
+            dylibFile->allowableClients.end(), [&](StringRef allowableClient) {
+              // Not what you expect, but exactly as LD64 does.
----------------
nico wrote:

I don't object to the behavior, I just found the comment confusing as-is. Something like `// Doing a prefix match instead of an exact match matches ld64's behavior` would imho be clearer.

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


More information about the llvm-commits mailing list