Repository navigation
feat(loaders): analyze x86/x64 ELF and COFF objects - #435
Conversation
- keep call sites inside sized functions as reference sources - support R_386_PLT32 - wrap absolute relocation values to the field width - ignore COFF debug symbols instead of placing them as common storage - only claim COFF input whose section and symbol tables fit the file - resolve weak external chains in linear time and drop them from imports - place unresolved externals after the image instead of past MAX_IMAGE_SIZE - report a relocation count in xmetadata instead of every record - read the ELF OS ABI from the header instead of a second parse
|
Reviewed the loader and the integration; relocation math and bounds checks look right, and the full suite passes locally (2,744 passed, 3 skipped). One design question before merging: with this PR, an ELF Explicit rejection matches what the PR describes and is defensible. Was the behaviour change for these inputs intended, or should |
|
Intended. I checked what the previous path did with these inputs on master (2a943f9):
So no input that produced a disassembly before fails now. A fallback would only turn "TLS sections are not supported" back into an empty ok report (ELF) or the generic error (COFF), which I think is worse for the caller. Raw code is unaffected: If you prefer the fallback anyway it is a small change, say so and I'll add it. Unrelated to the question: while testing this on system objects I found that a function ending in a call to |
…ce (#437) MAX_OBJECT_SYMBOLS, MAX_OBJECT_RELOCATIONS, MAX_OBJECT_NAME_LENGTH and the MAX_IMAGE_SIZE of ObjectImage.allocate() were read from the SmdaConfig class, so values set on the config passed to Disassembler were ignored. FileLoader and MemoryFileLoader take an optional config and pass it to load_object(). readable_name moves from PeSymbolProvider (private) to labelprovider/symbol_names.py, so BinaryInfo and ObjectSymbolProvider stop importing a private helper. Follow-ups to #435 from danielplohmann/apiscout#55. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
What this changes
Adds analysis of little-endian x86/x64 ELF relocatable objects (.o and uncompressed .ko) and conventional COFF .obj files. Static archives remain unsupported.
The loader assigns deterministic analysis addresses, resolves section-relative symbols and supported relocations, and preserves the original input hash. Optional xmetadata.object_image records the derived layout, aliases, known function sizes and unresolved external references.
NOP padding is distinguished from function bodies using bounded byte inspection and symbol extents. Known object-function extents prevent interior prologues from splitting their owners. Unsupported relocations and object variants are rejected explicitly; allocation and table limits remain bounded. Existing linked-image loaders, CIL support and hash-escape versions are unchanged.
How it was verified
No analyzed binary was executed or loaded into a kernel. No binary fixture, corpus data or workflow change is included. Supported relocation subsets and limitations are documented in docs/OBJECT_FILES.md.