# 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
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 \
$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 \
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 \
# 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 \
-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 \
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 \
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 \