Page MenuHomeFreeBSD

Use -Oz/-Os for all loader/stand builds.
ClosedPublic

Authored by imp on Aug 15 2018, 3:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 19, 9:36 PM
Unknown Object (File)
Tue, Mar 19, 5:16 PM
Unknown Object (File)
Mon, Mar 11, 9:20 AM
Unknown Object (File)
Mon, Mar 11, 9:20 AM
Unknown Object (File)
Mon, Mar 11, 9:20 AM
Unknown Object (File)
Mon, Mar 11, 9:20 AM
Unknown Object (File)
Thu, Mar 7, 11:09 PM
Unknown Object (File)
Dec 23 2023, 5:38 AM
Subscribers

Details

Summary
While we're not super size constrained, the x86 BIOS /boot/loader has
to be less than about 520k-530k to be reliable. The LUA loader is at
this size today. -Os saves about 15% on the size, keeping us safely
small enough. This will also help with sjg's work on bringing in
bearssl, though we may again be looking for space in the LUA loader.

Size table for clang 6.0.0:
            default -Os     -Oz     -O1

loader_4th 442368 389120 376832 417792
loader_lua 524288 446464 430080 479232

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

-Oz is even better, but clang specific

imp retitled this revision from Use -Os for all loader builds. to Use -Oz/-Os for all loader/stand builds..Aug 15 2018, 4:33 PM
imp edited the summary of this revision. (Show Details)

Tested on my "build machine" (BIOS & MBR); no observed difference in behavior (from before the patch), so "does no harm" as far as I can tell so far.

I plan to test on my laptop (which actually had a boot failure this morning at r337834) later today.

I was remiss in failing to note that the change in question reduced the size of the loader from 516096 to 421888 bytes.

This revision is now accepted and ready to land.Aug 15 2018, 6:03 PM
This revision was automatically updated to reflect the committed changes.

OK; I tested on my laptop (while failed to boot using the Lua loader at r337834), and after applying the patch, issuing "make clean" in src/stand, and rebuilding/installing, the laptop booted OK. Prior to applying the patch, /boot/loader was 516096 bytes; the loader built after applying the patch is 421888 bytes.

Thanks!