Hi,

In its current implementation, free() needs to call malloc_getpagesize
once in order to determine the size of a page (most commonly 4K, but
ultimately architecture/CPU model-dependent). Thus malloc_getpagesize
calls code to detect it at load: problem: currently this routine is
sysconf(_SC_PAGESIZE). Despite this basically immediately collapsing
to a call to getpagesize() internally in sysconf.c, followed by a
break and a return, the linker is unable to actually optimize
statically linking in the relevant portions of sysconf(), as it cannot
tell that you don't need all of sysconf() and its associated API
helper functions, linking in about 5K worth of garbage code, which is
sort of annoying.

The way I patched it is by making malloc_getpagesize refer directly to
__getpagesize(), which seems to be exactly the way that it's done
internally in sysconf() anyway, and I have not had any issues with
this, despite running a lot of software under it since, so I've
decided to forward the patch here.

Comments?

-Peter

Attachment: getpagesize.diff
Description: Binary data

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to