[PATCH] Static linking binaries with uClibc

Will Newton will.newton at gmail.com
Thu Feb 4 10:27:22 UTC 2010


On Wed, Feb 3, 2010 at 8:07 PM, Bernhard Reutner-Fischer
<rep.dot.nop at gmail.com> wrote:

Hi Bernhard,

> On Wed, Feb 03, 2010 at 04:21:29PM +0000, Will Newton wrote:
>>Hello,
>>
>>I have a problem with linking applications statically with uClibc but
>>without including the stdio functions. This issue has been brought up
>
> See http://bugs.uClibc.org/1033
> My theory (which is essentially size-neutral) goes like this, and yes,
> it's not pretty but seems to work for me:
> uClibc.org/~aldot/uClibc/bug1033.patch
>
> I suggest you compare size(1) of a static build of the testcase (with
> and without -DUSE_STDIO with your approach..

I'm sure your approach is smaller, but you are right, it's also not
particularly pretty. ;-)

I'm not convinced it is actually that important to have the weak
behaviour of _stdio_init, for a number of reasons:

  1. This has been broken for a long time (years?) and nobody cared to fix it.
  2. How many useful programs are capable of running without stdio?
The few that are probably do not
     form a complete system so should probably be combined with others
that do use stdio and so would
     benefit from linking shared anyway e.g. add busybox to your
systemn and you just lost.

locale_init is protected by a #ifdef anyway so why configure locales
on your tiny box and then not use them? It would seem a strange setup.

IMO this weak stuff is a holdover from the old days of ELKS etc., I'm
not sure if it really is that useful any more.

That said, I don't particularly mind how this is fixed. If you are
happy to maintain that solution then it does look like it would fix
the problem.


More information about the uClibc mailing list