Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.rst

Elfrewriter is a small set of tools built on top of pyelftools to retrieve and change informations about elf binaries. It is mostly concerned with ELF features relevant to make relocatable binaries (DT_RUNPATH feature).

Example:

from elfrewriter import ELFRewriter

rewriter = ELFRewriter("a.out")
print rewriter.dependencies
print rewriter.rpaths

# One can change rpaths, but changes will only be written after commit
# has been called (see also known limitations).
rewriter = ELFRewriter("a.out")
rewriter.rpaths = ["yo", "mama"]
rewriter.commit()

# Use a context manager to ensure changes are committed
with ELFRewriter("a.out") as rewriter:
    rewriter.rpaths = ["yo", "mama"]

Main features:

  • ability to query/change rpath
  • ability to query/change the dependencies

Known limitations:

  • modification is done through patchelf binary in a subprocess: http://nixos.org/patchelf.html. In theory, one could implement the feature using pyelftools, but that would be quite a bit of work in the case where the rpath entry needs to grow. Patches welcome though !
  • consequence of the above: while querying works on any platform supported by pyelftools, modifying a binary only works on a machine with patchelf (most likely only Linux).

Development happens on github

About

No description, website, or topics provided.

Resources

License

Packages

No packages published
You can’t perform that action at this time.