[PATCH] Static linking binaries with uClibc

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


On Thu, Feb 4, 2010 at 10:22 AM, Bernhard Reutner-Fischer
<rep.dot.nop at gmail.com> wrote:

Hi Bernhard,

> On Wed, Feb 03, 2010 at 09:07:03PM +0100, Bernhard Reutner-Fischer wrote:
>>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:
>
> I've attached a possible fix to the PR.

Thanks for working on this.

I think the patch goes a bit too far however. The problem is only with
symbols that are weak *and* hidden:

libc/misc/internals/__uClibc_main.c:extern void weak_function
_stdio_init(void) attribute_hidden;
libc/misc/internals/__uClibc_main.c:extern void weak_function
_locale_init(void) attribute_hidden;
libc/misc/internals/shared_flat_add_library.c:extern void _init(void)
attribute_hidden weak_function;
libc/misc/internals/shared_flat_add_library.c:extern void _fini(void)
attribute_hidden weak_function;
libc/stdlib/_atexit.c:extern void weak_function _stdio_term(void)
attribute_hidden;
libc/stdlib/abort.c:extern void weak_function _stdio_term(void)
attribute_hidden;

__pthread_initialize_minimal and __errno_location are not hidden so do
not need to be changed.

Also the changes to _stdio.c look like they should be in a separate patch.


More information about the uClibc mailing list