Re: adding COPTS to shrink kernel binary size

Valery Ushakov <[email protected]>
Newsgroups gmane.os.netbsd.ports.vax,gmane.os.netbsd.devel.toolchain
Message-ID <Y974/[email protected]>
On Sun, Feb 05, 2023 at 08:55:53 +0900, Izumi Tsutsui wrote:

> One concern of using -Os is inline functions.
> 
> In netbsd-6 days, m68k ports also used -Os but I noticed some
> applications (especially mlterm-fb on slow luna68k framebuffers)
> were much slower (~30%) with -Os because inline functions were used
> as macro in loops for screen scroll rendering copy ops:
>  https://mail-index.netbsd.org/port-m68k/2014/06/22/msg000488.html

If they are intended to be always inlined, they should be declared
with the always_inline attribute.  -Os doesn't turn off inlining in
general, but since inlining usually does increase code size you need
to tell the compiler.  (E.g. sh3 kernel cache code does this b/c cache
must be accessed by code in uncached P2, so macro-like inline
functions must be inlined, or they will be called via their normal
addresses in the cached space.)

-uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.