LinkerId: Fix detection of linker tool for XL as nvcc host compiler

When IBM XL is used as the host compiler for nvcc, it generates a
comma-separated link line.  Parse the `exec:` line syntax separately, as
was done in commit b5f20da94d (CMakeParseImplicitLinkInfo supports comma
separated link lines, 2019-08-23, v3.16.0-rc1~181^2).
This commit is contained in:
Brad King
2023-12-13 10:36:25 -05:00
parent a80dca88a1
commit 262de2ad92
2 changed files with 5 additions and 3 deletions

View File

@@ -74,7 +74,7 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
# whole line and just the command (argv[0]).
set(linker_regex "^( *|.*[/\\])(${linker}|${startfile}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)")
set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=|/ldfe ")
set(linker_tool_regex "^[ \t]*(->|exec:|\")?[ \t]*(.*[/\\](${linker}))(\"|,| |$)")
set(linker_tool_regex "^[ \t]*(->|\")?[ \t]*(.*[/\\](${linker}))(\"|,| |$)")
set(linker_tool_exclude_regex "cuda-fake-ld|-fuse-ld=|--with-ld=")
set(linker_tool "NOTFOUND")
set(link_line_parsed 0)
@@ -86,7 +86,9 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
foreach(line IN LISTS output_lines)
if(EXTRA_PARSE_COMPUTE_LINKER AND
NOT linker_tool AND NOT "${line}" MATCHES "${linker_tool_exclude_regex}")
if("${line}" MATCHES "${linker_tool_regex}")
if("${line}" MATCHES "exec: ([^()]*/(${linker}))") # IBM XL as nvcc host compiler
set(linker_tool "${CMAKE_MATCH_1}")
elseif("${line}" MATCHES "${linker_tool_regex}")
set(linker_tool "${CMAKE_MATCH_2}")
endif()
endif()

View File

@@ -1,4 +1,4 @@
libs=cudadevrt;cudart_static;rt;pthread;dl;xlopt;xl;ibmc\+\+;stdc\+\+;m;dl;gcc_s;gcc;pthread;m;c;gcc_s;gcc
dirs=/sw/summit/cuda/10.1.168/targets/ppc64le-linux/lib/stubs;/sw/summit/cuda/10.1.168/targets/ppc64le-linux/lib;/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/xl-16.1.1-3/spectrum-mpi-10.3.0.1-20190611-aqjt3jo53mogrrhcrd2iufr435azcaha/lib;/autofs/nccs-svm1_sw/summit/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/gcc-4.8.5/darshan-runtime-3.1.7-csygoqyym3m3ysoaperhxlhoiluvpa2u/lib;/autofs/nccs-svm1_sw/summit/xl/16.1.1-3/xlsmp/5.1.1/lib;/autofs/nccs-svm1_sw/summit/xl/16.1.1-3/xlmass/9.1.1/lib;/autofs/nccs-svm1_sw/summit/xl/16.1.1-3/xlC/16.1.1/lib;/usr/lib/gcc/ppc64le-redhat-linux/4.8.5;/usr/lib64;/lib64;/autofs/nccs-svm1_sw/peak/.swci/1-compute/opt/spack/20180914/linux-rhel7-ppc64le/gcc-4.8.5/darshan-runtime-3.1.7-ytwv7xbkub6mqnpvygdthwqa7mhjqbc5/lib;/usr/lib
library_arch=
linker_tool=/sw/summit/xalt/1.1.3/bin/ld.*
linker_tool=/sw/summit/xalt/1.1.3/bin/ld