diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-15 14:52:26 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-15 14:52:26 +0200 |
commit | 367a55c7d7e31a8162e795edc343277f8eb35f38 (patch) | |
tree | eca33efbb4d1b4b83e59854a288aecc5fd622474 | |
parent | 8ea061eac3207e5901bbe6032530e64d053df837 (diff) | |
download | busybox-w32-367a55c7d7e31a8162e795edc343277f8eb35f38.tar.gz busybox-w32-367a55c7d7e31a8162e795edc343277f8eb35f38.tar.bz2 busybox-w32-367a55c7d7e31a8162e795edc343277f8eb35f38.zip |
build system: FEATURE_LIBBUSYBOX_STATIC - try to pull libc/libm into libbusybox
It variously fails with different toolchains I tried...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | Config.in | 43 | ||||
-rwxr-xr-x | scripts/trylink | 18 |
2 files changed, 32 insertions, 29 deletions
@@ -386,29 +386,26 @@ config BUILD_LIBBUSYBOX | |||
386 | Build a shared library libbusybox.so.N.N.N which contains all | 386 | Build a shared library libbusybox.so.N.N.N which contains all |
387 | busybox code. | 387 | busybox code. |
388 | 388 | ||
389 | This feature allows every applet to be built as a tiny | 389 | This feature allows every applet to be built as a really tiny |
390 | separate executable. Enabling it for "one big busybox binary" | 390 | separate executable linked against the library: |
391 | approach serves no purpose and increases code size. | 391 | |
392 | You should almost certainly say "no" to this. | 392 | $ size 0_lib/l* |
393 | 393 | text data bss dec hex filename | |
394 | ### config FEATURE_FULL_LIBBUSYBOX | 394 | 939 212 28 1179 49b 0_lib/last |
395 | ### bool "Feature-complete libbusybox" | 395 | 939 212 28 1179 49b 0_lib/less |
396 | ### default n if !FEATURE_SHARED_BUSYBOX | 396 | 919138 8328 1556 929022 e2cfe 0_lib/libbusybox.so.1.N.M |
397 | ### depends on BUILD_LIBBUSYBOX | 397 | |
398 | ### help | 398 | This is useful on NOMMU systems which are not capable |
399 | ### Build a libbusybox with the complete feature-set, disregarding | 399 | of sharing executables, but are capable of sharing code |
400 | ### the actually selected config. | 400 | in dynamic libraries. |
401 | ### | 401 | |
402 | ### Normally, libbusybox will only contain the features which are | 402 | config FEATURE_LIBBUSYBOX_STATIC |
403 | ### used by busybox itself. If you plan to write a separate | 403 | bool "Pull in all external references into libbusybox" |
404 | ### standalone application which uses libbusybox say 'Y'. | 404 | default n |
405 | ### | 405 | depends on BUILD_LIBBUSYBOX |
406 | ### Note: libbusybox is GPL, not LGPL, and exports no stable API that | 406 | help |
407 | ### might act as a copyright barrier. We can and will modify the | 407 | Make libbusybox library independent, not using or requiring |
408 | ### exported function set between releases (even minor version number | 408 | any other shared libraries. |
409 | ### changes), and happily break out-of-tree features. | ||
410 | ### | ||
411 | ### Say 'N' if in doubt. | ||
412 | 409 | ||
413 | config FEATURE_INDIVIDUAL | 410 | config FEATURE_INDIVIDUAL |
414 | bool "Produce a binary for each applet, linked against libbusybox" | 411 | bool "Produce a binary for each applet, linked against libbusybox" |
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 | ||
92 | START_GROUP="-Wl,--start-group" | 92 | START_GROUP="-Wl,--start-group" |
93 | END_GROUP="-Wl,--end-group" | 93 | END_GROUP="-Wl,--end-group" |
94 | INFO_OPTS="-Wl,--warn-common -Wl,-Map,$EXE.map -Wl,--verbose" | 94 | INFO_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) |
97 | SORT_COMMON="-Wl,--sort-common" | 99 | SORT_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 |