configure.ac |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit a3adb6f82eb582f5bc52037018ad3b7b53bb4bd1
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Sun Jan 2 04:41:31 2022 +0100
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Sun Jan 2 07:08:44 2022 +0100

    Error-out on --enable-ld with path and gcc
    
    Now that mold can successfully link LO and its unit tests (needs
    mold 1.0.1 or later), gcc could support an alternative linker
    with '-B<path>' to search for its tools in some extra path.
    
    But it turns out that libtool filters the '-B' option from its
    arguments, so it falls back to some system ld. But since we
    already tested "our" ld for some features, this might not match,
    resulting in libtool failing to link externals, like orcus.
    
    The original use case was testing mold, which can also be done
    by using LD_PRELOAD=/usr/lib/mold/mold-wrapper.so, so this patch
    just shows an error, if gcc is used with an use_ld_path.
    
    Change-Id: I9c7860895f8b24a5f3fc4b1e0fd5232be22293f8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127493
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de>

diff --git a/configure.ac b/configure.ac
index fb8d85a01f71..2467b55957a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4500,7 +4500,15 @@ check_use_ld()
     use_ld=-fuse-ld=${1%%:*}
     use_ld_path=${1#*:}
     if test "$use_ld_path" != "$1"; then
-        use_ld="$use_ld --ld-path=$use_ld_path"
+        if test "$COM_IS_CLANG" = TRUE; then
+            use_ld="${use_ld} --ld-path=${use_ld_path}"
+        else
+            # I tried to use gcc's '-B<path>' and a directory + symlink setup 
in
+           # $BUILDDIR, but libtool always filtered-out that option, so gcc 
wouldn't
+           # pickup the alternative linker, when called by libtool for linking.
+            # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so 
instead.
+           AC_MSG_ERROR([A linker path is just supported with clang, because 
of libtool's -B filtering!])
+        fi
     fi
     use_ld_fail_if_error=$2
     use_ld_ok=

Reply via email to