HomeFreeBSD

libtool.mk: pass through LDFLAGS -fuse-ld=*

Description

libtool.mk: pass through LDFLAGS -fuse-ld=*

Some ports depend on permissive or broken behaviour from the GNU BFD
linker, ld.bfd. Clang and GCC support a -fuse-ld= flag to choose a
specific linker, and as we migrate to installing lld as the base system
/usr/bin/ld we'll want to make use of -fuse-ld=bfd to use bfd for ports
that fail to link, or fail to run when linked with lld.

An upstream libtool change[1] from Feb 2016 supports passing through
-fuse-ld=, but it has not yet made it into a release. Patch an
equivalent change into ltmain.sh via Mk/Uses/libtool.mk.

Original proposal just patched ltmain.sh in devel/libtool. That would
address ports that run libtoolize via autoreconf, including lang/mono
which is one of the ports that fails to link with lld and responsible
for many downstream skipped ports. Patching ltmain.sh via libtool.mk
(tijl's suggestion) handles that case as well as ports that include
their own copy of ltmain.sh.

A later change may patch devel/libtool so that -fuse-ld works if using a
ports-installed libtool to build software outside of the ports tree; the
change in this commit is intended to address building in the ports tree.

[1] http://git.savannah.gnu.org/cgit/libtool.git/commit/?id=f9970d99293faf908fdc153a653fa5781095fb7a

PR: 214864, 224514
Reviewed by: tijl
Approved by: portmgr (antoine)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13589

Details