home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.050 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  6.0 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.050
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.050
  11. Problem:    The link script is clumsy.
  12. Solution:   Use the --as-needed linker option if available. (Kirill A.
  13.         Shutemov)
  14. Files:        src/Makefile, src/auto/configure, src/config.mk.in,
  15.         src/configure.in, src/link.sh
  16.  
  17.  
  18. *** ../vim-7.3.049/src/Makefile    2010-10-27 16:49:41.000000000 +0200
  19. --- src/Makefile    2010-11-03 22:26:45.000000000 +0100
  20. ***************
  21. *** 1700,1706 ****
  22.       $(CCC) version.c -o objects/version.o
  23.       @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \
  24.           -o $(VIMTARGET) $(OBJ) objects/version.o $(ALL_LIBS)" \
  25. !         MAKE="$(MAKE)" sh $(srcdir)/link.sh
  26.   
  27.   xxd/xxd$(EXEEXT): xxd/xxd.c
  28.       cd xxd; CC="$(CC)" CFLAGS="$(CPPFLAGS) $(CFLAGS)" \
  29. --- 1700,1707 ----
  30.       $(CCC) version.c -o objects/version.o
  31.       @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \
  32.           -o $(VIMTARGET) $(OBJ) objects/version.o $(ALL_LIBS)" \
  33. !         MAKE="$(MAKE)" LINK_AS_NEEDED=$(LINK_AS_NEEDED) \
  34. !         sh $(srcdir)/link.sh
  35.   
  36.   xxd/xxd$(EXEEXT): xxd/xxd.c
  37.       cd xxd; CC="$(CC)" CFLAGS="$(CPPFLAGS) $(CFLAGS)" \
  38. *** ../vim-7.3.049/src/auto/configure    2010-11-03 21:59:23.000000000 +0100
  39. --- src/auto/configure    2010-11-03 22:28:03.000000000 +0100
  40. ***************
  41. *** 593,598 ****
  42. --- 593,599 ----
  43.   
  44.   ac_subst_vars='LTLIBOBJS
  45.   LIBOBJS
  46. + LINK_AS_NEEDED
  47.   DEPEND_CFLAGS_FILTER
  48.   MAKEMO
  49.   MSGFMT
  50. ***************
  51. *** 12404,12409 ****
  52. --- 12405,12427 ----
  53.   fi
  54.   
  55.   
  56. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --as-needed support" >&5
  57. + $as_echo_n "checking linker --as-needed support... " >&6; }
  58. + LINK_AS_NEEDED=
  59. + # Check if linker supports --as-needed and --no-as-needed options
  60. + if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
  61. +   LDFLAGS="$LDFLAGS -Wl,--as-needed"
  62. +   LINK_AS_NEEDED=yes
  63. + fi
  64. + if test "$LINK_AS_NEEDED" = yes; then
  65. +   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  66. + $as_echo "yes" >&6; }
  67. + else
  68. +   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  69. + $as_echo "no" >&6; }
  70. + fi
  71.   ac_config_files="$ac_config_files auto/config.mk:config.mk.in"
  72.   
  73.   cat >confcache <<\_ACEOF
  74. *** ../vim-7.3.049/src/config.mk.in    2010-08-15 21:57:28.000000000 +0200
  75. --- src/config.mk.in    2010-11-03 22:26:24.000000000 +0100
  76. ***************
  77. *** 30,35 ****
  78. --- 30,36 ----
  79.   CPP        = @CPP@
  80.   CPP_MM        = @CPP_MM@
  81.   DEPEND_CFLAGS_FILTER = @DEPEND_CFLAGS_FILTER@
  82. + LINK_AS_NEEDED    = @LINK_AS_NEEDED@
  83.   X_CFLAGS    = @X_CFLAGS@
  84.   X_LIBS_DIR    = @X_LIBS@
  85.   X_PRE_LIBS    = @X_PRE_LIBS@
  86. *** ../vim-7.3.049/src/configure.in    2010-11-03 21:59:23.000000000 +0100
  87. --- src/configure.in    2010-11-03 22:26:16.000000000 +0100
  88. ***************
  89. *** 3527,3532 ****
  90. --- 3527,3549 ----
  91.   fi
  92.   AC_SUBST(DEPEND_CFLAGS_FILTER)
  93.   
  94. + dnl link.sh tries to avoid overlinking in a hackish way.
  95. + dnl At least GNU ld supports --as-needed which provides the same functionality
  96. + dnl at linker level. Let's use it.
  97. + AC_MSG_CHECKING(linker --as-needed support)
  98. + LINK_AS_NEEDED=
  99. + # Check if linker supports --as-needed and --no-as-needed options
  100. + if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
  101. +   LDFLAGS="$LDFLAGS -Wl,--as-needed"
  102. +   LINK_AS_NEEDED=yes
  103. + fi
  104. + if test "$LINK_AS_NEEDED" = yes; then
  105. +   AC_MSG_RESULT(yes)
  106. + else
  107. +   AC_MSG_RESULT(no)
  108. + fi
  109. + AC_SUBST(LINK_AS_NEEDED)
  110.   dnl write output files
  111.   AC_OUTPUT(auto/config.mk:config.mk.in)
  112.   
  113. *** ../vim-7.3.049/src/link.sh    2010-08-15 21:57:25.000000000 +0200
  114. --- src/link.sh    2010-11-03 22:26:08.000000000 +0100
  115. ***************
  116. *** 5,11 ****
  117.   # libraries when they exist, but this doesn't mean they are needed for Vim.
  118.   #
  119.   #      Author: Bram Moolenaar
  120. ! # Last change: 2006 Sep 26
  121.   #     License: Public domain
  122.   #
  123.   # Warning: This fails miserably if the linker doesn't return an error code!
  124. --- 5,11 ----
  125.   # libraries when they exist, but this doesn't mean they are needed for Vim.
  126.   #
  127.   #      Author: Bram Moolenaar
  128. ! # Last change: 2010 Nov 03
  129.   #     License: Public domain
  130.   #
  131.   # Warning: This fails miserably if the linker doesn't return an error code!
  132. ***************
  133. *** 16,26 ****
  134.   echo "$LINK " >link.cmd
  135.   exit_value=0
  136.   
  137.   #
  138.   # If auto/link.sed already exists, use it.  We assume a previous run of
  139.   # link.sh has found the correct set of libraries.
  140.   #
  141. - if test -f auto/link.sed; then
  142.     echo "link.sh: The file 'auto/link.sed' exists, which is going to be used now."
  143.     echo "link.sh: If linking fails, try deleting the auto/link.sed file."
  144.     echo "link.sh: If this fails too, try creating an empty auto/link.sed file."
  145. --- 16,38 ----
  146.   echo "$LINK " >link.cmd
  147.   exit_value=0
  148.   
  149. + if test "$LINK_AS_NEEDED" = yes; then
  150. +   echo "link.sh: \$LINK_AS_NEEDED set to 'yes': invoking linker directly."
  151. +   cat link.cmd
  152. +   if sh link.cmd; then
  153. +     exit_value=0
  154. +     echo "link.sh: Linked fine"
  155. +   else
  156. +     exit_value=$?
  157. +     echo "link.sh: Linking failed"
  158. +   fi
  159. + else
  160. +   if test -f auto/link.sed; then
  161.   #
  162.   # If auto/link.sed already exists, use it.  We assume a previous run of
  163.   # link.sh has found the correct set of libraries.
  164.   #
  165.     echo "link.sh: The file 'auto/link.sed' exists, which is going to be used now."
  166.     echo "link.sh: If linking fails, try deleting the auto/link.sed file."
  167.     echo "link.sh: If this fails too, try creating an empty auto/link.sed file."
  168. ***************
  169. *** 124,129 ****
  170. --- 136,143 ----
  171.     fi
  172.   fi
  173.   
  174. + fi
  175.   #
  176.   # cleanup
  177.   #
  178. *** ../vim-7.3.049/src/version.c    2010-11-03 21:59:23.000000000 +0100
  179. --- src/version.c    2010-11-03 22:30:17.000000000 +0100
  180. ***************
  181. *** 716,717 ****
  182. --- 716,719 ----
  183.   {   /* Add new patch number below this line */
  184. + /**/
  185. +     50,
  186.   /**/
  187.  
  188. -- 
  189. Save the plankton - eat a whale.
  190.  
  191.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  192. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  193. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  194.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  195.