[PATCH] support kernels without __ARCH_WANT_SYSCALL_OFF_T

Rich Felker dalias at aerifal.cx
Mon Apr 30 15:43:15 UTC 2012


On Mon, Apr 30, 2012 at 01:27:15PM +0200, Laurent Bercot wrote:
>  Afterthought : it looks like the atexit() mechanism is pulling in a lot
> of stuff. I did the following to compare:
> 
> $ cat true2.c
> #include <unistd.h>
> int main (void)
> {
>   _exit(0) ;
> }
> 
> $ gcc -o true2 -static true2.c
> $ objdump -x true2 > true2.out
> 
>  The second objdump input, also in attachment, is much more reasonable
> and fits what I actually expect from an empty program. The true2 binary
> is 748 bytes, unstripped.
> 
>  So it seems that stdio is not pulled in when not needed; however,
> there is still a lot of bloat that does get pulled in. I would like
> to be able to simply return from main() instead of calling _exit() ;
> I never, ever use the atexit mechanism, and believe the linker should
> be able to figure that out (no explicit atexit, no stdio, no other
> registration mechanisms or constructors) and optimize all that stuff away.
>  In particular, if I simply return from main(), I would like to be
> certain that my single-threaded programs won't pull in pthread-enabled
> mechanisms.

Can you report your uClibc configuration? I'm nearly certain you have
locale disabled; if it's enabled, a lot more junk will be pulled in.

Also I don't understand how using _exit changes anything. The startup
code that calls main has a reference to exit (or equivalent code)
anyway and has no way of determining that you'll be calling _exit
early...

Rich


More information about the uClibc mailing list