Denis,
older versions of gcc do not support the -Wl,--sort-section
option. The following patch to scripts/trylink handles this.
Is it ok that I commit it?
Index: scripts/trylink
===================================================================
--- scripts/trylink (revision 20409)
+++ scripts/trylink (working copy)
@@ -46,6 +46,14 @@
return $exitcode
}
+check_gcc() {
+ if $CC $1 -shared -o /dev/null -xc /dev/null > /dev/null 2>&1; then
+ echo "$1";
+ else
+ echo "$2";
+ fi
+}
+
EXE="$1"
CC="$2"
LDFLAGS="$3"
@@ -53,6 +61,9 @@
A_FILES="$5"
LDLIBS="$6"
+# The -Wl,--sort-section option is not supported by older versions of
gcc
+SORT_SECTION=`check_gcc "-Wl,--sort-section -Wl,alignment"`
+
# Sanitize lib list (dups, extra spaces etc)
LDLIBS=`echo "$LDLIBS" | xargs -n1 | sort | uniq | xargs`
@@ -64,7 +75,7 @@
try $CC $LDFLAGS \
-o $EXE \
-Wl,--sort-common \
- -Wl,--sort-section -Wl,alignment \
+ $SORT_SECTION \
-Wl,--gc-sections \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
$l_list \
@@ -88,7 +99,7 @@
try $CC $LDFLAGS \
-o $EXE \
-Wl,--sort-common \
- -Wl,--sort-section -Wl,alignment \
+ $SORT_SECTION \
-Wl,--gc-sections \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
$l_list
@@ -117,7 +128,7 @@
try $CC $LDFLAGS \
-o $EXE \
-Wl,--sort-common \
- -Wl,--sort-section -Wl,alignment \
+ $SORT_SECTION \
-Wl,--gc-sections \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
$l_list \
@@ -139,7 +150,7 @@
try $CC $LDFLAGS \
-o $EXE \
-Wl,--sort-common \
- -Wl,--sort-section -Wl,alignment \
+ $SORT_SECTION \
-Wl,--gc-sections \
-Wl,-T -Wl,busybox_ldscript \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
@@ -174,7 +185,7 @@
-Wl,-soname="libbusybox.so.$BB_VER" \
-Wl,--undefined=lbb_main \
-Wl,--sort-common \
- -Wl,--sort-section -Wl,alignment \
+ $SORT_SECTION \
-Wl,--start-group $A_FILES -Wl,--end-group \
$l_list \
-Wl,--warn-common \
@@ -195,7 +206,7 @@
try $CC $LDFLAGS \
-o $EXE \
-Wl,--sort-common \
- -Wl,--sort-section -Wl,alignment \
+ $SORT_SECTION \
-Wl,--gc-sections \
-Wl,--start-group $O_FILES -Wl,--end-group \
-L"$sharedlib_dir" -lbusybox \
@@ -234,7 +245,7 @@
try $CC $LDFLAGS "$sharedlib_dir/applet.c" \
-o $EXE \
-Wl,--sort-common \
- -Wl,--sort-section -Wl,alignment \
+ $SORT_SECTION \
-Wl,--gc-sections \
-L"$sharedlib_dir" -lbusybox \
-Wl,--warn-common \
///Peter
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox