]>
Commit | Line | Data |
---|---|---|
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 | + | |
72 | + | |
73 | ac_config_files="$ac_config_files auto/config.mk:config.mk.in" | |
74 | ||
75 | cat >confcache <<\_ACEOF | |
76 | *** ../vim-7.3.049/src/config.mk.in 2010-08-15 21:57:28.000000000 +0200 | |
77 | --- src/config.mk.in 2010-11-03 22:26:24.000000000 +0100 | |
78 | *************** | |
79 | *** 30,35 **** | |
80 | --- 30,36 ---- | |
81 | CPP = @CPP@ | |
82 | CPP_MM = @CPP_MM@ | |
83 | DEPEND_CFLAGS_FILTER = @DEPEND_CFLAGS_FILTER@ | |
84 | + LINK_AS_NEEDED = @LINK_AS_NEEDED@ | |
85 | X_CFLAGS = @X_CFLAGS@ | |
86 | X_LIBS_DIR = @X_LIBS@ | |
87 | X_PRE_LIBS = @X_PRE_LIBS@ | |
88 | *** ../vim-7.3.049/src/configure.in 2010-11-03 21:59:23.000000000 +0100 | |
89 | --- src/configure.in 2010-11-03 22:26:16.000000000 +0100 | |
90 | *************** | |
91 | *** 3527,3532 **** | |
92 | --- 3527,3549 ---- | |
93 | fi | |
94 | AC_SUBST(DEPEND_CFLAGS_FILTER) | |
95 | ||
96 | + dnl link.sh tries to avoid overlinking in a hackish way. | |
97 | + dnl At least GNU ld supports --as-needed which provides the same functionality | |
98 | + dnl at linker level. Let's use it. | |
99 | + AC_MSG_CHECKING(linker --as-needed support) | |
100 | + LINK_AS_NEEDED= | |
101 | + # Check if linker supports --as-needed and --no-as-needed options | |
102 | + if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then | |
103 | + LDFLAGS="$LDFLAGS -Wl,--as-needed" | |
104 | + LINK_AS_NEEDED=yes | |
105 | + fi | |
106 | + if test "$LINK_AS_NEEDED" = yes; then | |
107 | + AC_MSG_RESULT(yes) | |
108 | + else | |
109 | + AC_MSG_RESULT(no) | |
110 | + fi | |
111 | + AC_SUBST(LINK_AS_NEEDED) | |
112 | + | |
113 | dnl write output files | |
114 | AC_OUTPUT(auto/config.mk:config.mk.in) | |
115 | ||
116 | *** ../vim-7.3.049/src/link.sh 2010-08-15 21:57:25.000000000 +0200 | |
117 | --- src/link.sh 2010-11-03 22:26:08.000000000 +0100 | |
118 | *************** | |
119 | *** 5,11 **** | |
120 | # libraries when they exist, but this doesn't mean they are needed for Vim. | |
121 | # | |
122 | # Author: Bram Moolenaar | |
123 | ! # Last change: 2006 Sep 26 | |
124 | # License: Public domain | |
125 | # | |
126 | # Warning: This fails miserably if the linker doesn't return an error code! | |
127 | --- 5,11 ---- | |
128 | # libraries when they exist, but this doesn't mean they are needed for Vim. | |
129 | # | |
130 | # Author: Bram Moolenaar | |
131 | ! # Last change: 2010 Nov 03 | |
132 | # License: Public domain | |
133 | # | |
134 | # Warning: This fails miserably if the linker doesn't return an error code! | |
135 | *************** | |
136 | *** 16,26 **** | |
137 | echo "$LINK " >link.cmd | |
138 | exit_value=0 | |
139 | ||
140 | # | |
141 | # If auto/link.sed already exists, use it. We assume a previous run of | |
142 | # link.sh has found the correct set of libraries. | |
143 | # | |
144 | - if test -f auto/link.sed; then | |
145 | echo "link.sh: The file 'auto/link.sed' exists, which is going to be used now." | |
146 | echo "link.sh: If linking fails, try deleting the auto/link.sed file." | |
147 | echo "link.sh: If this fails too, try creating an empty auto/link.sed file." | |
148 | --- 16,38 ---- | |
149 | echo "$LINK " >link.cmd | |
150 | exit_value=0 | |
151 | ||
152 | + if test "$LINK_AS_NEEDED" = yes; then | |
153 | + echo "link.sh: \$LINK_AS_NEEDED set to 'yes': invoking linker directly." | |
154 | + cat link.cmd | |
155 | + if sh link.cmd; then | |
156 | + exit_value=0 | |
157 | + echo "link.sh: Linked fine" | |
158 | + else | |
159 | + exit_value=$? | |
160 | + echo "link.sh: Linking failed" | |
161 | + fi | |
162 | + else | |
163 | + if test -f auto/link.sed; then | |
164 | + | |
165 | # | |
166 | # If auto/link.sed already exists, use it. We assume a previous run of | |
167 | # link.sh has found the correct set of libraries. | |
168 | # | |
169 | echo "link.sh: The file 'auto/link.sed' exists, which is going to be used now." | |
170 | echo "link.sh: If linking fails, try deleting the auto/link.sed file." | |
171 | echo "link.sh: If this fails too, try creating an empty auto/link.sed file." | |
172 | *************** | |
173 | *** 124,129 **** | |
174 | --- 136,143 ---- | |
175 | fi | |
176 | fi | |
177 | ||
178 | + fi | |
179 | + | |
180 | # | |
181 | # cleanup | |
182 | # | |
183 | *** ../vim-7.3.049/src/version.c 2010-11-03 21:59:23.000000000 +0100 | |
184 | --- src/version.c 2010-11-03 22:30:17.000000000 +0100 | |
185 | *************** | |
186 | *** 716,717 **** | |
187 | --- 716,719 ---- | |
188 | { /* Add new patch number below this line */ | |
189 | + /**/ | |
190 | + 50, | |
191 | /**/ | |
192 | ||
193 | -- | |
194 | Save the plankton - eat a whale. | |
195 | ||
196 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
197 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
198 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
199 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |