CodeSizer: Why is that binary so big?
Summary
CodeSizer is a static code size profiling tool for embedded firmware that uses objdump and addr2line to attribute code size to inline call trees and generates an HTML report.
View Cached Full Text
Cached at: 07/20/26, 09:35 AM
Wren6991/CodeSizer
Source: https://github.com/Wren6991/CodeSizer
CodeSizer
Why is that binary so big?
What
CodeSizer is a static code size profiling tool.
In size-focused embedded firmware development, the final binary is heavily inlined and link-time-optimised. A single function symbol may cover dozens of inlinees. CodeSizer uses objdump and addr2line to unwind the inline call stack at every instruction address, so code size can be attributed to the correct node in the inline call tree within each function.
The output is a static HTML report file, with a small amount of JavaScript for UI features like toggling expand/collapse of the tree view.
How
From the interactive help:
usage: codesizer.py [-h] [--cross-prefix CROSS_PREFIX] [--section SECTION]
elf output
Analyse static code size of an ELF file. Disassemble via objdump, unwind inline
call stacks via addr2line, and emit a static HTML report.
positional arguments:
elf input ELF file
output output HTML file
options:
-h, --help show this help message and exit
--cross-prefix CROSS_PREFIX
prefix for objdump and addr2line (default: riscv32-unknown-
elf-)
--section, -j SECTION
Specify ELF section. Pass multiple times for multiple
sections. If unspecified, .text is used.
The correct toolchain must be present on your $PATH with the given prefix, or you must specify a full file path to the toolchain binaries. For example:
-
If you’ve installed the
gcc-arm-none-eabipackage on Ubuntu, then use--cross-prefix=arm-none-eabi-. -
If you’ve installed a
riscv-gnu-toolchainbuild at/opt/riscv/gcc15, then use--cross-prefix=/opt/riscv/gcc15/bin/riscv32-unknown-elf-.
Example Output
This HTML report was generated by the following command:
./codesizer.py --cross-prefix arm-none-eabi- arm-bootrom.elf arm-bootrom.html -j .text -j .secure_gateways
The ELF file comes from the RP2350 A4 bootrom release.
Similar Articles
Golfing Zig ELF Binaries (2025)
A technical deep-dive into reducing the size of Zig ELF binaries, starting from 2180K to under 500 bytes by stripping debug info, switching to ReleaseSmall, and using a freestanding target.
C programmers commit fresh crimes against readability
The 2025 International Obfuscated C Code Contest winners are announced, featuring 23 entries including Adrian Cable's Subleq computer emulator that enables software preservation through a one-instruction set architecture.
@vintcessun: Found a new approach: coding agent can be this lightweight. 16MB memory, 0% idle CPU, 26MB binary — these numbers are insane in the agent space. It's built with Rust, packing all standard tools, permission system, session management, and MCP into 17k LoC...
Zerostack is a minimal coding agent written in Rust, consuming only 16MB of memory and a 26MB binary. It achieves lightweight design through feature gates, supporting multiple providers and tools.
Scaling Test-Time Compute for Agentic Coding
A test-time scaling framework for agentic coding that compresses rollout trajectories into structured summaries and uses recursive voting/PDR to boost Claude-4.5-Opus to 77.6% on SWE-Bench Verified.
Every byte matters
This article explains the importance of understanding CPU cache lines and data structure layout for performance optimization in programming, using examples in Java and C. It discusses the overhead of unnecessary bytes and the trade-offs between Array of Structs and Struct of Arrays.