diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-30 00:15:56 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-30 00:15:56 +0000 |
| commit | a2dcb5017503acea97547e4c538a47f920d752f7 (patch) | |
| tree | 342a0ad0a1a8420e7d640eb31a91357d05a8d63b /scripts | |
| parent | 3c07e4b8776da6f23251f98e95207f4c713d73bd (diff) | |
| download | busybox-w32-a2dcb5017503acea97547e4c538a47f920d752f7.tar.gz busybox-w32-a2dcb5017503acea97547e4c538a47f920d752f7.tar.bz2 busybox-w32-a2dcb5017503acea97547e4c538a47f920d752f7.zip | |
trylink: fix glibc check; make --sort-section option look less ugly
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/trylink | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/trylink b/scripts/trylink index 89e36b7e9..9efd208ae 100755 --- a/scripts/trylink +++ b/scripts/trylink | |||
| @@ -66,7 +66,7 @@ check_libc_is_glibc() { | |||
| 66 | #if defined(__GLIBC__) && !defined(__UCLIBC__) | 66 | #if defined(__GLIBC__) && !defined(__UCLIBC__) |
| 67 | syntax error here | 67 | syntax error here |
| 68 | #endif | 68 | #endif |
| 69 | " >"$tempname" | 69 | " >"$tempname".c |
| 70 | if $CC "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then | 70 | if $CC "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then |
| 71 | echo "$2"; | 71 | echo "$2"; |
| 72 | else | 72 | else |
| @@ -83,15 +83,15 @@ O_FILES="$5" | |||
| 83 | A_FILES="$6" | 83 | A_FILES="$6" |
| 84 | LDLIBS="$7" | 84 | LDLIBS="$7" |
| 85 | 85 | ||
| 86 | # The -Wl,--sort-section option is not supported by older versions of ld | 86 | # The --sort-section option is not supported by older versions of ld |
| 87 | SORT_SECTION=`check_cc "-Wl,--sort-section -Wl,alignment" ""` | 87 | SORT_SECTION=`check_cc "-Wl,--sort-section,alignment" ""` |
| 88 | 88 | ||
| 89 | # Static linking against glibc produces buggy executables | 89 | # Static linking against glibc produces buggy executables |
| 90 | # (glibc does not cope well with ld --gc-sections). | 90 | # (glibc does not cope well with ld --gc-sections). |
| 91 | # See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 | 91 | # See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 |
| 92 | # Note that glibc is unsuitable for static linking anyway. | 92 | # Note that glibc is unsuitable for static linking anyway. |
| 93 | # We are removing -Wl,--gc-sections from link command line. | 93 | # We are removing -Wl,--gc-sections from link command line. |
| 94 | GC_SECTION=`( | 94 | GC_SECTIONS=`( |
| 95 | . ./.config | 95 | . ./.config |
| 96 | if test x"$CONFIG_STATIC" = x"y"; then | 96 | if test x"$CONFIG_STATIC" = x"y"; then |
| 97 | check_libc_is_glibc "" "-Wl,--gc-sections" | 97 | check_libc_is_glibc "" "-Wl,--gc-sections" |
| @@ -112,7 +112,7 @@ try $CC $CFLAGS $LDFLAGS \ | |||
| 112 | -o $EXE \ | 112 | -o $EXE \ |
| 113 | -Wl,--sort-common \ | 113 | -Wl,--sort-common \ |
| 114 | $SORT_SECTION \ | 114 | $SORT_SECTION \ |
| 115 | $GC_SECTION \ | 115 | $GC_SECTIONS \ |
| 116 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | 116 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ |
| 117 | $l_list \ | 117 | $l_list \ |
| 118 | || { | 118 | || { |
| @@ -136,7 +136,7 @@ while test "$LDLIBS"; do | |||
| 136 | -o $EXE \ | 136 | -o $EXE \ |
| 137 | -Wl,--sort-common \ | 137 | -Wl,--sort-common \ |
| 138 | $SORT_SECTION \ | 138 | $SORT_SECTION \ |
| 139 | $GC_SECTION \ | 139 | $GC_SECTIONS \ |
| 140 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | 140 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ |
| 141 | $l_list | 141 | $l_list |
| 142 | if test $? = 0; then | 142 | if test $? = 0; then |
| @@ -165,7 +165,7 @@ if ! test -f busybox_ldscript; then | |||
| 165 | -o $EXE \ | 165 | -o $EXE \ |
| 166 | -Wl,--sort-common \ | 166 | -Wl,--sort-common \ |
| 167 | $SORT_SECTION \ | 167 | $SORT_SECTION \ |
| 168 | $GC_SECTION \ | 168 | $GC_SECTIONS \ |
| 169 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | 169 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ |
| 170 | $l_list \ | 170 | $l_list \ |
| 171 | -Wl,--warn-common \ | 171 | -Wl,--warn-common \ |
| @@ -187,7 +187,7 @@ else | |||
| 187 | -o $EXE \ | 187 | -o $EXE \ |
| 188 | -Wl,--sort-common \ | 188 | -Wl,--sort-common \ |
| 189 | $SORT_SECTION \ | 189 | $SORT_SECTION \ |
| 190 | $GC_SECTION \ | 190 | $GC_SECTIONS \ |
| 191 | -Wl,-T -Wl,busybox_ldscript \ | 191 | -Wl,-T -Wl,busybox_ldscript \ |
| 192 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | 192 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ |
| 193 | $l_list \ | 193 | $l_list \ |
| @@ -243,7 +243,7 @@ if test "$CONFIG_FEATURE_SHARED_BUSYBOX" = y; then | |||
| 243 | -o $EXE \ | 243 | -o $EXE \ |
| 244 | -Wl,--sort-common \ | 244 | -Wl,--sort-common \ |
| 245 | $SORT_SECTION \ | 245 | $SORT_SECTION \ |
| 246 | $GC_SECTION \ | 246 | $GC_SECTIONS \ |
| 247 | -Wl,--start-group $O_FILES -Wl,--end-group \ | 247 | -Wl,--start-group $O_FILES -Wl,--end-group \ |
| 248 | -L"$sharedlib_dir" -lbusybox \ | 248 | -L"$sharedlib_dir" -lbusybox \ |
| 249 | -Wl,--warn-common \ | 249 | -Wl,--warn-common \ |
| @@ -282,7 +282,7 @@ int main(int argc, char **argv) | |||
| 282 | -o $EXE \ | 282 | -o $EXE \ |
| 283 | -Wl,--sort-common \ | 283 | -Wl,--sort-common \ |
| 284 | $SORT_SECTION \ | 284 | $SORT_SECTION \ |
| 285 | $GC_SECTION \ | 285 | $GC_SECTIONS \ |
| 286 | -L"$sharedlib_dir" -lbusybox \ | 286 | -L"$sharedlib_dir" -lbusybox \ |
| 287 | -Wl,--warn-common \ | 287 | -Wl,--warn-common \ |
| 288 | || { | 288 | || { |
