Files
reverse-engineering-anything/docs/guides/artifacts/ar-archives.md
T

3.0 KiB

Unix ar archives

Use rea inspect-artifact libexample.a --json or MCP inspect_artifact to inventory a local Unix ar archive. Recognition uses the archive signature. Debian packages keep their dedicated inspection route.

The inventory records member names, byte ranges and the mode, owner IDs and modification time recorded in the header. Member mtime values are signed seconds since the Unix epoch; negative values retain dates before 1970. GNU name-table references and BSD inline names are supported. Microsoft .lib archives, including import libraries, keep long names in the same // table as NUL-terminated strings; a table whose final byte is NUL is read that way. When lib.exe records an absolute object path, such as C:\build\Release\decode.obj, the member is listed under its last component (decode.obj), as llvm-ar x writes it, and source_path keeps the recorded name. Members whose last components match share one logical path, so extracting them together is refused as a path collision; select one occurrence at a time. Symbol tables, including both Microsoft linker members, are counted separately. For GNU thin archives, the original path and recorded size appear as declaration metadata. REA does not open referenced files. Flattened GNU thin archives also retain the nested member offset in nested_member_offset, without opening the nested archive.

Use rea extract-artifact libexample.a --output-root /absolute/output --json or MCP extract_artifact to materialize stored members from a regular archive. Use the occurrence IDs from inventory to select individual files. Symbol and name tables remain archive metadata. A thin archive can be inventoried, and extraction refuses it because its members refer to files outside the archive.

A malformed or truncated member leaves earlier observations available with unknown coverage. Blank or malformed permissions remain unknown, including whether a member is executable.

Reader admission uses artifact_limits.ar: header_count (100,000 by default, including symbol and name-table headers), name_bytes (4 KiB per extended name), name_table_bytes (4 MiB per GNU table), and retained_name_bytes (8 MiB for source names and logical paths, including repeated references). The session setting artifact.member_count, changed with update_analysis_settings, backs header_count unless the call explicitly selects it.

A limit failure retains earlier observations and names the effective control and required increase. Retry the same complete archive with the named artifact_limits.ar field raised; paging does not raise reader admission.

rea inspect-artifact libexample.a --artifact-limits '{"ar":{"header_count":200000}}' --json

Microsoft long names follow the PE/COFF archive format. GNU thin nested-member references follow the Binutils archive reader.