aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/trylink18
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/trylink b/scripts/trylink
index 9f288c141..ba2d265bc 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -91,7 +91,9 @@ fi
91 91
92START_GROUP="-Wl,--start-group" 92START_GROUP="-Wl,--start-group"
93END_GROUP="-Wl,--end-group" 93END_GROUP="-Wl,--end-group"
94INFO_OPTS="-Wl,--warn-common -Wl,-Map,$EXE.map -Wl,--verbose" 94INFO_OPTS() {
95 echo "-Wl,--warn-common -Wl,-Map,$EXE.map -Wl,--verbose"
96}
95 97
96# gold may not support --sort-common (yet) 98# gold may not support --sort-common (yet)
97SORT_COMMON="-Wl,--sort-common" 99SORT_COMMON="-Wl,--sort-common"
@@ -194,7 +196,7 @@ if ! test -f busybox_ldscript; then
194 $GC_SECTIONS \ 196 $GC_SECTIONS \
195 $START_GROUP $O_FILES $A_FILES $END_GROUP \ 197 $START_GROUP $O_FILES $A_FILES $END_GROUP \
196 $l_list \ 198 $l_list \
197 $INFO_OPTS \ 199 `INFO_OPTS` \
198 || { 200 || {
199 cat $EXE.out 201 cat $EXE.out
200 exit 1 202 exit 1
@@ -225,7 +227,7 @@ else
225 -Wl,-T,busybox_ldscript \ 227 -Wl,-T,busybox_ldscript \
226 $START_GROUP $O_FILES $A_FILES $END_GROUP \ 228 $START_GROUP $O_FILES $A_FILES $END_GROUP \
227 $l_list \ 229 $l_list \
228 $INFO_OPTS \ 230 `INFO_OPTS` \
229 || { 231 || {
230 cat $EXE.out 232 cat $EXE.out
231 exit 1 233 exit 1
@@ -244,10 +246,14 @@ if test "$CONFIG_BUILD_LIBBUSYBOX" = y; then
244 } 246 }
245 ln -s "libbusybox.so.$BB_VER" "$sharedlib_dir"/libbusybox.so 2>/dev/null 247 ln -s "libbusybox.so.$BB_VER" "$sharedlib_dir"/libbusybox.so 2>/dev/null
246 248
249 # Yes, "ld -shared -static" is a thing. It's a shared library which is itself static.
250 LBB_STATIC=""
251 test "$CONFIG_FEATURE_LIBBUSYBOX_STATIC" = y && LBB_STATIC="-Wl,-static"
252
247 EXE="$sharedlib_dir/libbusybox.so.${BB_VER}_unstripped" 253 EXE="$sharedlib_dir/libbusybox.so.${BB_VER}_unstripped"
248 try $CC $CFLAGS $LDFLAGS \ 254 try $CC $CFLAGS $LDFLAGS \
249 -o $EXE \ 255 -o $EXE \
250 -shared -fPIC \ 256 -shared -fPIC $LBB_STATIC \
251 -Wl,--enable-new-dtags \ 257 -Wl,--enable-new-dtags \
252 -Wl,-z,combreloc \ 258 -Wl,-z,combreloc \
253 -Wl,-soname="libbusybox.so.$BB_VER" \ 259 -Wl,-soname="libbusybox.so.$BB_VER" \
@@ -256,7 +262,7 @@ if test "$CONFIG_BUILD_LIBBUSYBOX" = y; then
256 $SORT_SECTION \ 262 $SORT_SECTION \
257 $START_GROUP $A_FILES $END_GROUP \ 263 $START_GROUP $A_FILES $END_GROUP \
258 $l_list \ 264 $l_list \
259 $INFO_OPTS \ 265 `INFO_OPTS` \
260 || { 266 || {
261 echo "Linking $EXE failed" 267 echo "Linking $EXE failed"
262 cat $EXE.out 268 cat $EXE.out
@@ -277,7 +283,7 @@ if test "$CONFIG_FEATURE_SHARED_BUSYBOX" = y; then
277 $START_GROUP $O_FILES $END_GROUP \ 283 $START_GROUP $O_FILES $END_GROUP \
278 -L"$sharedlib_dir" -lbusybox \ 284 -L"$sharedlib_dir" -lbusybox \
279 $l_list \ 285 $l_list \
280 $INFO_OPTS \ 286 `INFO_OPTS` \
281 || { 287 || {
282 echo "Linking $EXE failed" 288 echo "Linking $EXE failed"
283 cat $EXE.out 289 cat $EXE.out