[pacman-dev] [PATCH] Fix libtool detection of --as-needed flag

Dave Reisner d at falconindy.com
Sat Oct 22 22:37:45 EDT 2011


On Sat, Oct 22, 2011 at 07:52:39PM +1000, Allan McRae wrote:
> The fix for -Wl,--as-needed in commit b0f9477f assumes that
> --as-needed/--no-as-needed is the only option given in a -Wl line.
> However, it is perfectly valid to specify multiple flags comma
> separated after a single -Wl (e.g. the default LDFLAGS in Arch
> Linux makepkg.conf).
> 
> Adjust the fix so it detect --as-needed in a more general context
> 
> > readelf -d lib/libalpm/.libs/libalpm.so.?.?.? | grep NEEDED | wc -l
> Before: 13
> After: 5
> 
> Signed-off-by: Allan McRae <allan at archlinux.org>
> ---

Ack. Agree that its not ideal, but I don't think we're going to run into
a situation where it's unideal to the point of breakage.

> 
> This is probably still not the ideal fix... but it works.
> 
>  ltmain.sh |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/ltmain.sh b/ltmain.sh
> index fafd01b..5f505e2 100644
> --- a/ltmain.sh
> +++ b/ltmain.sh
> @@ -5800,9 +5800,12 @@ func_mode_link ()
>  	arg=$func_stripname_result
>  	;;
>  
> -      -Wl,--as-needed|-Wl,--no-as-needed)
> -	deplibs="$deplibs $arg"
> -	continue
> +      -Wl,*--as-needed*)
> +	deplibs="$deplibs $wl--as-needed"
> +	;;
> +
> +      -Wl,*--no-as-needed*)
> +	deplibs="$deplibs $wl--no-as-needed"
>  	;;
>  
>        -Wl,*)
> -- 
> 1.7.7
> 
> 


More information about the pacman-dev mailing list