Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Oct 1995 08:52:00 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        ache@astral.msk.su, j@uriah.heep.sax.de
Cc:        hackers@freefall.freebsd.org, kaleb@x.org
Subject:   Re: A couple problems in FreeBSD 2.1.0-950922-SNAP
Message-ID:  <199510152252.IAA32542@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> Did you setenv ENABLE_STARTUP_LOCALE before calling ls?
>> See environ(7) (-current).

>IMHO, the base utilities that use <ctype.h> should properly initialize
>the locale instead of relying on that hack.  (The hack is useful to
>force programs that don't like to handle locale's, but base utilities
>of the system are expected to do it right theirselves.)

BTW, this hack adds 24K to the size of a minimal statically linked
program `main() {}' and defeats the point of most of the specially named
routines in crt0.c.  E.g., there is a special version of getenv() named
_getenv() to avoid the namespace pollution and bloat from getenv(), but
the hack calls getenv() anyway; there are special versions of read() and
write(), but _startup_setlocale() references things in stdio that reference
read() and write().

atexit() support adds another 28K.  Less for real programs of course.
The bloat is really in libc, where almost everything references too many
other things.

Bruce

echo 'main() {}' >z0.c
echo 'main() {} getenv() {} _startup_setlocale() {}' >z1.c
echo 'main() {} getenv() {} _startup_setlocale() {} atexit() {}' >z2.c
for i in 0 1 2; do cc -O -o z$i z$i.c -static -s; done
ls -l z0 z1 z2



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510152252.IAA32542>