binutils
Binutils guides you through GNU's binary manipulation toolkit for static library management, debug info handling, address-to-source mapping, and symbol demangling. Master ar for archives, strip and objcopy for binary processing, addr2line for crash analysis, and c++filt for C++ symbol names.
Binutils helps you manipulate compiled binaries using GNU tools for libraries, stripping, and crash analysis.
AI-generated summary based on this skill's SKILL.md
Install
mohitmishra786/low-level-dev-skills/binutils · repository language: JavaScript
git clone https://github.com/mohitmishra786/low-level-dev-skills
cp -r low-level-dev-skills/skills/binaries/binutils ~/.claude/skills/binutilsnpx skillfed install mohitmishra786/low-level-dev-skills/binutilsFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I create a static library with ar?
Binutils' ar command packages object files into static libraries. Use `ar rcs libname.a file1.o file2.o` to create or update an archive, where 'r' replaces members, 'c' creates if needed, and 's' writes a symbol index. After creating the library, run `ranlib libname.a` to rebuild the symbol index for faster linking, or use ar's 's' flag to do it in one step.
How can I strip debug info from a binary?
Binutils provides two main approaches. The `strip` command removes all non-essential sections: `strip binary` produces a minimal executable. For finer control, use `objcopy --strip-debug binary stripped-binary` to remove only debug symbols while keeping other metadata, or `objcopy --strip-all` for complete stripping. This reduces file size significantly for production deployments.
How do I convert a crash address to source code line number?
Binutils' addr2line tool maps memory addresses back to source locations. Run `addr2line -e binary 0xaddress` to find the file and line number. For batch processing multiple addresses, pipe them to addr2line or use `addr2line -e binary < addresses.txt`. Ensure the binary retains debug symbols (compiled with -g) for accurate results.
How can I demangle C++ symbol names?
Binutils' c++filt utility decodes mangled C++ symbols. Use `c++filt _ZN3FooC1Ev` to display the readable function signature, or pipe symbol names: `echo '_ZN3FooC1Ev' | c++filt`. This is essential for analyzing compiled C++ binaries, crash dumps, and linker errors where symbols appear in their mangled form.
What does objcopy do for separating debug symbols?
Binutils' objcopy extracts debug information into separate files. Use `objcopy --only-keep-debug binary debug.sym` to create a debug file, then `objcopy --strip-debug binary` to remove debug from the original. Link them with `objcopy --add-gnu-debuglink=debug.sym binary`, allowing debuggers to find symbols without bloating the executable.
How do I extract strings from a compiled binary?
Binutils' strings command lists all printable text sequences embedded in a binary. Run `strings binary` to display human-readable strings, or `strings -n 8 binary` to show only strings at least 8 characters long. This helps identify configuration values, error messages, and other embedded text useful for reverse engineering and security analysis.
SKILL.md
rendered from the published skill — quoted content, verbatim
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
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 2 files
skills/binaries/binutils/SKILL.md
skills/binaries/binutils/references/cheatsheet.md