From 262de2ad926429749077a9651fc6c6176cd2f19c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 13 Dec 2023 10:36:25 -0500 Subject: 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). --- Modules/CMakeParseImplicitLinkInfo.cmake | 6 ++++-- .../results/linux-CUDA-NVIDIA-10.1.168-XLClang-v.output | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 5fc7806..db39249 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -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() diff --git a/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CUDA-NVIDIA-10.1.168-XLClang-v.output b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CUDA-NVIDIA-10.1.168-XLClang-v.output index da8bfae..6cd069a 100644 --- a/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CUDA-NVIDIA-10.1.168-XLClang-v.output +++ b/Tests/RunCMake/ParseImplicitLinkInfo/results/linux-CUDA-NVIDIA-10.1.168-XLClang-v.output @@ -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 -- cgit v0.12