[BusyBox] List of all libc things that BusyBox depends on?
vda
vda at port.imtp.ilyichevsk.odessa.ua
Mon Feb 2 13:20:46 UTC 2004
I am probably extremely stupid, but I can't understand
what's wrong with this seemingly simple problem:
From TODO:
==========
Run the following:
rm -f busybox && make LDFLAGS+=-nostdlib 2>&1 | \
sed -ne 's/.*undefined reference to `\(.*\)..*/\1/gp' | sort | uniq
reveals the list of all external (i.e., libc) things that BusyBox depends on.
It would be a very nice thing to reduce this list to an absolute minimum, to
reduce the footprint of busybox, especially when staticly linking with
libraries such as uClibc.
Surprisingly, I wasn't able to do this.
rm -f busybox
make LDFLAGS+=-nostdlib 2>&1 | tee ${0}_make.log
cat ${0}_make.log \
| sed -ne 's/.*undefined reference to `\(.*\)..*/\1/gp' \
| sort | uniq -c \
> $0.log
produced empty $0.log. ${0}_make.log contains only this:
gcc -nostdlib -o busybox -Wl,--start-group ./applets/applets.a
./archival/archival.a ./archival/libunarchive/libunarchive.a
./coreutils/coreutils.a ./console-tools/console-tools.a
./debianutils/debianutils.a ./editors/editors.a ./findutils/findutils.a
./init/init.a ./miscutils/miscutils.a ./modutils/modutils.a
./networking/networking.a ./networking/libiproute/libiproute.a
./networking/udhcp/udhcp.a ./procps/procps.a ./loginutils/loginutils.a
./shell/shell.a ./sysklogd/sysklogd.a ./util-linux/util-linux.a
./libpwdgrp/libpwdgrp.a ./coreutils/libcoreutils/libcoreutils.a
./libbb/libbb.a -lcrypt -Wl,--end-group
/usr/sbin/ld: warning: cannot find entry symbol _start; not setting start
address
strip --remove-section=.note --remove-section=.comment busybox
Okay. I run normal busybox make, captured last gcc invocation,
and removed -lc from it:
/usr/lib/gcc-lib/i386-pc-linux-gnu/3.2/collect2 -m elf_i386 -dynamic-linker
/lib/ld-linux.so.2 -o busybox /usr/lib/crt1.o /usr/lib/crti.o /usr
/lib/gcc-lib/i386-pc-linux-gnu/3.2/crtbegin.o
-L/usr/lib/gcc-lib/i386-pc-linux-gnu/3.2
-L/usr/lib/gcc-lib/i386-pc-linux-gnu/3.2/../../.. --start-group
./applets/applets.a ./archival/archival.a
./archival/libunarchive/libunarchive.a ./coreutils/coreutils.a
./console-tools/console-tools.a ./debianutils/debianutils.a
./editors/editors.a ./findutils/findutils.a ./init/init.a
./miscutils/miscutils.a ./modutils/modutils.a ./networking/networking.a
./networking/libiproute/libiproute.a ./networking/udhcp/udhcp.a
./procps/procps.a ./loginutils/loginutils.a ./shell/shell.a
./sysklogd/sysklogd.a ./util-linux/util-linux.a ./libpwdgrp/libpwdgrp.a
./coreutils/libcoreutils/libcoreutils.a ./libbb/libbb.a -lcrypt --end-group
-lgcc -lgcc_eh -lgcc -lgcc_eh /usr/lib/gcc-lib/i386-pc-linux-gnu/3.2/crtend.o
/usr/lib/crtn.o
This results in:
./coreutils/coreutils.a(cp.o): In function `cp_main':
cp.o(.text+0xb0): undefined reference to `stat64'
cp.o(.text+0xb7): undefined reference to `lstat64'
./coreutils/coreutils.a(install.o): In function `install_main':
install.o(.text+0x163): undefined reference to `lstat64'
./networking/udhcp/udhcp.a(pidfile.o): In function `pidfile_acquire':
pidfile.o(.text+0x60): undefined reference to `atexit'
./procps/procps.a(top.o): In function `top_main':
top.o(.text+0xa46): undefined reference to `atexit'
./shell/shell.a(cmdedit.o): In function `cmdedit_init':
cmdedit.o(.text+0x420): undefined reference to `atexit'
./util-linux/util-linux.a(more.o): In function `more_main':
more.o(.text+0x352): undefined reference to `atexit'
./coreutils/libcoreutils/libcoreutils.a(cp_mv_stat.o): In function
`cp_mv_stat':
cp_mv_stat.o(.text+0x51): undefined reference to `stat64'
collect2: ld returned 1 exit status
this does not look ok. Only 3 functions from libc??
Where is printf?
PS. Tried with both static and dynamic busybox builds...
--
vda
More information about the busybox
mailing list