diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-02-16 11:38:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-02-16 11:38:24 +0200 |
commit | ad9cb7fec5cc74697322620909e0ff1ba9ecb61b (patch) | |
tree | 8168eb186e15d17e7181d633f0727db7097defa4 | |
parent | 63d1d6f8f4bb6db482b21e728245ebf9eee6b55f (diff) |
Fix group link-up race in cc::link_rule::match()
-rw-r--r-- | build2/cc/link-rule.cxx | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index bdf75c7..04e2e7d 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -46,7 +46,8 @@ namespace build2 { tracer trace (x, "link_rule::match"); - // NOTE: may be called multiple times (see install rules). + // NOTE: may be called multiple times and for both inner and outer + // operations (see install rules). ltype lt (link_type (t)); otype ot (lt.type); @@ -54,10 +55,18 @@ 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 () && t.group == nullptr) - t.group = &search (t, - lt.utility ? libu::static_type : lib::static_type, - t.dir, t.out, t.name); + // If we are called for the outer operation (see install rules), then + // use resolve_group() to delegate to inner. + // + if (lt.library ()) + { + if (a.outer ()) + resolve_group (a, t); + else if (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. |