]>
Commit | Line | Data |
---|---|---|
505cd3c0 AM |
1 | diff -urN busybox-1.8.1/scripts/trylink busybox-1.8.1-trylink/scripts/trylink |
2 | --- busybox-1.8.1/scripts/trylink 2007-11-09 18:40:48.000000000 -0700 | |
3 | +++ busybox-1.8.1-trylink/scripts/trylink 2007-11-13 11:13:30.000000000 -0700 | |
4 | @@ -46,6 +46,14 @@ | |
5 | return $exitcode | |
6 | } | |
7 | ||
8 | +check_cc() { | |
9 | + if $CC $1 -shared -o /dev/null -xc /dev/null > /dev/null 2>&1; then | |
10 | + echo "$1"; | |
11 | + else | |
12 | + echo "$2"; | |
13 | + fi | |
14 | +} | |
15 | + | |
16 | EXE="$1" | |
17 | CC="$2" | |
18 | LDFLAGS="$3" | |
19 | @@ -53,6 +61,9 @@ | |
20 | A_FILES="$5" | |
21 | LDLIBS="$6" | |
22 | ||
23 | +# The -Wl,--sort-section option is not supported by older versions of ld | |
24 | +SORT_SECTION=`check_cc "-Wl,--sort-section -Wl,alignment" ""` | |
25 | + | |
26 | # Sanitize lib list (dups, extra spaces etc) | |
27 | LDLIBS=`echo "$LDLIBS" | xargs -n1 | sort | uniq | xargs` | |
28 | ||
29 | @@ -64,7 +75,7 @@ | |
30 | try $CC $LDFLAGS \ | |
31 | -o $EXE \ | |
32 | -Wl,--sort-common \ | |
33 | - -Wl,--sort-section -Wl,alignment \ | |
34 | + $SORT_SECTION \ | |
35 | -Wl,--gc-sections \ | |
36 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | |
37 | $l_list \ | |
38 | @@ -88,7 +99,7 @@ | |
39 | try $CC $LDFLAGS \ | |
40 | -o $EXE \ | |
41 | -Wl,--sort-common \ | |
42 | - -Wl,--sort-section -Wl,alignment \ | |
43 | + $SORT_SECTION \ | |
44 | -Wl,--gc-sections \ | |
45 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | |
46 | $l_list | |
47 | @@ -117,7 +128,7 @@ | |
48 | try $CC $LDFLAGS \ | |
49 | -o $EXE \ | |
50 | -Wl,--sort-common \ | |
51 | - -Wl,--sort-section -Wl,alignment \ | |
52 | + $SORT_SECTION \ | |
53 | -Wl,--gc-sections \ | |
54 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | |
55 | $l_list \ | |
56 | @@ -139,7 +150,7 @@ | |
57 | try $CC $LDFLAGS \ | |
58 | -o $EXE \ | |
59 | -Wl,--sort-common \ | |
60 | - -Wl,--sort-section -Wl,alignment \ | |
61 | + $SORT_SECTION \ | |
62 | -Wl,--gc-sections \ | |
63 | -Wl,-T -Wl,busybox_ldscript \ | |
64 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | |
65 | @@ -174,7 +185,7 @@ | |
66 | -Wl,-soname="libbusybox.so.$BB_VER" \ | |
67 | -Wl,--undefined=lbb_main \ | |
68 | -Wl,--sort-common \ | |
69 | - -Wl,--sort-section -Wl,alignment \ | |
70 | + $SORT_SECTION \ | |
71 | -Wl,--start-group $A_FILES -Wl,--end-group \ | |
72 | $l_list \ | |
73 | -Wl,--warn-common \ | |
74 | @@ -195,7 +206,7 @@ | |
75 | try $CC $LDFLAGS \ | |
76 | -o $EXE \ | |
77 | -Wl,--sort-common \ | |
78 | - -Wl,--sort-section -Wl,alignment \ | |
79 | + $SORT_SECTION \ | |
80 | -Wl,--gc-sections \ | |
81 | -Wl,--start-group $O_FILES -Wl,--end-group \ | |
82 | -L"$sharedlib_dir" -lbusybox \ | |
83 | @@ -234,7 +245,7 @@ | |
84 | try $CC $LDFLAGS "$sharedlib_dir/applet.c" \ | |
85 | -o $EXE \ | |
86 | -Wl,--sort-common \ | |
87 | - -Wl,--sort-section -Wl,alignment \ | |
88 | + $SORT_SECTION \ | |
89 | -Wl,--gc-sections \ | |
90 | -L"$sharedlib_dir" -lbusybox \ | |
91 | -Wl,--warn-common \ |