[lld] [llvm] [LLD][COFF] Make unresolved symbol search behavior compliant with MSVC link.exe (PR #85290)
Alexandre Ganea via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 11:20:18 PDT 2024
================
@@ -2111,25 +2125,38 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
{
llvm::TimeTraceScope timeScope2("Parse & queue inputs");
bool inLib = false;
+ std::optional<std::shared_future<ArchiveFile *>> inLibArchive;
for (auto *arg : args) {
switch (arg->getOption().getID()) {
case OPT_end_lib:
if (!inLib)
error("stray " + arg->getSpelling());
inLib = false;
+ inLibArchive = std::nullopt;
break;
case OPT_start_lib:
if (inLib)
error("nested " + arg->getSpelling());
inLib = true;
+ // In is important to create a fake archive here so that we remember its
+ // placement on the command-line. This will be later needed to resolve
+ // symbols in the archive order required by the MSVC specification.
+ {
+ auto a = std::make_shared<std::promise<ArchiveFile *>>();
----------------
aganea wrote:
Review note: this is made `shared_ptr<promise>` simply because lambdas cannot capture non-CopyConstructible classes, because of https://timsong-cpp.github.io/cppwp/n4659/func.wrap.func.con#7
https://github.com/llvm/llvm-project/pull/85290
More information about the llvm-commits
mailing list