[RFC] libm replacement for Busybox

Roberto A. Foglietta roberto.foglietta at gmail.com
Mon Oct 20 22:23:50 UTC 2008


2008/10/20 Rob Landley <rob at landley.net>:
> On Monday 20 October 2008 06:01:18 Roberto A. Foglietta wrote:
>>  Ability to set up the compile environment to static linking against
>> libm by CONFIG should nice too.
>
> You can already do that by removing libm.so from your toolchain's library path
> so it falls back to libm.a.  If you actually feel the need to do this, you
> probably know how.

 Many cases could arise (more or less common) for those removing
things are not a viable solution:

 a) toolchain could stay on an administrated server and remove things
are not possible
 b) toolchain could be useful to compile different projects and in
some of them lib.so is acceptable
 c) toolchain libraries is the run-time libraries also and it is
planned to move busybox in same $ARCH system but without libm.so

 Anybody could know how to statically link against libm.a using just a
bit of imagination:


[obvious]

 wget http://busybox.net/downloads/busybox-1.11.3.tar.bz2
 tar xvjf busybox-1.11.3.tar.bz2
 cd busybox-1.11.3
 make menuconfig
 make

[/obvious]

Final link with: m  <------!!!!

roberto at rafbook:~/gles/dl/busybox-1.11.3$ ldd busybox_unstripped
	linux-gate.so.1 =>  (0xb7f51000)
	libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7f19000) <------!!!!
	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7dca000)
	/lib/ld-linux.so.2 (0xb7f52000)

[not obvious]

 grep -rn "Final link with: " *
 scripts/trylink:163:echo "Final link with: ${LDLIBS:-<none>}"
 vi scripts/trylink
 :168 s,try,echo try,
 :wq
 rm -f busybox_unstripped
 make > ciao
 $(echo $(grep -e "^try " ciao | sed -e "s/^try //;s/-Wl,--start-group
-lm -Wl,--end-group//") /usr/lib/libm.a)

[/not obvious]

roberto at rafbook:~/gles/dl/busybox-1.11.3$ !ldd
ldd busybox_unstripped
	linux-gate.so.1 =>  (0xb7f43000)
	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7de1000)
	/lib/ld-linux.so.2 (0xb7f44000)

roberto at rafbook:~/gles/dl/busybox-1.11.3$ ./busybox_unstripped echo ciao
ciao


>
> I tend to wait for somebody to say "I personally want to do X" rather
> than "wouldn't it be nice if the build did X" to avoid adding infrastructure
> in search of a user, which never gets any real world testing.
>

 However adding a menuconfig option could show static linking against
libm.a as an _OBVIOUS_ way to avoid deploy the whole libm.so on the
target system. In this case, I think the problem is not "if we can do
it" but "how we can let be obvious to others doing such a thing". In
few words move a [not obvious] thing in the [obvious] domain.

 Cheers,
-- 
/roberto



More information about the busybox mailing list