arwen
is a cross-platform Rust implementation that combines functionality similar to patchelf
(Linux) and install_name_tool
(macOS) into a single, versatile tool for binary manipulation.
You can install arwen
using Cargo:
cargo install arwen
# Add an RPath
arwen macho add-rpath /usr/local/lib my_binary
# Change an existing RPath
arwen macho change-rpath /old/path /new/path my_binary
# Delete an RPath
arwen macho delete-rpath /unwanted/path my_binary
# Change library install name
arwen macho change-install-name /old/libname.dylib /new/libname.dylib my_binary
# Change install ID of a shared library
arwen macho change-install-id /new/install/id.dylib my_library.dylib
# Set ELF interpreter
arwen elf set-interpreter /path/to/new/interpreter my_elf_binary
# Print current interpreter
arwen elf print-interpreter my_elf_binary
# Print OS ABI
arwen elf print-os-abi my_elf_binary
# Set OS ABI
arwen elf set-os-abi solaris my_elf_binary
# Set RPATH
arwen elf set-rpath /path1:/path2 my_elf_binary
# Add RPATH
arwen elf add-rpath /additional/path my_elf_binary
# Remove RPATH
arwen elf remove-rpath my_elf_binary
# Print current RPATH
arwen elf print-rpath my_elf_binary
# Shrink RPATH with allowed prefixes
arwen elf shrink-rpath --allowed-prefixes /usr/lib:/local/lib my_elf_binary
# Add a needed library
arwen elf add-needed my_elf_binary libexample.so libotherexample.so
# Remove a needed library
arwen elf remove-needed my_elf_binary libexample.so libotherexample.so
# Replace a needed library
arwen elf replace-needed my_elf_binary old_lib.so new_lib.so
# Print needed libraries
arwen elf print-needed my_elf_binary
# Check executable stack status
arwen elf print-exec-stack my_elf_binary
# Clear executable stack
arwen elf clear-exec-stack my_elf_binary
# Set executable stack
arwen elf set-exec-stack my_elf_binary
# Print soname
arwen elf print-soname my_elf_binary
# Set soname
arwen elf set-soname new_soname my_elf_binary
# Clear symbol version
arwen elf clear-symbol-version symbol_name my_elf_binary
# Rename dynamic symbols (using a map file)
arwen elf rename-dynamic-symbols symbol_map.txt my_elf_binary
After modifying a Mach-O binary, re-sign it:
codesign --force --sign - my_binary
We have comprehensive integration tests to validate feature parity with install_name_tool
and patchelf
, ensuring correctness and reliability.
arwen
is licensed under the MIT license.
Contributions are welcome! Feel free to open issues or submit pull requests.
arwen
is currently in active development. The API
and CLI
are subject to change to improve user experience.
This project is funded through NGI0 Entrust, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program.
Learn more at the NLnet project page.