aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/trylink13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/trylink b/scripts/trylink
index bfc67bf5d..b8bf8b1c7 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -25,8 +25,9 @@ try "-Wl,--start-group $l_list -Wl,--end-group" "$@" \
25# Hack: we are not supposed to know executable name, 25# Hack: we are not supposed to know executable name,
26# but this hack cuts down link time 26# but this hack cuts down link time
27mv busybox_unstripped busybox_unstripped.tmp 27mv busybox_unstripped busybox_unstripped.tmp
28mv busybox.map busybox.map.tmp
28 29
29# Now try to remove each lib and build without. 30# Now try to remove each lib and build without it.
30# Stop when no lib can be removed. 31# Stop when no lib can be removed.
31ever_discarded=false 32ever_discarded=false
32while test "$BBOX_LIB_LIST"; do 33while test "$BBOX_LIB_LIST"; do
@@ -47,17 +48,19 @@ while test "$BBOX_LIB_LIST"; do
47 done 48 done
48 # All libs were needed, can't remove any 49 # All libs were needed, can't remove any
49 $all_needed && break 50 $all_needed && break
50 # If there is no space, the list has just one lib. 51 # If there is no space char, the list has just one lib.
51 # I'm not sure that in this case lib really is 100% needed. 52 # I'm not sure that in this case lib really is 100% needed.
52 # Let's try linking without it anyway... thus commented out. 53 # Let's try linking without it anyway... thus commented out.
53 #echo "$BBOX_LIB_LIST" | grep -q ' ' || break 54 #{ echo "$BBOX_LIB_LIST" | grep -q ' '; } || break
54done 55done
55 56
56mv busybox_unstripped.tmp busybox_unstripped 57mv busybox_unstripped.tmp busybox_unstripped
58mv busybox.map.tmp busybox.map
57$ever_discarded && { 59$ever_discarded && {
58 # Ok, make the binary 60 # Make the binary with final, minimal list of libs
59 echo "Final link with: $BBOX_LIB_LIST" 61 echo "Final link with: $BBOX_LIB_LIST"
60 l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'` 62 l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'`
61 try "-Wl,--start-group $l_list -Wl,--end-group" "$@" 63 try "-Wl,--start-group $l_list -Wl,--end-group" "$@" && exit 1
62} 64}
65rm busybox_ld.err
63exit 0 # Ensure "success" exit code 66exit 0 # Ensure "success" exit code