aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-09-03 11:28:14 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-09-03 11:28:14 +0000
commit9862e6b0560ba8d4261d16534d9372883aca98bc (patch)
tree1f503ac523a37c83037268759557d1e11bc91c92
parentfc202427d56b2a1ce171705907485c3b6290b033 (diff)
downloadbusybox-w32-9862e6b0560ba8d4261d16534d9372883aca98bc.tar.gz
busybox-w32-9862e6b0560ba8d4261d16534d9372883aca98bc.tar.bz2
busybox-w32-9862e6b0560ba8d4261d16534d9372883aca98bc.zip
trylink: reinstate accidentally deleted --verbose
trylink: remove commented-out parts
-rwxr-xr-xscripts/trylink51
1 files changed, 17 insertions, 34 deletions
diff --git a/scripts/trylink b/scripts/trylink
index cede22be2..0b8f6c062 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -14,9 +14,8 @@ try() {
14BBOX_LIB_LIST=`echo "$BBOX_LIB_LIST" | xargs -n1 | sort | uniq | xargs` 14BBOX_LIB_LIST=`echo "$BBOX_LIB_LIST" | xargs -n1 | sort | uniq | xargs`
15 15
16# First link with all libs. If it fails, bail out 16# First link with all libs. If it fails, bail out
17l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
18
19echo "Trying libraries: $BBOX_LIB_LIST" 17echo "Trying libraries: $BBOX_LIB_LIST"
18l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
20test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group" 19test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group"
21try "$l_list" "$@" \ 20try "$l_list" "$@" \
22|| { 21|| {
@@ -25,16 +24,8 @@ try "$l_list" "$@" \
25 exit 1 24 exit 1
26} 25}
27 26
28#### Hack disabled: conflicts with ld --verbose flag in last link phase
29
30##### Hack: we are not supposed to know executable name,
31##### but this hack cuts down link time
32####mv busybox_unstripped busybox_unstripped.tmp
33####mv busybox.map busybox.map.tmp
34
35# Now try to remove each lib and build without it. 27# Now try to remove each lib and build without it.
36# Stop when no lib can be removed. 28# Stop when no lib can be removed.
37####ever_discarded=false
38while test "$BBOX_LIB_LIST"; do 29while test "$BBOX_LIB_LIST"; do
39 $debug && echo "Trying libraries: $BBOX_LIB_LIST" 30 $debug && echo "Trying libraries: $BBOX_LIB_LIST"
40 all_needed=true 31 all_needed=true
@@ -47,7 +38,6 @@ while test "$BBOX_LIB_LIST"; do
47 echo "Library $one is not needed" 38 echo "Library $one is not needed"
48 BBOX_LIB_LIST="$without_one" 39 BBOX_LIB_LIST="$without_one"
49 all_needed=false 40 all_needed=false
50#### ever_discarded=true
51 else 41 else
52 echo "Library $one is needed" 42 echo "Library $one is needed"
53 fi 43 fi
@@ -60,26 +50,19 @@ while test "$BBOX_LIB_LIST"; do
60 #{ echo "$BBOX_LIB_LIST" | grep -q ' '; } || break 50 #{ echo "$BBOX_LIB_LIST" | grep -q ' '; } || break
61done 51done
62 52
63####mv busybox_unstripped.tmp busybox_unstripped 53# Make the binary with final, minimal list of libs
64####mv busybox.map.tmp busybox.map 54echo "Final link with: $BBOX_LIB_LIST"
65####$ever_discarded && { 55l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
66 # Make the binary with final, minimal list of libs 56test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group -Wl,--verbose"
67 echo "Final link with: $BBOX_LIB_LIST" 57# --verbose gives us gobs of info to stdout (e.g. linker script used)
68 l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'` 58if ! test -f busybox_ldscript; then
69 # --verbose gives us gobs of info to stdout (e.g. linker script used) 59 try "$l_list -Wl,--verbose" "$@" >busybox_ld.out
70 test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group -Wl,--verbose" 60else
71 if ! test -f busybox_ldscript; then 61 echo "Custom linker script 'busybox_ldscript' found, using it"
72 62 # Add SORT_BY_ALIGNMENT to linker script (found in busybox_ld.out):
73 try "$l_list" "$@" >busybox_ld.out ####|| exit 1 63 # .rodata : { *(.rodata SORT_BY_ALIGNMENT(.rodata.*) .gnu.linkonce.r.*) }
74 else 64 # *(.data SORT_BY_ALIGNMENT(.data.*) .gnu.linkonce.d.*)
75 echo "Custom linker script 'busybox_ldscript' found, using it" 65 # *(.bss SORT_BY_ALIGNMENT(.bss.*) .gnu.linkonce.b.*)
76 # Add SORT_BY_ALIGNMENT to linker script (found in busybox_ld.out): 66 # This will eliminate most of the data padding (~3kb).
77 # .rodata : { *(.rodata SORT_BY_ALIGNMENT(.rodata.*) .gnu.linkonce.r.*) } 67 try "$l_list -Wl,--verbose -Wl,-T -Wl,busybox_ldscript" "$@" >busybox_ld.out
78 # *(.data SORT_BY_ALIGNMENT(.data.*) .gnu.linkonce.d.*) 68fi
79 # *(.bss SORT_BY_ALIGNMENT(.bss.*) .gnu.linkonce.b.*)
80 # This will eliminate most of the data padding (~3kb).
81 try "$l_list -Wl,-T -Wl,busybox_ldscript" "$@" >busybox_ld.out
82 fi
83####}
84####rm busybox_ld.err
85####exit 0 # Ensure "success" exit code