aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mkconfigs2
-rwxr-xr-xscripts/trylink41
2 files changed, 28 insertions, 15 deletions
diff --git a/scripts/mkconfigs b/scripts/mkconfigs
index d212ad408..0d1771a36 100755
--- a/scripts/mkconfigs
+++ b/scripts/mkconfigs
@@ -44,7 +44,7 @@ echo "\
44 * Do not edit. 44 * Do not edit.
45 * 45 *
46 */ 46 */
47static const char * const bbconfig_config =" 47static const char *const bbconfig_config ="
48 48
49sed 's/\"/\\\"/g' $config | grep "^#\? \?CONFIG_" | awk '{print "\"" $0 "\\n\"";}' 49sed 's/\"/\\\"/g' $config | grep "^#\? \?CONFIG_" | awk '{print "\"" $0 "\\n\"";}'
50 50
diff --git a/scripts/trylink b/scripts/trylink
index 74acb4cdd..9b67deb49 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -6,7 +6,7 @@ try() {
6 added="$1" 6 added="$1"
7 shift 7 shift
8 $debug && echo "Trying: $* $added" 8 $debug && echo "Trying: $* $added"
9 "$@" $added >busybox.map 2>busybox_ld.err 9 "$@" $added 2>busybox_ld.err
10} 10}
11 11
12# Sanitize lib list (dups, extra spaces etc) 12# Sanitize lib list (dups, extra spaces etc)
@@ -22,14 +22,17 @@ try "-Wl,--start-group $l_list -Wl,--end-group" "$@" \
22 cat busybox_ld.err 22 cat busybox_ld.err
23 exit 1 23 exit 1
24} 24}
25# Hack: we are not supposed to know executable name, 25
26# but this hack cuts down link time 26#### Hack disabled: conflicts with ld --verbose flag in last link phase
27mv busybox_unstripped busybox_unstripped.tmp 27
28mv busybox.map busybox.map.tmp 28##### Hack: we are not supposed to know executable name,
29##### but this hack cuts down link time
30####mv busybox_unstripped busybox_unstripped.tmp
31####mv busybox.map busybox.map.tmp
29 32
30# Now try to remove each lib and build without it. 33# Now try to remove each lib and build without it.
31# Stop when no lib can be removed. 34# Stop when no lib can be removed.
32ever_discarded=false 35####ever_discarded=false
33while test "$BBOX_LIB_LIST"; do 36while test "$BBOX_LIB_LIST"; do
34 $debug && echo "Trying libraries: $BBOX_LIB_LIST" 37 $debug && echo "Trying libraries: $BBOX_LIB_LIST"
35 all_needed=true 38 all_needed=true
@@ -41,7 +44,7 @@ while test "$BBOX_LIB_LIST"; do
41 echo "Library $one is not needed" 44 echo "Library $one is not needed"
42 BBOX_LIB_LIST="$without_one" 45 BBOX_LIB_LIST="$without_one"
43 all_needed=false 46 all_needed=false
44 ever_discarded=true 47#### ever_discarded=true
45 else 48 else
46 echo "Library $one is needed" 49 echo "Library $one is needed"
47 fi 50 fi
@@ -54,13 +57,23 @@ while test "$BBOX_LIB_LIST"; do
54 #{ echo "$BBOX_LIB_LIST" | grep -q ' '; } || break 57 #{ echo "$BBOX_LIB_LIST" | grep -q ' '; } || break
55done 58done
56 59
57mv busybox_unstripped.tmp busybox_unstripped 60####mv busybox_unstripped.tmp busybox_unstripped
58mv busybox.map.tmp busybox.map 61####mv busybox.map.tmp busybox.map
59$ever_discarded && { 62####$ever_discarded && {
60 # Make the binary with final, minimal list of libs 63 # Make the binary with final, minimal list of libs
61 echo "Final link with: $BBOX_LIB_LIST" 64 echo "Final link with: $BBOX_LIB_LIST"
62 l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'` 65 l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'`
63 try "-Wl,--start-group $l_list -Wl,--end-group" "$@" || exit 1 66 # --verbose gives us gobs of info to stdout (e.g. linker script used)
64} 67 try "-Wl,--start-group $l_list -Wl,--end-group -Wl,--verbose" "$@" >busybox_ld.out ####|| exit 1
65rm busybox_ld.err 68 #
66exit 0 # Ensure "success" exit code 69 # Add SORT_BY_ALIGNMENT to linker script (found in busybox_ld.out):
70 # .rodata : { *(.rodata SORT_BY_ALIGNMENT(.rodata.*) .gnu.linkonce.r.*) }
71 # *(.data SORT_BY_ALIGNMENT(.data.*) .gnu.linkonce.d.*)
72 # *(.bss SORT_BY_ALIGNMENT(.bss.*) .gnu.linkonce.b.*)
73 # This will eliminate most of the data padding. Use linker script
74 # by commenting "try" above and uncommenting this one (tested on i386):
75 #try "-Wl,--start-group $l_list -Wl,--end-group -Wl,--verbose -Wl,-T -Wl,busybox_ldscript" "$@" >busybox_ld.out
76 #
77####}
78####rm busybox_ld.err
79####exit 0 # Ensure "success" exit code