[BusyBox] uClibc: Can i exclude libgcc.a?
Wataru Nishida
wnishida at nbiochem.med.osaka-u.ac.jp
Sun Jan 21 09:47:32 UTC 2001
Hi Eric,
I appreciate the recent advancement in uClibc.
Thank you for your great exertion.
During test linking, i encountered the following situation.
When no % / * operators for (long long) values are used in a source,
do I still need libgcc.a or don't need it any more?
Here is a simple test program.
$ cat hello.c
#include <stdio.h>
#include <stdlib.h>
main() {
printf("Hello, this is uClibc!\n");
exit(123);
}
It can be successfully linked with uClibc and works fine.
After stripping, the file size is 3.3 KB.
$ gcc -s -nostdlib -luClibc -lgcc /usr/lib/crt0.o hello.c -o hello
$ ./hello ; echo $?
Hello, this is uClibc!
123
$ ls -l hello
-rwxr-xr-x 1 wnishida wnishida 3336 Jan 21 18:16 hello
On trial, I omitted the "-lgcc" option.
$ gcc -s -nostdlib -luClibc /usr/lib/crt0.o hello.c -o hello
/usr/lib/libuClibc.so: undefined reference to `__umoddi3'
/usr/lib/libuClibc.so: undefined reference to `__udivdi3'
collect2: ld returned 1 exit status
ld complained that there are no __umoddi3() and __udivdi3() functions.
i found that there are "unsigned long long % and /" operations
in stdlib/strto_ll.c and misc/internals/ulltostr.c.
Then, I modified stdlib/Makefile and misc/internals/Makefile to
exclude the two object files, and rebuilt libuClibc.
$ gcc -s -nostdlib -luClibc /usr/lib/crt0.o hello.c -o hello
$ ./hello ; echo $?
Hello, this is uClibc!
123
$ ls -l hello
-rwxr-xr-x 1 wnishida wnishida 1956 Jan 21 18:18 hello
NOTE: this command line does not include "-lgcc", but link
succeeds and it works fine. The code size is now 1.9 KB.
It's 1380 bytes reduction!
I want to know whether there are any other essential codes for uClibc
in libgcc.a.
Wataru Nishida
More information about the busybox
mailing list