Only use -debug:fastlink with linkers that support it
fastlink speeds up debug-build links, and MSVC link.exe supports it, but lld-link does not: it prints "/debug:fastlink unsupported; using /debug:full" on every link and falls back anyway, cluttering the build output with a warning per linked target. Add a configure probe (HAVE_LINK_DEBUG_FASTLINK) that checks whether the selected linker actually supports the flag, and only pass -debug:fastlink when it does. The probe tests the linker rather than hardcoding "lld has no fastlink", so a future lld-link that gains support starts using it automatically, with no further build-system change. Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com> Change-Id: I9f2638449909d75e6e627ca1d53ac56ff8035cca Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7156 Reviewed-by: Noel Grandin <noel.grandin@collabora.com> Tested-by: Jenkins CPCI <releng@collaboraoffice.com> (cherry picked from commit b14cffdc89f9f38e05f346a9051d3420ee3b45cf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208660 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
This commit is contained in:
committed by
Xisco Fauli
parent
92665ccbe3
commit
9cff0b60ce
@@ -336,6 +336,7 @@ export HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=@HAVE_CLANG_DEBUG_INFO_KIND_CONSTR
|
||||
export HAVE_CXX20_ATOMIC_REF=@HAVE_CXX20_ATOMIC_REF@
|
||||
export HAVE_DLLEXPORTINLINES=@HAVE_DLLEXPORTINLINES@
|
||||
export HAVE_EXTERNAL_DWARF=@HAVE_EXTERNAL_DWARF@
|
||||
export HAVE_LINK_DEBUG_FASTLINK=@HAVE_LINK_DEBUG_FASTLINK@
|
||||
export HAVE_LO_CLANG_DLLEXPORTINLINES=@HAVE_LO_CLANG_DLLEXPORTINLINES@
|
||||
export HAVE_GCC_AVX=@HAVE_GCC_AVX@
|
||||
export HAVE_GCC_BUILTIN_ATOMIC=@HAVE_GCC_BUILTIN_ATOMIC@
|
||||
|
||||
@@ -5215,6 +5215,33 @@ fi
|
||||
AC_SUBST(USE_LD)
|
||||
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 ===================================================================
|
||||
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
|
||||
HAVE_LINK_DEBUG_FASTLINK=
|
||||
else
|
||||
HAVE_LINK_DEBUG_FASTLINK=TRUE
|
||||
fi
|
||||
if test -n "$HAVE_LINK_DEBUG_FASTLINK"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(HAVE_LINK_DEBUG_FASTLINK)
|
||||
|
||||
HAVE_LD_BSYMBOLIC_FUNCTIONS=
|
||||
if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
|
||||
AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
|
||||
|
||||
@@ -335,7 +335,7 @@ gb_Windows_PE_TARGETTYPEFLAGS := \
|
||||
ifeq ($(ENABLE_DBGUTIL),TRUE)
|
||||
# fastlink is faster but pdb files reference .obj files
|
||||
# but don't do that for setup_native DLLs: this produces make error 139 in some configurations
|
||||
gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO = $(if $(filter -U_DLL,$(1)),-debug,-debug:fastlink)
|
||||
gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO = $(if $(filter -U_DLL,$(1)),-debug,-debug$(if $(HAVE_LINK_DEBUG_FASTLINK),:fastlink))
|
||||
else
|
||||
gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO = -debug
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user