trylink: gold may not support --sort-common (yet)
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
diff --git a/scripts/trylink b/scripts/trylink
index 8c88546..164f527 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -85,6 +85,9 @@
# The --sort-section option is not supported by older versions of ld
SORT_SECTION=`check_cc "-Wl,--sort-section,alignment" ""`
+# gold may not support --sort-common (yet)
+SORT_COMMON=`check_cc "-Wl,--sort-common" ""`
+
# Static linking against glibc produces buggy executables
# (glibc does not cope well with ld --gc-sections).
# See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
@@ -114,7 +117,7 @@
test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group"
try $CC $CFLAGS $LDFLAGS \
-o $EXE \
- -Wl,--sort-common \
+ $SORT_COMMON \
$SORT_SECTION \
$GC_SECTIONS \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
@@ -139,7 +142,7 @@
$debug && echo "Trying -l options: '$l_list'"
try $CC $CFLAGS $LDFLAGS \
-o $EXE \
- -Wl,--sort-common \
+ $SORT_COMMON \
$SORT_SECTION \
$GC_SECTIONS \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
@@ -171,7 +174,7 @@
if ! test -f busybox_ldscript; then
try $CC $CFLAGS $LDFLAGS \
-o $EXE \
- -Wl,--sort-common \
+ $SORT_COMMON \
$SORT_SECTION \
$GC_SECTIONS \
-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
@@ -193,7 +196,7 @@
# Hmm, "ld --sort-section alignment" should do it too.
try $CC $CFLAGS $LDFLAGS \
-o $EXE \
- -Wl,--sort-common \
+ $SORT_COMMON \
$SORT_SECTION \
$GC_SECTIONS \
-Wl,-T,busybox_ldscript \
@@ -228,7 +231,7 @@
-Wl,-z,combreloc \
-Wl,-soname="libbusybox.so.$BB_VER" \
-Wl,--undefined=lbb_main \
- -Wl,--sort-common \
+ $SORT_COMMON \
$SORT_SECTION \
-Wl,--start-group $A_FILES -Wl,--end-group \
$l_list \
@@ -249,7 +252,7 @@
EXE="$sharedlib_dir/busybox_unstripped"
try $CC $CFLAGS $LDFLAGS \
-o $EXE \
- -Wl,--sort-common \
+ $SORT_COMMON \
$SORT_SECTION \
$GC_SECTIONS \
-Wl,--start-group $O_FILES -Wl,--end-group \
@@ -288,7 +291,7 @@
EXE="$sharedlib_dir/$name"
try $CC $CFLAGS $LDFLAGS "$sharedlib_dir/applet.c" \
-o $EXE \
- -Wl,--sort-common \
+ $SORT_COMMON \
$SORT_SECTION \
$GC_SECTIONS \
-L"$sharedlib_dir" -lbusybox \