0012-Prefer-response-files-over-linker-scripts-for-mingw-.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. From ec15841963ca3aab3bc88fb0932c014337284bfc Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
  3. Date: Wed, 10 Oct 2018 10:47:21 +0300
  4. Subject: [PATCH 2/2] Prefer response files over linker scripts for mingw tools
  5. The GCC/binutils tools support response files just fine, while
  6. lld (impersonating GNU ld) only supports response files, not
  7. linker scripts. Using a linker script as input just to pass a
  8. list of files is overkill for cases when a response file is enough.
  9. ---
  10. build-aux/ltmain.in | 28 ++++++++++++++--------------
  11. m4/libtool.m4 | 2 ++
  12. 2 files changed, 16 insertions(+), 14 deletions(-)
  13. diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
  14. index e2fb263..db5d590 100644
  15. --- a/build-aux/ltmain.in
  16. +++ b/build-aux/ltmain.in
  17. @@ -7932,20 +7932,7 @@ EOF
  18. last_robj=
  19. k=1
  20. - if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  21. - output=$output_objdir/$output_la.lnkscript
  22. - func_verbose "creating GNU ld script: $output"
  23. - echo 'INPUT (' > $output
  24. - for obj in $save_libobjs
  25. - do
  26. - func_to_tool_file "$obj"
  27. - $ECHO "$func_to_tool_file_result" >> $output
  28. - done
  29. - echo ')' >> $output
  30. - func_append delfiles " $output"
  31. - func_to_tool_file "$output"
  32. - output=$func_to_tool_file_result
  33. - elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  34. + if test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  35. output=$output_objdir/$output_la.lnk
  36. func_verbose "creating linker input file list: $output"
  37. : > $output
  38. @@ -7964,6 +7951,19 @@ EOF
  39. func_append delfiles " $output"
  40. func_to_tool_file "$output"
  41. output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  42. + elif test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  43. + output=$output_objdir/$output_la.lnkscript
  44. + func_verbose "creating GNU ld script: $output"
  45. + echo 'INPUT (' > $output
  46. + for obj in $save_libobjs
  47. + do
  48. + func_to_tool_file "$obj"
  49. + $ECHO "$func_to_tool_file_result" >> $output
  50. + done
  51. + echo ')' >> $output
  52. + func_append delfiles " $output"
  53. + func_to_tool_file "$output"
  54. + output=$func_to_tool_file_result
  55. else
  56. if test -n "$save_libobjs"; then
  57. func_verbose "creating reloadable object files..."
  58. diff --git a/m4/libtool.m4 b/m4/libtool.m4
  59. index d9322d0..9046a84 100644
  60. --- a/m4/libtool.m4
  61. +++ b/m4/libtool.m4
  62. @@ -5130,6 +5130,7 @@ _LT_EOF
  63. _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
  64. _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'
  65. _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
  66. + _LT_TAGVAR(file_list_spec, $1)='@'
  67. if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
  68. _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'
  69. @@ -6706,6 +6707,7 @@ if test yes != "$_lt_caught_CXX_error"; then
  70. _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
  71. _LT_TAGVAR(always_export_symbols, $1)=no
  72. _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
  73. + _LT_TAGVAR(file_list_spec, $1)='@'
  74. if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
  75. _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'
  76. --
  77. 2.7.4