binutils — Claude Code skill for ar, strip, objcopy and addr2line
A skill that walks the agent through GNU binutils: static libraries, stripping, address-to-source mapping and C++ demangling. Useful for binary post-processing work.
npx skills add mohitmishra786/low-level-dev-skills --skill binutils -a claude-codeWhat binutils does
The skill covers the binutils toolset and hands the agent ready commands for common jobs. Static libraries come first: ar rcs to build one, listing and extracting members, deleting objects, rebuilding the symbol index with ranlib. For LTO archives it points at gcc-ar and gcc-ranlib, or llvm-ar, instead of plain ar. That detail matters — reach for plain ar on an LTO archive and the symbol index comes out wrong.
Then strip and objcopy. One removes debug info, the other splits a binary from its .debug file, links the two with --add-gnu-debuglink, converts output formats, adds or removes sections, and embeds a file as a symbol. addr2line turns a crash address into a file and line, c++filt decodes mangled C++ names, strings pulls printable text with offsets. There is a short readelf and objdump reference plus a cross-toolchain section using target prefixes like aarch64-linux-gnu-strip.
One constraint is worth knowing up front: addr2line needs debug info. Build without -g and it returns nothing useful, so keep the unstripped binary or a separate .debug file around. A full command cheatsheet ships in references/cheatsheet.md.
What it helps with
- build a static library from object files
- shrink a binary while keeping a separate debug file
- map a crash address back to a source line
- demangle a C++ symbol name
- pull version or copyright text out of a binary
Example prompts for the agent
- build libfoo.a from foo.o, bar.o and baz.o
- split the debug info out of prog and link it back
- I have address 0x400a12 from a crash — find the function and source line
How to install binutils
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill binutils -a claude-code2Manually: put the files in place
~/.claude/skills/binutils/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/binutils/
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill binutils -a codex2Manually: put the files in place
.agents/skills/binutils/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill binutils -a cursor2Manually: put the files in place
.cursor/skills/binutils/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install mohitmishra786/low-level-dev-skills binutils2Manually: put the files in place
.github/skills/binutils/SKILL.md1Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill binutils -a gemini-cli2Platform CLI
gemini skills install https://github.com/mohitmishra786/low-level-dev-skills --path skills/binaries/binutilsManually: put the files in place
.devin/skills/binutils/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill binutils -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about binutils
How do I install binutils in Claude?
Run npx skills add mohitmishra786/low-level-dev-skills --skill binutils -a claude-code; the skill file lands at ~/.claude/skills/binutils/SKILL.md.
What does the binutils skill do?
It gives the agent commands for binary work: ar for static libraries, strip and objcopy for processing, addr2line for addresses, strings for text, c++filt for C++ names.
Why does addr2line return no source line?
It needs debug info. Compile with -g, and for a stripped binary keep the unstripped copy or a .debug file next to it.
Source text
SKILL.md · MIT
---
name: binutils
description: GNU binutils skill for binary manipulation and analysis. Use when using ar for static libraries, strip or objcopy for binary processing, addr2line for converting addresses to source locations, strings for text extraction, or c++filt for C++ name demangling. Activates on queries about ar, strip, objcopy, addr2line, strings, c++filt, ranlib, or binary post-processing tasks.
---
# GNU Binutils
## Purpose
Guide agents through the binutils toolset for binary manipulation: static libraries, stripping, address-to-source mapping, and symbol demangling.
## Triggers
- "How do I create a static library?"
- "How do I strip a binary but keep a debug file?"
- "I have an address from a crash — how do I find the source line?"
- "How do I demangle a C++ symbol name?"
- "How do I extract/replace sections in a binary?"
## Workflow
### 1. `ar` — static library management
```bash
# Create static library
ar rcs libfoo.a foo.o bar.o baz.o
# List contents
ar t libfoo.a
# Extract an object
ar x libfoo.a foo.o
# Add/replace an object
ar r libfoo.a newbar.o
# Delete an object
ar d libfoo.a oldbar.o
# Show symbol index
nm libfoo.a
# Rebuild symbol index (after modifying archive externally)
ranlib libfoo.a
```
For LTO archives: use `gcc-ar`/`gcc-ranlib` or `llvm-ar` instead of plain `ar`.
### 2. `strip` — remove debug info
```bash
# Strip all debug info (reduce binary size)
strip --strip-all prog
# Strip only debug sections (keep symbol table)
strip --strip-debug prog
# Strip unneeded symbols (keep needed for linking)
strip --strip-unneeded prog
# In-place
strip prog
# To a new file
strip -o prog.stripped prog
```
### 3. `objcopy` — binary section manipulation
```bash
# Separate debug info from binary
objcopy --only-keep-debug prog prog.debug
objcopy --strip-debug prog
# Add debuglink (GDB finds prog.debug automatically)
objcopy --add-gnu-debuglink=prog.debug prog
# Convert binary to another format
objcopy -O binary prog prog.bin # raw binary (embedded)
objcopy -O srec prog prog.srec # Motorola S-record
# Add a section from a file
objcopy --add-section .resources=data.bin prog
# Remove a section
objcopy --remove-section .comment prog
# Change section flags
objcopy --set-section-flags .data=alloc,contents,load,readonly prog
# Embed a binary file as a symbol
objcopy -I binary -O elf64-x86-64 \
--rename-section .data=.rodata,alloc,load,readonly,data,contents \
data.bin data.o
# Then link data.o; access via _binary_data_bin_start / _binary_data_bin_end
```
### 4. `addr2line` — address to source
```bash
# Convert a crash address to source:line
addr2line -e prog -f 0x400a12
# Output:
# my_function
# /home/user/src/main.c:42
# Multiple addresses
addr2line -e prog -f 0x400a12 0x400b34 0x400c56
# Inline frames (-i)
addr2line -e prog -f -i 0x400a12
# Common use: pipe from backtrace output
cat crash.log | grep '0x[0-9a-f]' | grep -o '0x[0-9a-f]*' | \
addr2line -e prog -f -i
```
Requires the binary to have debug info (compiled with `-g`). For stripped binaries, use the unstripped version or a `.debug` file.
### 5. `c++filt` — demangle C++ symbols
```bash
# Demangle a single symbol
c++filt _ZN3foo3barEv
# Output: foo::bar()
# Demangle from nm output
nm prog | c++filt
# Demangle from crash log
cat crash.log | c++filt
```
Alternative: `nm -C prog` (demangle directly in nm).
### 6. `strings` — extract printable strings
```bash
strings prog # all strings >= 4 chars
strings -n 8 prog # minimum length 8
strings -t x prog # with offset (hex)
strings -t d prog # with offset (decimal)
# Search for specific strings
strings prog | grep "version"
strings prog | grep "Copyright"
```
### 7. `readelf` and `objdump` quick reference
(Full coverage in `skills/binaries/elf-inspection`)
```bash
# Symbol lookup for crash address (alternative to addr2line)
objdump -d -M intel prog | grep -A5 "400a12:"
# Find which object file defines a symbol
objdump -t prog | grep my_function
```
### 8. Cross-binutils
For cross-compilation, use the target-prefixed versions:
```bash
aarch64-linux-gnu-strip prog
aarch64-linux-gnu-objcopy --only-keep-debug prog prog.debug
aarch64-linux-gnu-addr2line -e prog 0x400a12
arm-none-eabi-nm libfirmware.a
```
For a complete command cheatsheet covering all tools (ar, strip, objcopy, addr2line, strings, c++filt), see [references/cheatsheet.md](references/cheatsheet.md).
## Related skills
- Use `skills/binaries/elf-inspection` for `readelf`, `nm`, `ldd`, `objdump` inspection
- Use `skills/binaries/linkers-lto` for linker flags and LTO
- Use `skills/debuggers/core-dumps` for debug file management with `objcopy --add-gnu-debuglink`
© mohitmishra786 · MIT · mohitmishra786/low-level-dev-skills