From 91570ce987ef93f9ba2fa663a5fee1bd2525a2ba Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 10 Jul 2014 12:34:23 -0700 Subject: Slim down static binaries by avoiding stdio. It's okay for a program to choose to drag in stdio, but it's unfortunate if even the minimal "int main() { return 42; }" drags in stdio... This brings the minimal static binary on ARM down from 78KiB to 46KiB. Given that we don't have a separate -lpthread it's not obvious to me that we can shave this down any further. I'm not sure whether this is a worthwhile change for that reason. (And the fact that dynamic binaries, the usual case, are unaffected either way.) Change-Id: I02f91dcff37d14354314a30b72fed2563f431c88 --- libc/stdlib/atexit.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'libc/stdlib') diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c index 05f2faa..e10238b 100644 --- a/libc/stdlib/atexit.c +++ b/libc/stdlib/atexit.c @@ -103,7 +103,7 @@ __cxa_atexit(void (*func)(void *), void *arg, void *dso) { struct atexit *p = __atexit; struct atexit_fn *fnp; - size_t pgsize = sysconf(_SC_PAGESIZE); + size_t pgsize = getpagesize(); int ret = -1; if (pgsize < sizeof(*p)) @@ -219,7 +219,7 @@ void __atexit_register_cleanup(void (*func)(void)) { struct atexit *p; - size_t pgsize = sysconf(_SC_PAGESIZE); + size_t pgsize = getpagesize(); if (pgsize < sizeof(*p)) return; @@ -248,4 +248,3 @@ __atexit_register_cleanup(void (*func)(void)) unlock: _ATEXIT_UNLOCK(); } - -- cgit v1.1