aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-10-18 11:30:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-10-18 11:30:15 +0200
commit6feaa13453d5071f340f405075c3ea880dc23ac1 (patch)
treeceb957c16237e28d0bba5c2f42a2efb272a2b3cc
parent52019768ddc64f25416a692461a472bc2be2c7a7 (diff)
Fix bug in binless library linking logic
-rw-r--r--build2/cc/link-rule.cxx16
-rw-r--r--build2/cc/pkgconfig.cxx11
-rw-r--r--build2/target.hxx16
3 files changed, 16 insertions, 27 deletions
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx
index 93cdecf..1dd8726 100644
--- a/build2/cc/link-rule.cxx
+++ b/build2/cc/link-rule.cxx
@@ -1206,7 +1206,7 @@ namespace build2
if (!lu)
return;
- if (l->path ().empty ()) // Binless.
+ if (l->mtime () == timestamp_unreal) // Binless.
return;
for (const target* pt: l->prerequisite_targets[d.a])
@@ -1238,10 +1238,7 @@ namespace build2
// Linking a library to a shared library or executable.
//
- // Note: on Windows shared library could be the DLL with unknown
- // location (empty path). See search_library() for details.
- //
- if (l->path ().empty () && l->member == nullptr) // Binless.
+ if (l->mtime () == timestamp_unreal) // Binless.
return;
// On Windows a shared library is a DLL with the import library as
@@ -1352,10 +1349,7 @@ namespace build2
if (d.li.type == otype::a && !lu)
return;
- // Note: on Windows shared library could be the DLL with unknown
- // location (empty path). See search_library() for details.
- //
- if (l->path ().empty () && l->member == nullptr) // Binless.
+ if (l->mtime () == timestamp_unreal) // Binless.
return;
// Check if this library renders us out of date.
@@ -1459,7 +1453,7 @@ namespace build2
if (!l->is_a<libs> ())
return;
- if (l->path ().empty ()) // Binless.
+ if (l->mtime () == timestamp_unreal) // Binless.
return;
}
else
@@ -2250,7 +2244,7 @@ namespace build2
args[0] = ld->recall_string ();
- // The same logic as during hashing above.
+ // Append input files. The same logic as during hashing above.
//
// See also a similar loop inside append_libraries().
//
diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx
index a752348..26b0aea 100644
--- a/build2/cc/pkgconfig.cxx
+++ b/build2/cc/pkgconfig.cxx
@@ -1093,14 +1093,9 @@ namespace build2
// the saving logic).
//
pkgconf& ipc (sp.empty () ? apc : spc); // Interface package info.
- bool ibl (sp.empty () // Binless.
- ? at->path ().empty ()
- //
- // On Windows the shared library could be a DLL with an empty
- // path (unknown location) and an ad hoc member that is the
- // import library. See search_library() for details.
- //
- : st->path ().empty () && st->member == nullptr);
+ bool ibl ((sp.empty ()
+ ? at->mtime ()
+ : st->mtime ()) == timestamp_unreal); // Binless.
bool pa (at != nullptr && !ap.empty ());
if (pa || sp.empty ())
diff --git a/build2/target.hxx b/build2/target.hxx
index 1249f5c..d73a98c 100644
--- a/build2/target.hxx
+++ b/build2/target.hxx
@@ -1447,14 +1447,14 @@ namespace build2
// any time but any subsequent updates must set the same path. Or, in
// other words, once the path is set, it never changes.
//
- // A set empty path may signify special unknown/undetermined location (for
- // example an installed import library -- we know it's there, just not
- // exactly where). In this case you would also normally set its mtime. We
- // used to return a pointer to properly distinguish between not set and
- // empty but that proved too tedious. Note that this means there could be
- // a race between path and mtime (unless you lock the target in some other
- // way; see file_rule) so for this case it makes sense to set the
- // timestamp first.
+ // A set empty path may signify special unknown/undetermined/unreal
+ // location (for example, a binless library or an installed import library
+ // -- we know the DLL is there, just not exactly where). In this case you
+ // would also normally set its mtime. We used to return a pointer to
+ // properly distinguish between not set and empty but that proved too
+ // tedious. Note that this means there could be a race between path and
+ // mtime (unless you lock the target in some other way; see file_rule) so
+ // for this case it makes sense to set the timestamp first.
//
const path_type&
path () const;