elf-inspection — скилл для Claude Code: разбор ELF-бинарников
Ведёт агента по readelf, objdump, nm и ldd: зависимости, символы, секции, отладочная информация и ошибки линковки.
npx skills add mohitmishra786/low-level-dev-skills --skill elf-inspection -a claude-codeЧто делает elf-inspection
Скилл описывает порядок работы с ELF-файлами на Linux. Агент начинает с file и size, чтобы понять тип, архитектуру и размеры секций, затем смотрит динамические зависимости через ldd, символы через nm, заголовки и секции через readelf, дизассемблирует через objdump. Для каждого шага в скилле есть готовые команды с нужными флагами.
Отдельные разделы посвящены диагностике. Если ldd показывает not found, скилл подсказывает проверить LD_LIBRARY_PATH и /etc/ld.so.conf, а потом выполнить ldconfig. При ошибке undefined reference или отсутствии символа в рантайме агент ищет, какая библиотека должна его экспортировать, и проверяет, попадает ли она в путь загрузки. Есть разбор раздутого бинарника: сортировка секций по размеру, поиск самых крупных функций, сравнение со stripped-версией.
Проверка защиты бинарника опирается на checksec, который ставится отдельно, либо на ручные команды readelf для PIE, RELRO, stack canary и NX. Анализ через bloaty тоже требует отдельной установки. Скилл ссылается на соседние материалы по линкерам, binutils и core-дампам.
Какие задачи решает
- выяснить, от каких разделяемых библиотек зависит бинарник
- найти, какая библиотека экспортирует нужный символ
- разобраться с ошибкой undefined reference или отсутствием символа в рантайме
- понять, почему бинарник распух, и найти крупнейшие функции
- проверить PIE, RELRO, stack canary и NX у собранного файла
Примеры запросов агенту
- посмотри через elf-inspection, какие библиотеки нужны этому бинарнику
- почему мой бинарник такой большой? разбери секции и функции
- у меня undefined reference на этапе линковки, помоги найти причину
Как установить elf-inspection
1Через Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill elf-inspection -a claude-code2Вручную: положить файлы
~/.claude/skills/elf-inspection/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/elf-inspection/
1Через Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill elf-inspection -a codex2Вручную: положить файлы
.agents/skills/elf-inspection/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill elf-inspection -a cursor2Вручную: положить файлы
.cursor/skills/elf-inspection/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install mohitmishra786/low-level-dev-skills elf-inspection2Вручную: положить файлы
.github/skills/elf-inspection/SKILL.md1Через Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill elf-inspection -a gemini-cli2Командой платформы
gemini skills install https://github.com/mohitmishra786/low-level-dev-skills --path skills/binaries/elf-inspectionВручную: положить файлы
.devin/skills/elf-inspection/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add mohitmishra786/low-level-dev-skills --skill elf-inspection -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Из того же набора62
Похожие
Вопросы о elf-inspection
Как установить elf-inspection в Claude?
Выполните npx skills add mohitmishra786/low-level-dev-skills --skill elf-inspection -a claude-code. Скилл окажется в ~/.claude/skills/elf-inspection/SKILL.md.
Что делает elf-inspection?
Задаёт агенту порядок разбора ELF-файлов: зависимости, таблица символов, секции, перемещения, отладочная информация, build ID. Плюс подсказывает, что делать при ошибках линковки и загрузки.
Нужны ли дополнительные инструменты?
Для проверки защиты бинарника скилл предлагает checksec, а для анализа размеров bloaty — оба ставятся отдельно. Остальные шаги идут на readelf, objdump, nm, ldd, file и size.
Исходный текст
SKILL.md · MIT
---
name: elf-inspection
description: ELF binary inspection skill for Linux. Use when examining ELF executables or shared libraries with readelf, objdump, nm, or ldd to understand symbol visibility, section layout, dynamic dependencies, build IDs, or relocation entries. Activates on queries about ELF format, shared library dependencies, symbol tables, section sizes, DWARF debug info in binaries, binary bloat analysis, or undefined symbol errors.
---
# ELF Inspection
## Purpose
Guide agents through inspecting Linux ELF binaries: symbol tables, section layout, dynamic linking, debug info, and diagnosing linker errors.
## Triggers
- "What libraries does this binary depend on?"
- "Why is this binary so large?"
- "I have an `undefined reference` or symbol not found at runtime"
- "How do I check if debug info is in this binary?"
- "How do I find what symbols a library exports?"
- "How do I check if a binary is PIE / has RELRO?"
## Workflow
### 1. Quick overview: `file` and `size`
```bash
file prog # type, arch, linkage, stripped or not
size prog # section sizes: text, data, bss
size --format=sysv prog # detailed per-section breakdown
```
### 2. Dynamic dependencies: `ldd`
```bash
ldd ./prog # show all shared lib dependencies
ldd -v ./prog # verbose: include symbol versions
# Check why a library is loaded
ldd ./prog | grep libssl
# For a library (not an executable)
ldd ./libfoo.so
```
If `ldd` shows `not found`, the shared library is missing from `LD_LIBRARY_PATH` or `/etc/ld.so.conf`.
Fix:
```bash
export LD_LIBRARY_PATH=/path/to/libs:$LD_LIBRARY_PATH
# Or install the library and run ldconfig
sudo ldconfig
```
### 3. Symbols: `nm`
```bash
nm prog # all symbols (T=text, D=data, U=undefined, etc.)
nm -D ./libfoo.so # dynamic symbols only
nm -C prog # demangle C++ symbols
nm --defined-only prog # only defined symbols
nm -u prog # only undefined (needed) symbols
nm -S prog # include symbol size
# Search for a symbol
nm -D /usr/lib/libssl.so | grep SSL_read
```
Symbol type codes:
- `T` / `t` — text (code): global / local
- `D` / `d` — data (initialised): global / local
- `B` / `b` — BSS (uninitialised): global / local
- `R` / `r` — read-only data: global / local
- `U` — undefined (needs to be provided at link time)
- `W` / `w` — weak symbol
### 4. Sections: `readelf`
```bash
readelf -h prog # ELF header (arch, type, entry point)
readelf -S prog # all sections
readelf -l prog # program headers (segments)
readelf -d prog # dynamic section (like ldd but raw)
readelf -s prog # symbol table
readelf -r prog # relocations
readelf -n prog # notes (build ID, ABI tag)
readelf --debug-dump=info prog | head -100 # DWARF info
readelf -a prog # all of the above
```
### 5. Disassembly and source: `objdump`
```bash
# Disassemble all code sections
objdump -d prog
objdump -d -M intel prog # Intel syntax
# Disassemble + intermix source (needs -g at compile time)
objdump -d -S prog
# Disassemble specific symbol
objdump -d prog | awk '/^[0-9a-f]+ <main>:/,/^$/'
# All sections (including data)
objdump -D prog
# Header info
objdump -f prog
objdump -p prog # private headers (including needed libs)
```
### 6. Binary hardening check
```bash
# Check for PIE, RELRO, stack canary, NX
# Use checksec (install separately)
checksec --file=prog
# Manual checks:
readelf -h prog | grep Type # ET_DYN = PIE, ET_EXEC = non-PIE
readelf -d prog | grep GNU_RELRO # RELRO present
readelf -d prog | grep BIND_NOW # full RELRO
readelf -s prog | grep __stack_chk # stack protector
readelf -l prog | grep GNU_STACK # NX bit (RW = no exec, RWE = exec stack)
```
### 7. Section size analysis (binary bloat)
```bash
# Detailed section sizes
size --format=sysv prog | sort -k2 -nr | head -20
# Per-object contribution (with -Wl,--print-map or bloaty)
# Bloaty (install separately): https://github.com/google/bloaty
bloaty prog
# Check stripped vs not
file prog
strip --strip-all -o prog.stripped prog
ls -lh prog prog.stripped
```
### 8. Build ID
Build IDs uniquely identify a binary/library build, enabling `debuginfod` lookups.
```bash
readelf -n prog | grep 'Build ID'
# or
file prog | grep BuildID
```
### 9. Common diagnosis flows
**"undefined symbol at runtime"**
```bash
# Which library was expected to provide it?
nm -D libfoo.so | grep mysymbol
# Is the library in the runtime path?
ldd ./prog | grep libfoo
# Check LD_PRELOAD / LD_LIBRARY_PATH
```
**"binary is too large"**
```bash
size --format=sysv prog | sort -k2 -nr | head
nm -S --defined-only prog | sort -k2 -nr | head -20
objdump -d prog | awk '/^[0-9a-f]+ </{fn=$2} /^[0-9a-f]/{count[fn]++} END{for(f in count) print count[f], f}' | sort -nr | head -20
```
For a quick reference, see [references/cheatsheet.md](references/cheatsheet.md).
## Related skills
- Use `skills/binaries/linkers-lto` for linker flags and LTO
- Use `skills/binaries/binutils` for `ar`, `strip`, `objcopy`, `addr2line`
- Use `skills/debuggers/core-dumps` for build ID and debuginfod usage
© mohitmishra786 · MIT · mohitmishra786/low-level-dev-skills