Skip -debug:fastlink with the VS 2026 toolset, which removed it

/DEBUG:FASTLINK was available from VS 2017 through VS 2022 and is gone in the
VS 2026 toolset:
https://learn.microsoft.com/en-us/cpp/build/reference/debug-generate-debug-info?view=msvc-180
Its link.exe (14.51) answers the flag with "LNK4315: /DEBUG:FASTLINK is no
longer supported. Using /DEBUG:FULL instead." and links on, so a dbgutil build
would get that warning once per linked target - exactly what
b14cffdc89f9f38e05f346a9051d3420ee3b45cf ("Only use -debug:fastlink with
linkers that support it", 2026-07-17 11:51:25 +0500) set out to avoid for
lld-link.

That probe short-circuited to "supported" whenever the MSVC linker was
selected, so it never got to see this. Run it against the linker that will
actually be used in all cases (link.exe next to cl.exe, when lld-link is not
selected).

While at it, treat any mention of the flag in the probe output as "unusable",
instead of matching the -debug:full fallback wording alone. A linker that
takes the flag says nothing about it, so any complaint, however phrased, is
reason enough not to pass it.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I125a3000ab82aa4b9371069cf4f5fd814a11f599
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7818
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 3af47b423bbd0bb1882547e394b0b4c37e92de44)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208662
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Mike Kaganski
2026-07-27 21:33:37 +02:00
committed by Xisco Fauli
parent e3a8b92b40
commit 554e287252
+13 -9
View File
@@ -5217,19 +5217,23 @@ AC_SUBST(LD)
dnl ===================================================================
dnl Check whether the linker supports -debug:fastlink, which links debug
dnl builds faster. MSVC link.exe does; lld-link currently does not and would
dnl warn on every link, falling back to -debug:full. Probe the selected linker
dnl rather than hardcoding "lld has no fastlink", so a future lld-link that
dnl gains support starts using it automatically.
dnl builds faster. link.exe offered it from VS 2017 to VS 2022 and dropped it
dnl in the VS 2026 toolset; lld-link never had it. Both then warn on every
dnl link and fall back to -debug:full, so probe the linker that will be used,
dnl and only pass the flag when it takes it silently.
dnl ===================================================================
HAVE_LINK_DEBUG_FASTLINK=
if test "$_os" = "WINNT"; then
AC_MSG_CHECKING([whether the linker supports -debug:fastlink])
if test -z "$LLD_LINK"; then
dnl MSVC link.exe supports it natively
HAVE_LINK_DEBUG_FASTLINK=TRUE
elif "$LLD_LINK" -debug:fastlink conftest-nonexistent.obj 2>&1 | grep -iq "debug:fastlink.*debug:full"; then
dnl the fallback warning means fastlink is not supported
if test -n "$LLD_LINK"; then
fastlink_linker=$LLD_LINK
else
dnl PATH doesn't cover the MSVC tools yet; link.exe sits next to cl.exe
fastlink_linker=`win_short_path_for_make "$MSVC_HOST_PATH/link.exe"`
fi
dnl the link fails on the missing input file, and any mention of the flag in
dnl the output is a complaint about the flag itself: not being able to use it
if "$fastlink_linker" -debug:fastlink conftest-nonexistent.obj 2>&1 | grep -iq "debug:fastlink"; then
HAVE_LINK_DEBUG_FASTLINK=
else
HAVE_LINK_DEBUG_FASTLINK=TRUE