# Optional vendor: LIEF Upstream: https://github.com/lief-project/LIEF Pinned ref: `0.17.6` Pinned commit observed: `6f3594f27056b85df51d6ad1c4ca944840ad3612` License: Apache-2.0 ## Fold role Stable binary metadata parser for ELF, PE, Mach-O, and related executable formats. LIEF is a candidate replacement for r2 JSON metadata queries for sections, symbols, imports, exports, entry points, and format details. LIEF does **not** replace Ghidra/SLEIGH. Ghidra remains Fold's semantic lifting lane for P-Code and SSA-style binary analysis; LIEF would only feed metadata facts and artifact structure. ## Initial integration posture - Do not link into `fold-core` yet. - Fetch to `third_party/lief/src` with `scripts/vendor/fetch_analysis_libs.sh`. - First prototype should be a read-only metadata adapter that mirrors the current r2-backed fields used by `R2Backend` without changing finding semantics. - Keep r2 as fallback until LIEF covers all formats and fields needed by Fold's binary reports. ## External docs - C++ API overview: https://lief.re/doc/latest/api/cpp/index.html - Binary abstraction parser: https://lief.re/doc/stable/api/binary_abstraction/cpp.html - Format tutorial: https://lief.re/doc/stable/tutorials/01_play_with_formats.html ## Open checks - Compare current `R2Session` metadata commands against LIEF C++ APIs. - Validate ELF, Mach-O, and PE smoke fixtures before replacing any r2 metadata path. - Preserve per-finding backend/lane provenance: `binary-r2-metadata` versus `binary-lief-metadata` versus `binary-ghidra-pcode`.