aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-22 16:44:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-22 16:44:34 +0200
commit3425432752d362341b8e39cd319d7f3c56aef169 (patch)
treeac8176087581f355258b6c56f6475ee0d9e46eb5
parent77869a0567f4c2e029c679525b29da53433d8d9f (diff)
Incorporate target to link rule's depdb
Since there is no guarantee that the target is part of the linker's checksum.
-rw-r--r--build2/cxx/compile.cxx4
-rw-r--r--build2/cxx/guess5
-rw-r--r--build2/cxx/link.cxx9
3 files changed, 16 insertions, 2 deletions
diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx
index 300fad7..5205fdf 100644
--- a/build2/cxx/compile.cxx
+++ b/build2/cxx/compile.cxx
@@ -210,7 +210,9 @@ namespace build2
if (dd.expect ("cxx.compile 1") != nullptr)
l4 ([&]{trace << "rule mismatch forcing update of " << t;});
- // Then the compiler checksum.
+ // Then the compiler checksum. Note that here we assume it
+ // incorporates the (default) target so that if the compiler changes
+ // but only in what it targets, then the checksum will still change.
//
if (dd.expect (cast<string> (rs["cxx.checksum"])) != nullptr)
l4 ([&]{trace << "compiler mismatch forcing update of " << t;});
diff --git a/build2/cxx/guess b/build2/cxx/guess
index 0588523..63858ad 100644
--- a/build2/cxx/guess
+++ b/build2/cxx/guess
@@ -86,6 +86,11 @@ namespace build2
// common cases, such as an upgrade to a new version or a configuration
// change.
//
+ // Note that we assume the checksum incorporates the (default) target so
+ // that if the compiler changes but only in what it targets, then the
+ // checksum will still change. This is currently the case for all the
+ // compilers that we support.
+ //
// The target is the compiler's traget architecture triplet. Note that
// unlike all the preceding fields, this one takes into account the
// compile options (e.g., -m32).
diff --git a/build2/cxx/link.cxx b/build2/cxx/link.cxx
index 3ce99c9..e714bc1 100644
--- a/build2/cxx/link.cxx
+++ b/build2/cxx/link.cxx
@@ -1091,6 +1091,7 @@ namespace build2
scope& rs (t.root_scope ());
const string& cid (cast<string> (rs["cxx.id"]));
+ const string& tgt (cast<string> (rs["cxx.target"]));
const string& tsys (cast<string> (rs["cxx.target.system"]));
const string& tclass (cast<string> (rs["cxx.target.class"]));
@@ -1239,6 +1240,12 @@ namespace build2
l4 ([&]{trace << "linker mismatch forcing update of " << t;});
}
+ // Next check the target. While it might be incorporated into the linker
+ // checksum, it also might not (e.g., MS link.exe).
+ //
+ if (dd.expect (tgt) != nullptr)
+ l4 ([&]{trace << "target mismatch forcing update of " << t;});
+
// Start building the command line. While we don't yet know whether we
// will really need it, we need to hash it to find out. So the options
// are to either replicate the exact process twice, first for hashing
@@ -1292,7 +1299,7 @@ namespace build2
auto l (t["bin.rpath"]);
if (l && !l->empty ())
- fail << cast<string> (rs["cxx.target"]) << " does not have rpath";
+ fail << tgt << " does not support rpath";
}
else
{