+ -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"
--
1.7.4.1
03-19-2011, 07:38 PM
Lukas Fleischer
Add "-Wl,--as-needed" to libalpm LDFLAGS.
On Sat, Mar 19, 2011 at 09:28:34PM +0100, Lukas Fleischer wrote:
> Also includes a Debian patch (from #347650) that makes libtool play
> nicely with "-Wl,--as-needed".
>
> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
> ---
> lib/libalpm/Makefile.am | 2 +-
> ltmain.sh | 14 ++++++++++++++
> 2 files changed, 15 insertions(+), 1 deletions(-)
Oh, and in case it turns out there's no proper solution, we might still
consider adding this patch to the PKGBUILD only, so other platforms
won't be affected.
03-19-2011, 10:29 PM
Allan McRae
Add "-Wl,--as-needed" to libalpm LDFLAGS.
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".
+ -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.
Allan
03-20-2011, 03:01 PM
Dan McGee
Add "-Wl,--as-needed" to libalpm LDFLAGS.
On Sat, Mar 19, 2011 at 6:29 PM, Allan McRae <allan@archlinux.org> 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<archlinux@cryptocrack.de>
>> ---
>> *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?
-Dan
03-20-2011, 03:29 PM
Dan McGee
Add "-Wl,--as-needed" to libalpm LDFLAGS.
On Sat, Mar 19, 2011 at 6:29 PM, Allan McRae <allan@archlinux.org> 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<archlinux@cryptocrack.de>
>> ---
>> *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.