tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Trivial program size inflation



>> and built it -static.  size on the resulting binary:

>> sparc, my mutant 1.4T:

>> text    data    bss     dec     hex     filename
>> 12616   124     288     13028   32e4    main

>> amd64, my mutant 5.2:

>>    text	   data	    bss	    dec	    hex	filename
>>  152613	   4416	  16792	 173821	  2a6fd	main

>> amd64, 9.0_STABLE (ftp.n.o):

>>    text    data     bss     dec     hex filename
>>  562318   29064 2176416 2767798  2a3bb6 main

> What are the compiler (especially the linker) and compiler version on
> your 1.4T vs. 9.0?

1.4T (sparc):

[Sparkle] 188> /usr/bin/gcc --version
egcs-1.1.2
[Sparkle] 189> /usr/bin/ld --version 
GNU ld 2.9.1
Copyright 1997 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
  Supported emulations:
   sparcnbsd
   elf32_sparc
   sun4
[Sparkle] 190> 

5.2 (amd64):

[Backstop] 83> /usr/bin/gcc --version
gcc (GCC) 4.1.3 20080704 prerelease (NetBSD nb3 20111107)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Backstop] 84> /usr/bin/ld --version
GNU ld version 2.16.1
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
[Backstop] 85> 

9.0_STABLE (amd64, assuming nobody changed anything between my previous
runs and now):

% /usr/bin/gcc --version
gcc (nb4 20200810) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% /usr/bin/ld --version
GNU ld (NetBSD Binutils nb1) 2.31.1
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
% 

The 1.4T and 5.2 compilers are slightly mutant, but nothing I would
expect to affect this - I can describe my tweaks if you like.

> Having the obligation to support a myriad of systems for kerTeX, I
> have seen that, unfortunately, static linking is considered nowadays
> a second rate feature if not a deprecated one,

Curious, then, that it seems to be the preferred/only way for the
"cool" new languages, like Rust and, I'm told, Go....

> Other thing to look at: the so called i18n.  On NetBSD, iconv doesn't
> work with static linking, but could it be that its object are
> nonetheless added too?  As well as threading and so on?

Perhaps so, but why would iconv or threading be brought in for a
program that does nothing?  I'm sure _something_ is clearly being
brought in; I suppose my report is actually along the lines of
"something needs fixing; half a meg of libc (libgcc, whatever) to
support a program that does nothing seems excessive".

I did have a previous version which called printf, which I would expect
would pull in a bunch of stuff.  That version was about three times the
size on 1.4T; I don't recall trying it on 5.2 or 9.0_STABLE.  I then
cut it down to write(), then finally all the way to nothing at all.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index