[lld] [lld][MachO] Respect dylibs linked with `-allowable_client` (PR #114638)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 1 21:23:08 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 3de5dbb1110887d5127e815f3ca247a9d839ee85 ed340617ec5f93b5aa79f1f159ab1c7f3860a1fa --extensions h,cpp -- lld/MachO/Config.h lld/MachO/Driver.cpp lld/MachO/InputFiles.cpp lld/MachO/InputFiles.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 934604cbd1..0639c7ac1a 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -422,15 +422,17 @@ static InputFile *addFile(StringRef path, LoadType loadType,
}
}
- // TODO: This behaviour doesn't quite match the latest available source release
- // of LD64 (ld64-951.9), which allows "parents" and "siblings" to link to
- // libraries even when they're not explicitly named as allowable clients.
- // However, behaviour around this seems to have changed in the latest
- // release of Xcode (ld64-1115.7.3), so it's not clear what the correct
- // thing to do is yet.
+ // TODO: This behaviour doesn't quite match the latest available source
+ // release
+ // of LD64 (ld64-951.9), which allows "parents" and "siblings" to
+ // link to libraries even when they're not explicitly named as
+ // allowable clients. However, behaviour around this seems to have
+ // changed in the latest release of Xcode (ld64-1115.7.3), so it's
+ // not clear what the correct thing to do is yet.
if (!allowed)
- error("cannot link directly with '" + sys::path::filename(dylibFile->installName) +
- "' because " + config->clientName + " is not an allowed client");
+ error("cannot link directly with '" +
+ sys::path::filename(dylibFile->installName) + "' because " +
+ config->clientName + " is not an allowed client");
}
newFile = dylibFile;
}
@@ -1897,8 +1899,7 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
cn = cn.take_front(firstUnderscore);
return cn;
};
- config->clientName =
- args.getLastArgValue(OPT_client_name, getClientName());
+ config->clientName = args.getLastArgValue(OPT_client_name, getClientName());
if (args.hasArg(OPT_mark_dead_strippable_dylib)) {
if (config->outputType != MH_DYLIB)
diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index a71030618c..6896138f88 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -1731,8 +1731,9 @@ DylibFile::DylibFile(MemoryBufferRef mb, DylibFile *umbrella,
: this->umbrella;
if (!canBeImplicitlyLinked) {
- for (auto *cmd: findCommands<sub_client_command>(hdr, LC_SUB_CLIENT)) {
- StringRef allowedClient{reinterpret_cast<const char *>(cmd) + cmd->client};
+ for (auto *cmd : findCommands<sub_client_command>(hdr, LC_SUB_CLIENT)) {
+ StringRef allowedClient{reinterpret_cast<const char *>(cmd) +
+ cmd->client};
allowedClients.push_back(allowedClient);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/114638
More information about the llvm-commits
mailing list