nx_size.nx
buildroot/runtime/nx_size.nx
about
nx_size.nx -- sovereign `size` tool (binutils equivalent).
Reports section sizes in the standard sysv format:
text data bss dec hex filename
1024 256 512 1792 0x700 my_program.elf
'text' = ALLOCATED + EXECUTABLE bytes (.text + .rodata)
'data' = ALLOCATED + WRITABLE bytes (.data)
'bss' = ALLOCATED + NOBITS bytes (.bss)
'dec' = sum
'hex' = same in hex
Useful for tracking binary bloat over commits + verifying that
stripping or DCE actually shrank what we expected.
Pairs with nx_objdump / nx_nm / nx_readelf as the size-focused
inspection tool.
dependencies 3 imports · 0 importers
imports: syscalls.nxnx_elf_read.nxnx_strfmt.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 38 | struct NxSizeReport |
consts
| 29 | const NX_MAGIC_1024: i64 = 1024 |
| 32 | const NX_SIZE_SHF_WRITE: i64 = 0x1 |
| 33 | const NX_SIZE_SHF_ALLOC: i64 = 0x2 |
| 34 | const NX_SIZE_SHF_EXECINSTR: i64 = 0x4 |
| 36 | const NX_SIZE_SHT_NOBITS: i64 = 8 |
| 44 | const NX_SIZE_REPORT_BYTES: i64 = 24 |
functions
| 46 | func nx_size_report(buf: *u8, len: i64) -> *NxSizeReport |
| 82 | func nx_size_print(buf: *u8, len: i64, fname: *u8, fd: i64) -> i64 |
| 102 | func main() -> i64 calls 1: nx_size_report |