aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-02-24 14:15:17 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-02-24 14:15:17 +0200
commit7f0f102d19b3ae41d5fee2306933f46d9f0ccd7b (patch)
treed6152237a2de32e212848644e15b5eab8e6243c8 /libbuild2/cc
parentb19fe69cdd0d32dc45f166447170bc5c9c54ac5a (diff)
Disable /WHOLEARCHIVE workaround for lld-link 9.0.1 and later
Diffstat (limited to 'libbuild2/cc')
-rw-r--r--libbuild2/cc/link-rule.cxx25
1 files changed, 16 insertions, 9 deletions
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<string> (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<uint64_t> (rs["bin.ld.version.major"])) < 9 ||
+ (mj == 9 &&
+ cast<uint64_t> (rs["bin.ld.version.minor"]) == 0 &&
+ cast<uint64_t> (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.