diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/trylink | 13 |
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 |
27 | mv busybox_unstripped busybox_unstripped.tmp | 27 | mv busybox_unstripped busybox_unstripped.tmp |
28 | mv 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. |
31 | ever_discarded=false | 32 | ever_discarded=false |
32 | while test "$BBOX_LIB_LIST"; do | 33 | while 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 |
54 | done | 55 | done |
55 | 56 | ||
56 | mv busybox_unstripped.tmp busybox_unstripped | 57 | mv busybox_unstripped.tmp busybox_unstripped |
58 | mv 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 | } |
65 | rm busybox_ld.err | ||
63 | exit 0 # Ensure "success" exit code | 66 | exit 0 # Ensure "success" exit code |