lief-patchelf for Windows
lief-patchelf: Cross-platform ELF editor for interpreter and dependency fixes
- Free
- 4.8
- V 1.0.0
lief-patchelf: Cross-platform ELF editor for interpreter and dependency fixes
Modify ELF interpreter path, add or remove DT_NEEDED entries, and edit RPATH or SONAME values from Windows or Linux hosts. Created by Romain Thomas as part of the LIEF project, the tool reimplements the classic NixOS patchelf CLI in Rust, using LIEF's segment-oriented rewriting engine. It supports shell completion and man pages, and fits security researchers, packagers, and DevOps engineers who need precise, cross-host binary edits for compatibility or analysis.
What the tool actually changes inside an ELF binary
The tool edits concrete ELF fields: the dynamic linker (interpreter) path, DT_NEEDED dependency entries, RPATH and RUNPATH strings, and a library's SONAME. It can also shrink RPATH by removing directories that do not contain referenced libraries. Those operations run from the command line and maintain compatibility with the original patchelf interface, so scripts that call the classic CLI accept the tool without altering their invocation.
How reliable the rewriting process is on mixed filesystems
The tool uses a segment-based rewriting engine from the LIEF library rather than a section-based method, which reduces layout corruption when binaries have non-standard or optimized segment layouts. Being written in Rust provides memory-safety advantages during binary rewriting. Cross-platform builds for Windows, Linux, and macOS let you patch ELF files on a host that differs from the target runtime, which is useful when you cannot run a native Linux environment.
Safety, system impact, and workflow requirements
The tool is a standalone CLI that operates directly on ELF files; it does not attempt online system changes. Because it preserves a command-line parity with the original utility, automated pipelines can call it the same way scripts already do. The distribution offers precompiled binaries or source builds via the Rust toolchain, so users need basic command-line experience and the Rust toolchain only if they choose to compile from source.
Practical recommendation for technical users
The tool is a precise option for engineers who must edit ELF metadata from non-Linux hosts; it fits workflows that already rely on the patchelf CLI. Test changes against copies of binaries and run the patched executable in an appropriate runtime or emulator before deployment. Recommended.
Pros
- Modifies interpreter, DT_NEEDED, RPATH, RUNPATH, and SONAME from CLI
- Segment-based rewriting reduces corruption on nonstandard ELF layouts
- Cross-platform binaries let you patch ELF files from Windows hosts
Cons
- Requires command-line comfort and Rust toolchain only if building from source
- Not a multi-format patcher; designed specifically for ELF CLI parity
- No automatic rollback step reported before writing changes to files
lief-patchelf for PC
- Free
- 4.8
- V 1.0.0