patchelf is an open source tool which we in snapcraft intend to use to support classic confinement across the board.
PatchELF is a simple utility for modifying existing ELF executables and
libraries. In particular, it can do the following,
- Change the dynamic loader (“ELF interpreter”) of executables
- Change the RPATH of executables and libraries
- Shrink the RPATH of executables and libraries
- Remove declared dependencies on dynamic libraries (DT_NEEDED
entries) - Add a declared dependency on a dynamic library (DT_NEEDED)
- Replace a declared dependency on a dynamic library with another one
(DT_NEEDED)
To perform such actions, it needs access to the paths, such as all the library paths for performing operations.
This utility is cornerstone to solving the classic confinement problem for pre-built binaries.