Date: Tue, 8 Oct 2002 01:00:02 -0700 (PDT) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/43810: 'echo' is too big Message-ID: <200210080800.g988023c018716@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/43810; it has been noted by GNATS.
From: Bruce Evans <bde@zeta.org.au>
To: Tim Kientzle <kientzle@acm.org>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/43810: 'echo' is too big
Date: Tue, 8 Oct 2002 18:04:44 +1000 (EST)
On Mon, 7 Oct 2002, Tim Kientzle wrote:
> >Description:
> Compiled, statically linked, and stripped, 'echo' is
> over 40k!! A few space-conscious edits reduce that
> to just over 5k.
I don't approve of hacking on individual utilities to work around
bloated libraries, but note that sync(1) is enormously bloated in
-current and this can be "fixed" by writing it in assembler:
%%%
/* sync.S */
#include <sys/syscall.h>
.globl _start
_start:
movl $SYS_sync,%eax
int $0x80
movl $SYS_exit,%eax
int $0x80
%%%
Note that this is fully bug for bug compatibile with sync.c: it has the
same error checking (none).
sync(1) has been bloated from about 6k (?) in RELENG_4 to 16K in -current.
This compares unfavourably with the 14 bytes for the above version. Fixing
the main causes of sync's bloat in libc only reduced it to 3K (still 224
times larger than the above). Most of 13K library debloating for sync only
helps for rare programs that don't use malloc() or sys_errlist[]. Even
"main() {}" now uses malloc() because atexit() uses it unconditionally and
crt1 uses atexit() unconditionally (to do nothing for "main() {}"). This
is recent bloat. sys_errlist[] is always used for stupider reasons
(because syscalls reference errno, and sys_errlist[] in in the same
file as errno). This bloat came with elf. errno is in crt0 for aout.
Bruce
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210080800.g988023c018716>
