From owner-svn-src-head@FreeBSD.ORG Thu Feb 19 00:58:57 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8EA9F9B6; Thu, 19 Feb 2015 00:58:57 +0000 (UTC) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 4EAAEE1D; Thu, 19 Feb 2015 00:58:57 +0000 (UTC) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 26CAB7827C1; Thu, 19 Feb 2015 11:58:49 +1100 (AEDT) Date: Thu, 19 Feb 2015 11:58:48 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bryan Drewery Subject: Re: svn commit: r278889 - head/lib/libc/include In-Reply-To: <54E52019.8080009@FreeBSD.org> Message-ID: <20150219113226.K2984@besplex.bde.org> References: <201502170854.t1H8s4TL085174@svn.freebsd.org> <54E52019.8080009@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=A5NVYcmG c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=-bqlIzqZ-nb7rq5Px1YA:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Konstantin Belousov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Feb 2015 00:58:57 -0000 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