aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/trylink39
1 files changed, 9 insertions, 30 deletions
diff --git a/scripts/trylink b/scripts/trylink
index a87d67225..e756461c8 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -128,6 +128,7 @@ if test "$CONFIG_BUILD_LIBBUSYBOX" = y; then
128 exit 1 128 exit 1
129 } 129 }
130 strip -s --remove-section=.note --remove-section=.comment $EXE -o "$sharedlib_dir/libbusybox.so.$BB_VER" 130 strip -s --remove-section=.note --remove-section=.comment $EXE -o "$sharedlib_dir/libbusybox.so.$BB_VER"
131 chmod a+x "$sharedlib_dir/libbusybox.so.$BB_VER"
131 echo "libbusybox: $sharedlib_dir/libbusybox.so.$BB_VER" 132 echo "libbusybox: $sharedlib_dir/libbusybox.so.$BB_VER"
132fi 133fi
133 134
@@ -160,41 +161,15 @@ if test "$CONFIG_FEATURE_INDIVIDUAL" = y; then
160 test x"$cname" = "x[[" && cname=test 161 test x"$cname" = "x[[" && cname=test
161 162
162 echo "\ 163 echo "\
163#include <errno.h> 164void bbox_prepare_main(void);
164#include <unistd.h> 165int $main(int argc, char **argv);
165#include <stdlib.h>
166#include <stdio.h>
167#include \"../include/autoconf.h\"
168#include \"../include/usage.h\"
169
170#ifdef __GLIBC__
171/* Make it reside in R/W memory: */
172int *const bb_errno __attribute__ ((section (\".data\")));
173#endif
174 166
175const char *applet_name = \"$name\"; 167const char *applet_name = \"$name\";
176 168
177void bb_show_usage(void)
178{
179 fprintf(stderr, \"Usage: $name \"
180#ifdef ${cname}_trivial_usage
181 ${cname}_trivial_usage
182#endif
183#ifdef ${cname}_full_usage
184 \"\\n\\n\" ${cname}_full_usage
185#endif
186 \"\\n\\n\");
187 exit(1);
188}
189
190int $main(int argc, char **argv);
191
192int main(int argc, char **argv) 169int main(int argc, char **argv)
193{ 170{
194#ifdef __GLIBC__ 171 bbox_prepare_main();
195 (*(int **)&bb_errno) = __errno_location(); 172 return $main(argc, argv);
196#endif
197 return $main(argc, argv);
198} 173}
199" >"$sharedlib_dir/applet.c" 174" >"$sharedlib_dir/applet.c"
200 175
@@ -215,3 +190,7 @@ int main(int argc, char **argv)
215 190
216 done <applet.lst 191 done <applet.lst
217fi 192fi
193
194# libbusybox.so is needed only for -lbusybox at link time,
195# it is not needed at runtime. Deleting to reduce confusion.
196rm "$sharedlib_dir"/libbusybox.so >/dev/null