aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-03-10 12:11:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-03-10 12:11:45 +0200
commitd932899aa393e36f59ddc0480f2675a340f7960c (patch)
tree718c4e5a11d2f1f029138e6e9187d6143308f590
parent386c0bcda597914671dfeb4e1391f41e71465e91 (diff)
Force hard links inside backlinked DLL assembly directory
Windows does not allow the manifest file inside to be a symlink for some (probably security) reasons.
-rw-r--r--libbuild2/algorithm.cxx8
-rw-r--r--libbuild2/cc/link-rule.cxx3
2 files changed, 7 insertions, 4 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index e59ffa0..4793f0a 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -1248,9 +1248,11 @@ namespace build2
if (d)
{
// Currently, for a directory, we do a "copy-link": we make the
- // target directory and then link each entry (for now this is
+ // target directory and then link each entry. (For now this is
// only used to "link" a Windows DLL assembly with only files
- // inside).
+ // inside. We also have to use hard links; see the relevant
+ // comment in cc/link-rule for details. Maybe we can invent a
+ // special "assembly link" for this).
//
dir_path fr (path_cast<dir_path> (p));
dir_path to (path_cast<dir_path> (l));
@@ -1263,7 +1265,7 @@ namespace build2
path f (fr / de.path ());
path t (to / de.path ());
- update_backlink (ctx, f, t, mode::link, verb_never);
+ update_backlink (ctx, f, t, mode::hard, verb_never);
}
}
else
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx
index 056c5c4..5917419 100644
--- a/libbuild2/cc/link-rule.cxx
+++ b/libbuild2/cc/link-rule.cxx
@@ -1076,7 +1076,8 @@ namespace build2
// The problem is the Windows DLL assembly "logic" refuses to
// recognize a junction as a valid assembly for some reason. So we
// are going to resort to copy-link (i.e., a real directory with a
- // bunch of links).
+ // bunch of links). Note also that while DLLs can be symlinked,
+ // the assembly manifest cannot (has to be hard-linked or copied).
//
// Interestingly, the directory symlink works just fine under
// Wine. So we only resort to copy-link'ing if we are running on