[PATCH] Fix CFLAGS overwrite by Makefile

Arnaud Lacombe lacombar at gmail.com
Wed May 25 02:54:27 UTC 2011


Hi,

On Tue, May 24, 2011 at 4:41 PM, Dimitry Andric <dim at freebsd.org> wrote:
> Besides, for space-constrained things like boot2, you
> might not even be able to compile it when using non-standard settings,
> since the code might grow too large.
>
About the size, let's get some number

lib/libstand (library): (without -Os)
text data bss CPUTYPE
139696 4861 4160 i386
143212 4861 4160 i486
142491 4861 4160 i586
146893 4861 4160 i686
147145 4861 4160 <none>

lib/libstand (library): (with -Os, only enabled on pc98)
90386 4472 4160 i386
90381 4472 4160 i486
90381 4472 4160 i586
90369 4472 4160 i686
90387 4472 4160 <none>

sys/boot/i386/btx/lib/crt0.o is not affected size-wise by any of the
i[3456]86 CPUTYPE.

sys/boot/i386/boot2/boot2.out:
   text      data    bss    dec    hex CPUTYPE
   5024      29    1780    6833    1ab1 i386
   5024      29    1780    6833    1ab1 i486
   5024      29    1780    6833    1ab1 i586
   5004      29    1780    6813    1a9d i686
   5024      29    1780    6833    1ab1 <none>

sys/boot/i386/libi386 (library):
text data bss CPUTYPE
36168 13970 18658 i386
37419 13970 18658 i486
37483 13970 18658 i586
40073 13970 18658 i686
40137 13970 18658 <none>

sys/boot/ficl (library):
58245 4711 0 i386
61215 4711 0 i486
61183 4711 0 i586
70787 4711 0 i686
70851 4711 0 <none>

and finally:

sys/boot/i386/loader:
57853 556 452 i386
58755 556 452 i486
58783 556 452 i586
63631 556 452 i686
63695 556 452 <none>

So except for btx/crt0.o, the default setting generate the worst code size.

 - Arnaud

ps: for static library and loader, I derived the total size as the sum
of the size of the text/data/bss section of the member object using :

size *.o | awk 'BEGIN {text=0; data=0; bss=0;}; {text+=$1; data+=$2;
bss+=$3}; END {print text " " data " " bss " '$i'"}'

where $i is the cpu type to test. make(1) is passed either CPUTYPE=$i
for i in i[3456]86, or the empty string. The compiler used for the
test is gcc, and it is the compiler build during a buildworld stage,
in the tmp directory.

ps2: this was only a compile test. No code has been ran.


More information about the freebsd-current mailing list