patchelf (1) - Linux Manuals

patchelf: Modify ELF files


patchelf - Modify ELF files


patchelf OPTION FILE


PatchELF is a simple utility for modifying existing ELF executables and libraries. It can change the dynamic loader ("ELF interpreter") of executables and change the RPATH of executables and libraries.


The single option given operates on a given FILE, editing in place.

--set-interpreter INTERPRETER
Change the dynamic loader ("ELF interpreter") of executable given to INTERPRETER.

Prints the ELF interpreter of the executable.

--set-rpath RPATH
Change the RPATH of the executable or library to RPATH.

Remove from the RPATH all directories that do not contain a library referenced by DT_NEEDED fields of the executable or library.

For instance, if an executable references one library, has an RPATH "/lib:/usr/lib:/foo/lib", and can only be found in /foo/lib, then the new RPATH will be "/foo/lib".

Prints the RPATH for an executable or library.

Forces the use of the obsolete DT_RPATH in the file instead of DT_RUNPATH. By default DT_RPATH is converted to DT_RUNPATH.

Prints details of the changes made to the input file.

Shows the version of patchelf.


Eelco Dolstra <e.dolstra [at]>