Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Feb 2015 11:58:48 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Bryan Drewery <bdrewery@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov <kib@freebsd.org>
Subject:   Re: svn commit: r278889 - head/lib/libc/include
Message-ID:  <20150219113226.K2984@besplex.bde.org>
In-Reply-To: <54E52019.8080009@FreeBSD.org>
References:  <201502170854.t1H8s4TL085174@svn.freebsd.org> <54E52019.8080009@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 18 Feb 2015, Bryan Drewery wrote:

> On 2/17/2015 2:54 AM, Konstantin Belousov wrote:
>> ...
>> Log:
>>   Restore the extern qualifier on __cleanup.
>> ...
>> Modified: head/lib/libc/include/libc_private.h
>> ==============================================================================
>> --- head/lib/libc/include/libc_private.h	Tue Feb 17 08:50:26 2015	(r278888)
>> +++ head/lib/libc/include/libc_private.h	Tue Feb 17 08:54:03 2015	(r278889)
>> @@ -271,7 +271,7 @@ void _malloc_first_thread(void);
>>  /*
>>   * Function to clean up streams, called from abort() and exit().
>>   */
>> -void (*__cleanup)(void) __hidden;
>> +extern void (*__cleanup)(void) __hidden;
>>
>>  /*
>>   * Get kern.osreldate to detect ABI revisions.  Explicitly
>>
>
> Is this a NOP?

No, since this is a data declaration.  It would be a style bug on a
prototype.

BTW, the reason for existence of __cleanup() has been broken by malloc()
and other bloatware.  It is to avoid linking anything in stdio when
only exit() is used.  But crtso now links to malloc() and malloc()
links to stdio and much more.  When correctly (that is, statically)
linked, this bloats the size of a minimal C program from to 440K + 80K
symbols on amd64 and to 390K + 60K symbols on i386.  In FreeBSD-4 and
in my version of FreeBSD-5, __cleanup still works and the minimal C
program has size 2K + 1.5K symbols.  In FreeBSD-5, malloc() is
relatively unbloated, so crtso's linking to it costs only 9K + 9K
symbols instead of 400+K.  The same program written in asm takes about
10 bytes in all versions of FreeBSD-x86.  When dynamically linked,
__cleanup() has little effect.

Bruce



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