svn commit: trunk/busybox/scripts

aldot at busybox.net aldot at busybox.net
Sun Sep 2 14:51:56 UTC 2007


Author: aldot
Date: 2007-09-02 07:51:54 -0700 (Sun, 02 Sep 2007)
New Revision: 19760

Log:
- fix bug where we linked again -lm even though it is not needed.
  For BBOX_LIB_LIST="crypt m" trylink ... with just applet true, we pulled in
  libm because in this case we tried to use invalid flags (plain "-l" without
  a lib) which of course failed, thus the script thought that -lm was needed.

  The fix is not to pass "-l" without a lib if we are about to check if any
  or the last remaining lib is really needed.


Modified:
   trunk/busybox/scripts/trylink


Changeset:
Modified: trunk/busybox/scripts/trylink
===================================================================
--- trunk/busybox/scripts/trylink	2007-09-01 19:42:11 UTC (rev 19759)
+++ trunk/busybox/scripts/trylink	2007-09-02 14:51:54 UTC (rev 19760)
@@ -39,8 +39,17 @@
     for one in $BBOX_LIB_LIST; do
 	without_one=`echo " $BBOX_LIB_LIST " | sed "s/ $one / /g" | xargs`
 	l_list=`echo "$without_one" | sed -e 's/ / -l/g' -e 's/^/-l/'`
-	$debug && echo "Trying -l options: $l_list"
-	if try "-Wl,--start-group $l_list -Wl,--end-group" "$@"; then
+	# If l_list is just "-l" without a lib, then make sure to test the
+	# correct thing to fail: just using -l will fail, so the last lib
+	# (usually m in my case) will incorrectly be added as needed.
+	if test "x$without_one" != "x"; then
+		l_list="-Wl,--start-group $l_list -Wl,--end-group"
+	else
+		# without_one is empty, so l_list has to be empty too
+		l_list=""
+	fi
+	$debug && echo "Trying -l options: '$l_list'"
+	if try "$l_list" "$@"; then
 		echo "Library $one is not needed"
 		BBOX_LIB_LIST="$without_one"
 		all_needed=false




More information about the busybox-cvs mailing list