summaryrefslogtreecommitdiff
path: root/scripts/trylink
diff options
context:
space:
mode:
authorDenis Vlasenko2007-10-07 20:46:34 +0000
committerDenis Vlasenko2007-10-07 20:46:34 +0000
commitd62fd84d4b309bc5fa6548288b82f21189d4f53f (patch)
tree323ecf50e92a496908b6749c1e0cc41a0669d8c3 /scripts/trylink
parent7930bcf7368e42b327b2a234f4e1be897fc25b1d (diff)
downloadbusybox-d62fd84d4b309bc5fa6548288b82f21189d4f53f.zip
busybox-d62fd84d4b309bc5fa6548288b82f21189d4f53f.tar.gz
libbusybox: move (possibly compressed) help stuff into libbusybox.
Makes individual binaries much smaller.
Diffstat (limited to 'scripts/trylink')
-rwxr-xr-xscripts/trylink39
1 files changed, 9 insertions, 30 deletions
diff --git a/scripts/trylink b/scripts/trylink
index a87d672..e756461 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -128,6 +128,7 @@ if test "$CONFIG_BUILD_LIBBUSYBOX" = y; then
exit 1
}
strip -s --remove-section=.note --remove-section=.comment $EXE -o "$sharedlib_dir/libbusybox.so.$BB_VER"
+ chmod a+x "$sharedlib_dir/libbusybox.so.$BB_VER"
echo "libbusybox: $sharedlib_dir/libbusybox.so.$BB_VER"
fi
@@ -160,41 +161,15 @@ if test "$CONFIG_FEATURE_INDIVIDUAL" = y; then
test x"$cname" = "x[[" && cname=test
echo "\
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include \"../include/autoconf.h\"
-#include \"../include/usage.h\"
-
-#ifdef __GLIBC__
-/* Make it reside in R/W memory: */
-int *const bb_errno __attribute__ ((section (\".data\")));
-#endif
+void bbox_prepare_main(void);
+int $main(int argc, char **argv);
const char *applet_name = \"$name\";
-void bb_show_usage(void)
-{
- fprintf(stderr, \"Usage: $name \"
-#ifdef ${cname}_trivial_usage
- ${cname}_trivial_usage
-#endif
-#ifdef ${cname}_full_usage
- \"\\n\\n\" ${cname}_full_usage
-#endif
- \"\\n\\n\");
- exit(1);
-}
-
-int $main(int argc, char **argv);
-
int main(int argc, char **argv)
{
-#ifdef __GLIBC__
- (*(int **)&bb_errno) = __errno_location();
-#endif
- return $main(argc, argv);
+ bbox_prepare_main();
+ return $main(argc, argv);
}
" >"$sharedlib_dir/applet.c"
@@ -215,3 +190,7 @@ int main(int argc, char **argv)
done <applet.lst
fi
+
+# libbusybox.so is needed only for -lbusybox at link time,
+# it is not needed at runtime. Deleting to reduce confusion.
+rm "$sharedlib_dir"/libbusybox.so >/dev/null