From 63d1d6f8f4bb6db482b21e728245ebf9eee6b55f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 16 Feb 2018 11:30:41 +0200 Subject: Fix group link-up race --- build2/cc/link-rule.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'build2/cc/link-rule.cxx') diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index c59597a..bdf75c7 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -54,15 +54,10 @@ namespace build2 // If this is a library, link-up to our group (this is the target group // protocol which means this can be done whether we match or not). // - if (lt.library ()) - { - //@@ inner/outer race (see install-rule)? - - if (t.group == nullptr) - t.group = &search (t, - lt.utility ? libu::static_type : lib::static_type, - t.dir, t.out, t.name); - } + if (lt.library () && t.group == nullptr) + t.group = &search (t, + lt.utility ? libu::static_type : lib::static_type, + t.dir, t.out, t.name); // Scan prerequisites and see if we can work with what we've got. Note // that X could be C. We handle this by always checking for X first. @@ -777,6 +772,8 @@ namespace build2 ? (group ? bmi::static_type : tt.bmi) : (group ? obj::static_type : tt.obj)); + resolve_group (a, *pt); // Not matched yet so resolve group. + bool src (false); for (prerequisite_member p1: group_prerequisite_members (a, *pt)) { @@ -904,6 +901,8 @@ namespace build2 // bool mod (x_mod != nullptr && p.is_a (*x_mod)); + // Note: group already resolved in the previous loop. + for (prerequisite_member p1: group_prerequisite_members (a, *pt)) { if (p1.is_a (mod ? *x_mod : x_src) || p1.is_a ()) -- cgit v1.1