adjust defconfig
[buildroot.git] / package / busybox / busybox-1.7.0-trylink.patch
blob051f2af0e53ef0fcfe86fdf1ab42eea8a9152cad
1 diff -urN busybox-1.7.0/scripts/trylink busybox-1.7.0-trylink/scripts/trylink
2 --- busybox-1.7.0/scripts/trylink 2007-08-24 11:49:43.000000000 +0100
3 +++ busybox-1.7.0-trylink/scripts/trylink 2007-09-03 12:08:18.000000000 +0100
4 @@ -14,37 +14,30 @@
5 BBOX_LIB_LIST=`echo "$BBOX_LIB_LIST" | xargs -n1 | sort | uniq | xargs`
7 # First link with all libs. If it fails, bail out
8 -l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'`
9 echo "Trying libraries: $BBOX_LIB_LIST"
10 -try "-Wl,--start-group $l_list -Wl,--end-group" "$@" \
11 +l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
12 +test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group"
13 +try "$l_list" "$@" \
14 || {
15 echo "Failed: $* -Wl,--start-group $l_list -Wl,--end-group"
16 cat busybox_ld.err
17 exit 1
20 -#### Hack disabled: conflicts with ld --verbose flag in last link phase
22 -##### Hack: we are not supposed to know executable name,
23 -##### but this hack cuts down link time
24 -####mv busybox_unstripped busybox_unstripped.tmp
25 -####mv busybox.map busybox.map.tmp
27 # Now try to remove each lib and build without it.
28 # Stop when no lib can be removed.
29 -####ever_discarded=false
30 while test "$BBOX_LIB_LIST"; do
31 $debug && echo "Trying libraries: $BBOX_LIB_LIST"
32 all_needed=true
33 for one in $BBOX_LIB_LIST; do
34 without_one=`echo " $BBOX_LIB_LIST " | sed "s/ $one / /g" | xargs`
35 - l_list=`echo "$without_one" | sed -e 's/ / -l/g' -e 's/^/-l/'`
36 - $debug && echo "Trying -l options: $l_list"
37 - if try "-Wl,--start-group $l_list -Wl,--end-group" "$@"; then
38 + l_list=`echo "$without_one" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
39 + test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group"
40 + $debug && echo "Trying -l options: '$l_list'"
41 + if try "$l_list" "$@"; then
42 echo "Library $one is not needed"
43 BBOX_LIB_LIST="$without_one"
44 all_needed=false
45 -#### ever_discarded=true
46 else
47 echo "Library $one is needed"
49 @@ -57,24 +50,19 @@
50 #{ echo "$BBOX_LIB_LIST" | grep -q ' '; } || break
51 done
53 -####mv busybox_unstripped.tmp busybox_unstripped
54 -####mv busybox.map.tmp busybox.map
55 -####$ever_discarded && {
56 - # Make the binary with final, minimal list of libs
57 - echo "Final link with: $BBOX_LIB_LIST"
58 - l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'`
59 - # --verbose gives us gobs of info to stdout (e.g. linker script used)
60 - if ! test -f busybox_ldscript; then
61 - try "-Wl,--start-group $l_list -Wl,--end-group -Wl,--verbose" "$@" >busybox_ld.out ####|| exit 1
62 - else
63 - echo "Custom linker script 'busybox_ldscript' found, using it"
64 - # Add SORT_BY_ALIGNMENT to linker script (found in busybox_ld.out):
65 - # .rodata : { *(.rodata SORT_BY_ALIGNMENT(.rodata.*) .gnu.linkonce.r.*) }
66 - # *(.data SORT_BY_ALIGNMENT(.data.*) .gnu.linkonce.d.*)
67 - # *(.bss SORT_BY_ALIGNMENT(.bss.*) .gnu.linkonce.b.*)
68 - # This will eliminate most of the data padding (~3kb).
69 - try "-Wl,--start-group $l_list -Wl,--end-group -Wl,--verbose -Wl,-T -Wl,busybox_ldscript" "$@" >busybox_ld.out
70 - fi
71 -####}
72 -####rm busybox_ld.err
73 -####exit 0 # Ensure "success" exit code
74 +# Make the binary with final, minimal list of libs
75 +echo "Final link with: $BBOX_LIB_LIST"
76 +l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
77 +test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group -Wl,--verbose"
78 +# --verbose gives us gobs of info to stdout (e.g. linker script used)
79 +if ! test -f busybox_ldscript; then
80 + try "$l_list -Wl,--verbose" "$@" >busybox_ld.out
81 +else
82 + echo "Custom linker script 'busybox_ldscript' found, using it"
83 + # Add SORT_BY_ALIGNMENT to linker script (found in busybox_ld.out):
84 + # .rodata : { *(.rodata SORT_BY_ALIGNMENT(.rodata.*) .gnu.linkonce.r.*) }
85 + # *(.data SORT_BY_ALIGNMENT(.data.*) .gnu.linkonce.d.*)
86 + # *(.bss SORT_BY_ALIGNMENT(.bss.*) .gnu.linkonce.b.*)
87 + # This will eliminate most of the data padding (~3kb).
88 + try "$l_list -Wl,--verbose -Wl,-T -Wl,busybox_ldscript" "$@" >busybox_ld.out
89 +fi