From 7f0f102d19b3ae41d5fee2306933f46d9f0ccd7b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 24 Feb 2020 14:15:17 +0200 Subject: Disable /WHOLEARCHIVE workaround for lld-link 9.0.1 and later --- libbuild2/cc/link-rule.cxx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'libbuild2/cc/link-rule.cxx') diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index 00c3085..056c5c4 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -2845,22 +2845,29 @@ namespace build2 sargs.push_back (relative (manifest).string ()); // LLD misses an input file if we are linking only whole archives (LLVM - // bug #43744). Repeating one of the previously-mentioned archives seems - // to work around the issue. + // bug #43744, fixed in 9.0.1, 10.0.0). Repeating one of the previously- + // mentioned archives seems to work around the issue. // if (!seen_obj && !lt.static_library () && tsys == "win32-msvc" && cast (rs["bin.ld.id"]) == "msvc-lld") { - auto i (find_if (sargs.rbegin (), sargs.rend (), - [] (const string& a) - { - return a.compare (0, 14, "/WHOLEARCHIVE:") == 0; - })); + uint64_t mj; + if ((mj = cast (rs["bin.ld.version.major"])) < 9 || + (mj == 9 && + cast (rs["bin.ld.version.minor"]) == 0 && + cast (rs["bin.ld.version.patch"]) == 0)) + { + auto i (find_if (sargs.rbegin (), sargs.rend (), + [] (const string& a) + { + return a.compare (0, 14, "/WHOLEARCHIVE:") == 0; + })); - if (i != sargs.rend ()) - sargs.push_back (i->c_str () + 14); + if (i != sargs.rend ()) + sargs.push_back (i->c_str () + 14); + } } // Shallow-copy sargs over to args. -- cgit v1.1