X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=a4DR/ikRc5C6voOSRYVklA1Z+CfWstTtP+9lSnjAmr8=; b=y3f8RQFGuVa6NZvJyNevI/kgCNdWETdeEtYgiLjan3SRf2hrBIr9gU/8wBlvWnumBb N5zeukMr7grVyCXdUpunaLO8DHO5YexDvRCutbSCRazkC9nl+g9GoJHJyrQeLPft4TkK GOLgSqPSUd3AkG3lA71vqyX9hxxWI10Oj0z4rFYhhpRx8zrsJTKF7Wb77vCtbIBgZqg6 X6arBl2nuXssV5Ou+xndZ9+mFvh38TrhCGLA2bJ4EtAW2H50qd31Kr/UDC26VUDp1zTa iODJDdadSM3QNxo5/OYl7GpY7S/1lC6DHL3SIv305JnodZ10HInN/MO869+OMcETpAt1 w2KA== MIME-Version: 1.0 X-Received: by 10.42.20.6 with SMTP id e6mr31606791icb.29.1398118986605; Mon, 21 Apr 2014 15:23:06 -0700 (PDT) In-Reply-To: References: <53555BFD DOT 4000202 AT gmx DOT de> Date: Tue, 22 Apr 2014 01:23:06 +0300 Message-ID: Subject: Re: ctime.c changes add about 4.5k more size From: Ozkan Sezer To: djgpp-workers AT delorie DOT com Content-Type: text/plain; charset=UTF-8 Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 4/22/14, Rugxulo wrote: > Hi, > > On Mon, Apr 21, 2014 at 12:57 PM, Juan Manuel Guerrero > wrote: >> Am 21.04.2014 08:44, schrieb Ozkan Sezer: >> >>> Recent(ish) src/libc/ansi/time/ctime.c changes add about 4.5k more >>> size to the final stripped binary: >>> >>> #include >>> int main () { >>> return time(NULL); >>> } >>> >>> Linking against v2.04 from 2011-10-01 gives a 91648 bytes a.exe, >>> whereas linking against v2.04 from 2014-04-20 gives a 96256 bytes >>> a.exe. (not mentioning at all the crazy sizes themselves which is >>> irrelevant to the present case at hand.) A "return 0" instead of >>> a "return time(NULL)" yields a 52736 bytes exe, so ctime.c stuff >>> is adding about 43k size. >>> >>> time() calls gettimeofday() which calls 0x2c and 0x2a dos functions >>> and calls ctime.c::mktime() where the additional bloat happens. >>> >>> Is there no other way of reducing the code size here? > > Not automatically since COFF (nor PE/COFF) doesn't have proper support > for --gc-sections in GNU ld, last I heard. > >> The time zone database format has changed so that the original ctime >> code >> of djgpp (code before 2011-10-01) had to be replaced (aka ported) by the >> ctime code provided by time zone source code. >> >> If someone can optimize the ctime code for speed and size, that changes >> will >> always be welcome; but I do not think that optimization for size should >> be >> done sacrificing/removing time zone features that other users expect to >> be >> provided by djgpp. > > BTW, on a semi-related note, a few years ago I mentioned that mkdir() > was always pulling in ctime.o , so that will also make some apps even > bigger in size. The culprit (for that separate case) is apparently > xstat.c's _file_time_stamp(), which should probably be split into a > separate file entirely (ftstamp.c ?). > > http://www.delorie.com/djgpp/mail-archives/browse.cgi?p=djgpp-workers/2009/09/26/21:32:54 > > http://www.delorie.com/bin/cvsweb.cgi/djgpp/src/libc/posix/sys/stat/xstat.c > Another gem, yeah: mkdir() calling access() calling _is_executable() needing _djstat_flags existing in xstat.c beside _file_time_stamp(). Ugghhhh..