From c4f64cee36a085021e80491e8014fba8f152f261 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 11 Dec 2024 20:20:03 +0100 Subject: [PATCH] CMakeParseImplicitLinkInfo: Do not mistake ld.so for a linker Our pattern meant to match `/usr/bin/ld`, `ld.exe`, etc., unfortunately also captures `ld.so`, which happens to be the dynamic linker on x86 GNU/Hurd. Through `linker_tool_regex`, this: elseif("${line}" MATCHES "${linker_tool_regex}") set(linker_tool "${CMAKE_MATCH_2}") endif() is then assuming that: /.../collect2 [...] -dynamic-linker /lib/ld.so [...] claims the linker to be `/lib/ld.so`, and stops there, without noticing further down in the log: /usr/bin/ld [...] -dynamic-linker /lib/ld.so [...] which is what should be claiming `/usr/bin/ld` is the linker. --- Modules/CMakeParseImplicitLinkInfo.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index d9ecbd8859..2eeb375cf4 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -61,7 +61,7 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex) endif() endif() # Parse implicit linker arguments. - set(linker "ld[0-9]*(\\.[a-z]+)?") + set(linker "ld[0-9]*(|\\.[a-rt-z][a-z]*|\\.s[a-np-z][a-z]*|\\.so[a-z]+)") if(is_lfortran_less_0_40) # lfortran < 0.40 has no way to pass -v to clang/gcc driver. string(APPEND linker "|clang|gcc")