On Thu, Jul 14, 2022 at 2:44 AM Sam Leffler
140KB was high (not sure where I got it as a debug build is 160KB):
$ readelf -lS kernel.elf There are 15 section headers, starting at offset 0x1a158:
Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .boot.text PROGBITS ff800000 001000 001dfe 00 AX 0 0 2 [ 2] .boot.rodata PROGBITS ff801dfe 002dfe 0000ca 00 A 0 0 2 [ 3] .text PROGBITS ff802000 003000 00d19a 00 AX 0 0 64 [ 4] .sdata PROGBITS ff80f19c 01019c 000004 00 WA 0 0 4 [ 5] .srodata PROGBITS ff80f1a0 0101a0 000010 00 A 0 0 4 [ 6] .rodata PROGBITS ff80f1b0 0101b0 0063d6 00 A 0 0 4 [ 7] ._idle_thread PROGBITS ff815600 016600 000200 00 WA 0 0 256 [ 8] .boot.bss PROGBITS ff815800 016800 00025c 00 WA 0 0 64 [ 9] .bss NOBITS ff815a5c 016a5c 0075ac 00 WA 0 0 4 [10] .riscv.attributes RISCV_ATTRIBUTE 00000000 016a5c 00002f 00 0 0 1 [11] .comment PROGBITS 00000000 016a8b 000012 01 MS 0 0 1 [12] .symtab SYMTAB 00000000 016aa0 001b90 10 13 95 4 [13] .strtab STRTAB 00000000 018630 001ab2 00 0 0 1 [14] .shstrtab STRTAB 00000000 01a0e2 000076 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), D (mbind), p (processor specific)
Elf file type is EXEC (Executable file) Entry point 0xff800000 There is 1 program header, starting at offset 52
Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x001000 0xff800000 0x28000000 0x15a5c 0x1d008 RWE 0x1000
Section to Segment mapping: Segment Sections... 00 .boot.text .boot.rodata .text .sdata .srodata .rodata ._idle_thread .boot.bss .bss
So a release build is 116KB at start and 108KB after boot completes (I wasn't considering the reclaiming of .boot sections). I built an image w/o CONFIG_PRINTING and got 84KB/76KB. As I noted before we have multiple kernel changes so this is likely in-line with your 56KB number. Regardless, these numbers are small compared to the rootserver. But thanks for making me look :)
Why isn't .boot.bss reclaimed? Can you point me in the direction of the .boot section reclaiming? (didn't immediately see it)
I think it was just an oversight in the linker script as the section is not explicitly listed in there. Likely because .boot.bss symbols are newer than the others. I added a change to include it: https://github.com/seL4/seL4/pull/882