summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2018-10-26 17:12:14 -0400
committerBrad King <brad.king@kitware.com>2018-10-29 11:57:29 -0400
commit3c31ec7a0a34b7fbbf2ceae9c6bc27f9b536c1b8 (patch)
treecbf91e382b291acfc9a1d1fd6ad821b3e7d900de /Source
parente1dc842cc1dd761c802d802211160e72d751e146 (diff)
downloadcmake-3c31ec7a0a34b7fbbf2ceae9c6bc27f9b536c1b8.tar.gz
CUDA: Filter out non-static libraries during device linking
Since commit v3.12.0-rc1~278^2 (CUDA: Pass more link libraries to device linking, 2018-03-27) we consider every link library during device linking and use `-Xnvlink` to pass those that do not end in `.a`. However, nvlink breaks on versioned shared library names such as `.so.1`. Work around this problem by not passing library paths that do not end in `.a` or `.lib`. nvlink would not find device symbols in them anyway. Fixes: #18504
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 025c6e4ea2..a93ec1271d 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -77,15 +77,15 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries(
std::string out;
if (item.IsPath) {
- // nvcc understands absolute paths to libraries ending in '.a' should
- // be passed to nvlink. Other extensions like '.so' or '.dylib' are
- // rejected by the nvcc front-end even though nvlink knows to ignore
- // them. Bypass the front-end via '-Xnvlink'.
- if (!cmHasLiteralSuffix(item.Value, ".a")) {
- out += "-Xnvlink ";
+ // nvcc understands absolute paths to libraries ending in '.a' or '.lib'.
+ // These should be passed to nvlink. Other extensions need to be left
+ // out because nvlink may not understand or need them. Even though it
+ // can tolerate '.so' or '.dylib' it cannot tolerate '.so.1'.
+ if (cmHasLiteralSuffix(item.Value, ".a") ||
+ cmHasLiteralSuffix(item.Value, ".lib")) {
+ out += this->ConvertToOutputFormat(
+ this->ConvertToLinkReference(item.Value));
}
- out +=
- this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value));
} else if (cmLinkItemValidForDevice(item.Value)) {
out += item.Value;
}