On Sun, Mar 20, 2011 at 11:01:27AM -0500, Dan McGee wrote: > On Sat, Mar 19, 2011 at 6:29 PM, Allan McRae <[email protected]> wrote: > > On 20/03/11 06:28, Lukas Fleischer wrote: > >> > >> Also includes a Debian patch (from #347650) that makes libtool play > >> nicely with "-Wl,--as-needed". > >> > >> Signed-off-by: Lukas Fleischer<[email protected]> > >> --- > >> lib/libalpm/Makefile.am | 2 +- > >> ltmain.sh | 14 ++++++++++++++ > >> 2 files changed, 15 insertions(+), 1 deletions(-) > >> > >> diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am > >> index 1bda571..4c329b8 100644 > >> --- a/lib/libalpm/Makefile.am > >> +++ b/lib/libalpm/Makefile.am > >> @@ -52,7 +52,7 @@ libalpm_la_SOURCES += \ > >> md5.h md5.c > >> endif > >> > >> -libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) > >> +libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) > >> -Wl,--as-needed > > > > This part is not needed. With the changes below the build obeys the given > > LDFLAGS. Unless of course we want to make this the default. > > > > > >> libalpm_la_LIBADD = $(LTLIBINTL) > >> > >> # vim:set ts=2 sw=2 noet: > >> diff --git a/ltmain.sh b/ltmain.sh > >> index 6c02b18..4e98c79 100755 > >> --- a/ltmain.sh > >> +++ b/ltmain.sh > >> @@ -5790,6 +5790,11 @@ func_mode_link () > >> arg=$func_stripname_result > >> ;; > >> > >> + -Wl,--as-needed|-Wl,--no-as-needed) > >> + deplibs="$deplibs $arg" > >> + continue > >> + ;; > >> + > >> -Wl,*) > >> func_stripname '-Wl,' '' "$arg" > >> args=$func_stripname_result > >> @@ -6150,6 +6155,15 @@ func_mode_link () > >> lib= > >> found=no > >> case $deplib in > >> + -Wl,--as-needed|-Wl,--no-as-needed) > >> + if test "$linkmode,$pass" = "prog,link"; then > >> + compile_deplibs="$deplib $compile_deplibs" > >> + finalize_deplibs="$deplib $finalize_deplibs" > >> + else > >> + deplibs="$deplib $deplibs" > >> + fi > >> + continue > >> + ;; > >> > >> -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) > >> if test "$linkmode,$pass" = "prog,link"; then > >> compile_deplibs="$deplib $compile_deplibs" > > > > This hack will do until libtool gets it fixed. Just to clarify what the > > issues is here, libtool likes to reorder arguments that you pass to it. > > That puts -Wl,--as-needed after all the -lfoo statements which stops it > > working. And this is a hack as it requires -Wl,--as-needed to be > > separately specified (-Wl,--as-needed,--something-else will not work). But > > this fix is in widespread use while we wait for the proper fix so I will > > give it an ack. > > So the tl;dr part of all this- include the ltmain.sh changes but not > the Makefile.am ones, correct?
Yes, sounds reasonable. Fix libtool ignoring "-Wl,--as-needed" but leave the decision whether to actually strip indirect dependencies to the packager.
