tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
adding COPTS to shrink kernel binary size
Hi,
Currently vax GENERIC kernel is built with the default COPTS="-O2".
On the other hand, several m68k (and other) ports have
"-fno-unwind-tables" and "-fno-reorder-blocks" to shrink binary size.
I've tried these options and "-freorder-blocks-algorithm=simple"
that has been added since gcc 6 or 7 that gcc man page says:
>> -freorder-blocks-algorithm=algorithm
>> Use the specified algorithm for basic block reordering. The
>> algorithm argument can be simple, which does not increase code size
>> (except sometimes due to secondary effects like alignment), or stc,
>> the "software trace cache" algorithm, which tries to put all often
>> executed code together, minimizing the number of branches executed
>> by making extra copies of code.
It looks significantly reduce -current GENERIC kernel size:
---
default (COPTS="-O2")
> text data bss dec hex filename
> 3482718 101432 185756 3769906 398632 netbsd
makeoptions COPTS="-O2 -fno-unwind-tables"
> text data bss dec hex filename
> 3067628 101432 185756 3354816 3330c0 netbsd
makeoptions COPTS="-O2 -freorder-blocks-algorithm=simple"
> text data bss dec hex filename
> 3173462 101432 185756 3460650 34ce2a netbsd
makeoptions COPTS="-O2 -fno-unwind-tables -freorder-blocks-algorithm=simple"
> text data bss dec hex filename
> 2758370 101432 185756 3045558 2e78b6 netbsd
makeoptions COPTS="-O2 -fno-unwind-tables -fno-reorder-blocks"
> text data bss dec hex filename
> 2742510 101432 185756 3029698 2e3ac2 netbsd
---
I think it's reasonable to add -fno-unwind-tables and
-freorder-blocks-algorithm=simple for vax, but
I wonder if how many VAXen users has memory size issue.
I also wonder if we should add at least '-fno-unwind-tables"
to MI src/sys/conf/Makefile.kern.inc because no C++ exceptions
in kernel ops..
Thanks,
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index