aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-09-05 09:24:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-09-05 09:24:02 +0200
commitab1458851bc08438fb7cf8f3f015ef6c2707edc3 (patch)
treed98355ffb58c5c96a0911cb3cd7a4bddd32dc23e
parent32bcbd21f9f640c48d88c82d5aca1dda71b978e5 (diff)
Don't suppress duplicate libraries if linking whole archive (GH issue #411)
-rw-r--r--libbuild2/cc/link-rule.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx
index db82507..eb44142 100644
--- a/libbuild2/cc/link-rule.cxx
+++ b/libbuild2/cc/link-rule.cxx
@@ -2509,12 +2509,19 @@ namespace build2
// appear after the preceding static library of which this binless
// library is a dependency.
//
+ // Note that we omit the duplicate suppression if we are linking the
+ // whole archive since the previous instance may not necessarily do
+ // the same (see GH issue #411; we could have complicated things and
+ // stored the flag in appended_libraries but it doesn't feel
+ // worthwhile in this case).
+ //
// From the process_libraries() semantics we know that this callback
// is always called and always after the options callbacks.
//
- appended_library* al (l != nullptr
- ? &d.ls.append (*l, d.args.size ())
- : d.ls.append (ns, d.args.size ()));
+ appended_library* al (
+ f & lflag_whole ? nullptr :
+ l != nullptr ? &d.ls.append (*l, d.args.size ()) :
+ d.ls.append (ns, d.args.size ()));
if (al != nullptr && al->end != appended_library::npos) // Closed.
{