summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile3
-rwxr-xr-xsrc/auto/configure18
-rw-r--r--src/config.mk.in1
-rw-r--r--src/configure.in17
-rwxr-xr-xsrc/link.sh18
-rw-r--r--src/version.c2
6 files changed, 56 insertions, 3 deletions
diff --git a/src/Makefile b/src/Makefile
index ad9b113d4..8f47f45d6 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1700,7 +1700,8 @@ $(VIMTARGET): auto/config.mk objects $(OBJ) version.c version.h
$(CCC) version.c -o objects/version.o
@LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \
-o $(VIMTARGET) $(OBJ) objects/version.o $(ALL_LIBS)" \
- MAKE="$(MAKE)" sh $(srcdir)/link.sh
+ MAKE="$(MAKE)" LINK_AS_NEEDED=$(LINK_AS_NEEDED) \
+ sh $(srcdir)/link.sh
xxd/xxd$(EXEEXT): xxd/xxd.c
cd xxd; CC="$(CC)" CFLAGS="$(CPPFLAGS) $(CFLAGS)" \
diff --git a/src/auto/configure b/src/auto/configure
index f18f5e5ae..336744183 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -593,6 +593,7 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
+LINK_AS_NEEDED
DEPEND_CFLAGS_FILTER
MAKEMO
MSGFMT
@@ -12404,6 +12405,23 @@ $as_echo "no" >&6; }
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --as-needed support" >&5
+$as_echo_n "checking linker --as-needed support... " >&6; }
+LINK_AS_NEEDED=
+# Check if linker supports --as-needed and --no-as-needed options
+if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
+ LDFLAGS="$LDFLAGS -Wl,--as-needed"
+ LINK_AS_NEEDED=yes
+fi
+if test "$LINK_AS_NEEDED" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
ac_config_files="$ac_config_files auto/config.mk:config.mk.in"
cat >confcache <<\_ACEOF
diff --git a/src/config.mk.in b/src/config.mk.in
index 7154114ed..3b08766d1 100644
--- a/src/config.mk.in
+++ b/src/config.mk.in
@@ -30,6 +30,7 @@ TAGPRG = @TAGPRG@
CPP = @CPP@
CPP_MM = @CPP_MM@
DEPEND_CFLAGS_FILTER = @DEPEND_CFLAGS_FILTER@
+LINK_AS_NEEDED = @LINK_AS_NEEDED@
X_CFLAGS = @X_CFLAGS@
X_LIBS_DIR = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
diff --git a/src/configure.in b/src/configure.in
index 27bad25a1..6ffc675d9 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -3527,6 +3527,23 @@ if test "$GCC" = yes; then
fi
AC_SUBST(DEPEND_CFLAGS_FILTER)
+dnl link.sh tries to avoid overlinking in a hackish way.
+dnl At least GNU ld supports --as-needed which provides the same functionality
+dnl at linker level. Let's use it.
+AC_MSG_CHECKING(linker --as-needed support)
+LINK_AS_NEEDED=
+# Check if linker supports --as-needed and --no-as-needed options
+if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
+ LDFLAGS="$LDFLAGS -Wl,--as-needed"
+ LINK_AS_NEEDED=yes
+fi
+if test "$LINK_AS_NEEDED" = yes; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST(LINK_AS_NEEDED)
+
dnl write output files
AC_OUTPUT(auto/config.mk:config.mk.in)
diff --git a/src/link.sh b/src/link.sh
index 3d90f3cac..71ee061e3 100755
--- a/src/link.sh
+++ b/src/link.sh
@@ -5,7 +5,7 @@
# libraries when they exist, but this doesn't mean they are needed for Vim.
#
# Author: Bram Moolenaar
-# Last change: 2006 Sep 26
+# Last change: 2010 Nov 03
# License: Public domain
#
# Warning: This fails miserably if the linker doesn't return an error code!
@@ -16,11 +16,23 @@
echo "$LINK " >link.cmd
exit_value=0
+if test "$LINK_AS_NEEDED" = yes; then
+ echo "link.sh: \$LINK_AS_NEEDED set to 'yes': invoking linker directly."
+ cat link.cmd
+ if sh link.cmd; then
+ exit_value=0
+ echo "link.sh: Linked fine"
+ else
+ exit_value=$?
+ echo "link.sh: Linking failed"
+ fi
+else
+ if test -f auto/link.sed; then
+
#
# If auto/link.sed already exists, use it. We assume a previous run of
# link.sh has found the correct set of libraries.
#
-if test -f auto/link.sed; then
echo "link.sh: The file 'auto/link.sed' exists, which is going to be used now."
echo "link.sh: If linking fails, try deleting the auto/link.sed file."
echo "link.sh: If this fails too, try creating an empty auto/link.sed file."
@@ -124,6 +136,8 @@ if test -f auto/link.sed -a ! -s auto/link.sed -a ! -f link3.sed; then
fi
fi
+fi
+
#
# cleanup
#
diff --git a/src/version.c b/src/version.c
index fbca25ecb..8756e19bb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 50,
+/**/
49,
/**/
48,