[vlc-commits] extras/tools: Add another libtool patch for building with lld on windows
Martin Storsjö
git at videolan.org
Thu Jun 18 13:09:27 CEST 2020
vlc/vlc-3.0 | branch: master | Martin Storsjö <martin at martin.st> | Fri Oct 12 23:15:10 2018 +0300| [235a161f1bc907e8505ff2db1e2ba3279aefefaa] | committer: Steve Lhomme
extras/tools: Add another libtool patch for building with lld on windows
On Windows, the maximum command line length is rather low; linking
libqt_plugin.la will reach this limit (but this seems to currently be
the only module linked which reaches the limit). In these cases, instead
of passing the list of object files to link on the command line, the list
is passed via a file. GCC/GNU ld supports both a response file and linker
scripts, while clang/lld only supports response files. This patch
reverses the priority between the two, by preferring response files.
This patch is included in the libtool package in msys2, which can be
considered some sort of active upstream.
(cherry picked from commit 1c738deebab7ef262341d3e37e8eaff093981390)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=235a161f1bc907e8505ff2db1e2ba3279aefefaa
---
extras/tools/libtool-2.4.2-response-files.patch | 83 +++++++++++++++++++++++++
extras/tools/tools.mak | 1 +
2 files changed, 84 insertions(+)
diff --git a/extras/tools/libtool-2.4.2-response-files.patch b/extras/tools/libtool-2.4.2-response-files.patch
new file mode 100644
index 0000000000..d85aceaecd
--- /dev/null
+++ b/extras/tools/libtool-2.4.2-response-files.patch
@@ -0,0 +1,83 @@
+From 5fe8ae738927cd2c7e6d786b359e39876c84630c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
+Date: Wed, 10 Oct 2018 10:47:21 +0300
+Subject: [PATCH] Prefer response files over linker scripts for mingw tools
+
+The GCC/binutils tools support response files just fine, while
+lld (impersonating GNU ld) only supports response files, not
+linker scripts. Using a linker script as input just to pass a
+list of files is overkill for cases when a response file is enough.
+---
+ libltdl/config/ltmain.m4sh | 28 ++++++++++++++--------------
+ libltdl/m4/libtool.m4 | 2 ++
+ 2 files changed, 16 insertions(+), 14 deletions(-)
+
+diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
+index 2641327..f6b4217 100644
+--- a/libltdl/config/ltmain.m4sh
++++ b/libltdl/config/ltmain.m4sh
+@@ -7545,20 +7545,7 @@ EOF
+ last_robj=
+ k=1
+
+- if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+- output=${output_objdir}/${output_la}.lnkscript
+- func_verbose "creating GNU ld script: $output"
+- echo 'INPUT (' > $output
+- for obj in $save_libobjs
+- do
+- func_to_tool_file "$obj"
+- $ECHO "$func_to_tool_file_result" >> $output
+- done
+- echo ')' >> $output
+- func_append delfiles " $output"
+- func_to_tool_file "$output"
+- output=$func_to_tool_file_result
+- elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
++ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+ output=${output_objdir}/${output_la}.lnk
+ func_verbose "creating linker input file list: $output"
+ : > $output
+@@ -7577,6 +7564,19 @@ EOF
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
++ elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
++ output=${output_objdir}/${output_la}.lnkscript
++ func_verbose "creating GNU ld script: $output"
++ echo 'INPUT (' > $output
++ for obj in $save_libobjs
++ do
++ func_to_tool_file "$obj"
++ $ECHO "$func_to_tool_file_result" >> $output
++ done
++ echo ')' >> $output
++ func_append delfiles " $output"
++ func_to_tool_file "$output"
++ output=$func_to_tool_file_result
+ else
+ if test -n "$save_libobjs"; then
+ func_verbose "creating reloadable object files..."
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 6f93d32..2c5c2f0 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -4750,6 +4750,7 @@ _LT_EOF
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
++ _LT_TAGVAR(file_list_spec, $1)='@'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+@@ -6166,6 +6167,7 @@ if test "$_lt_caught_CXX_error" != yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
++ _LT_TAGVAR(file_list_spec, $1)='@'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+--
+2.7.4
+
diff --git a/extras/tools/tools.mak b/extras/tools/tools.mak
index b078fd0c95..e6fcef41f8 100644
--- a/extras/tools/tools.mak
+++ b/extras/tools/tools.mak
@@ -118,6 +118,7 @@ libtool: libtool-$(LIBTOOL_VERSION).tar.gz
$(APPLY) libtool-2.4.2-bitcode.patch
$(APPLY) libtool-2.4.2-san.patch
$(APPLY) libtool-2.4.6-clang-libs.patch
+ $(APPLY) libtool-2.4.2-response-files.patch
$(MOVE)
.buildlibtool: libtool .automake .help2man
More information about the vlc-commits
mailing list