Skip to content
/ arwen Public

cross-platform patching of the shared libraries in rust ( patchelf && install_name_tool )

Notifications You must be signed in to change notification settings

nichmor/arwen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pixi Badge

arwen: Patching Mach-O and ELF Binaries in Rust

Overview

arwen is a cross-platform Rust implementation of patchelf (Linux) and install_name_tool (macOS) in one tool.

Installation

You can install arwen using Cargo:

cargo install arwen

Usage

The CLI looks like this:

Usage: arwen <COMMAND>

Commands:
  delete-rpath         Delete a run path
  change-rpath         Change already existing run path
  add-rpath            Add a run path
  change-install-name  Change existing dylib load name
  change-install-id    Change dylib id. Works only if your object is a shared library
  help                 Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help

Examples (Mach-O only)

Add an RPath

To add an RPath (/usr/local/lib) to an existing binary:

arwen add-rpath /usr/local/lib my_binary

Change an Existing RPath

If your binary has an RPath that needs to be changed, for example, from /old/path to /new/path:

arwen change-rpath /old/path /new/path my_binary

Delete an RPath

To remove an existing RPath (/unwanted/path) from a binary:

arwen delete-rpath /unwanted/path my_binary

Change Install Name

If a Mach-O binary depends on a shared library and you want to change the library install name:

arwen change-install-name /old/libname.dylib /new/libname.dylib my_binary

Change Install ID

For a Mach-O shared library, changing its install ID:

arwen change-install-id /new/install/id.dylib my_library.dylib

Resigning the Binary After Changes

On macOS, after modifying a binary, you need to re-sign it to ensure it runs properly. You can do this using codesign:

codesign --force --sign - my_binary

Integration Tests

We have integration tests that validate that arwen maintains feature parity with install_name_tool to ensure correctness and reliability.

License

arwen is licensed under the MIT license.

Contributions

Contributions are welcome! Feel free to open issues or submit pull requests.

Status

arwen is currently in active development and provides only install_name_tool implementation. API and CLI are subject to change to accommodate a more user-friendly experience.

Funding

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.

NLnet foundation logo

NGI Zero Logo

About

cross-platform patching of the shared libraries in rust ( patchelf && install_name_tool )

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published