diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/trylink | 39 |
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" |
132 | fi | 133 | fi |
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> | 164 | void bbox_prepare_main(void); |
164 | #include <unistd.h> | 165 | int $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: */ | ||
172 | int *const bb_errno __attribute__ ((section (\".data\"))); | ||
173 | #endif | ||
174 | 166 | ||
175 | const char *applet_name = \"$name\"; | 167 | const char *applet_name = \"$name\"; |
176 | 168 | ||
177 | void 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 | |||
190 | int $main(int argc, char **argv); | ||
191 | |||
192 | int main(int argc, char **argv) | 169 | int 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 |
217 | fi | 192 | fi |
193 | |||
194 | # libbusybox.so is needed only for -lbusybox at link time, | ||
195 | # it is not needed at runtime. Deleting to reduce confusion. | ||
196 | rm "$sharedlib_dir"/libbusybox.so >/dev/null | ||