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

Carlo Cabrera via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 07:47:15 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.
----------------
carlocab wrote:

Yes, that it does a prefix match. It honestly seems like a bug, but the behaviour has been around for so long that it probably doesn't make sense to change in LD64 anymore.

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


More information about the llvm-commits mailing list