1PATCHELF(1) User Manuals PATCHELF(1)
2
3
4
6 patchelf - Modify ELF files
7
8
10 patchelf OPTION FILE ...
11
12
14 PatchELF is a simple utility for modifying existing ELF executables and
15 libraries. It can change the dynamic loader ("ELF interpreter") of ex‐
16 ecutables and change the RPATH of executables and libraries.
17
18
20 The single option given operates on each FILE, editing in place.
21
22
23 --page-size SIZE
24 Uses the given page size instead of the default.
25
26
27 --set-interpreter INTERPRETER
28 Change the dynamic loader ("ELF interpreter") of executable
29 given to INTERPRETER.
30
31
32 --print-interpreter
33 Prints the ELF interpreter of the executable.
34
35
36 --print-soname
37 Prints DT_SONAME entry of .dynamic section. Raises an error if
38 DT_SONAME doesn't exist.
39
40
41 --set-soname SONAME
42 Sets DT_SONAME entry of a library to SONAME.
43
44
45 --set-rpath RPATH
46 Change the RPATH of the executable or library to RPATH.
47
48
49 --add-rpath RPATH
50 Add RPATH to the existing RPATH of the executable or library.
51
52
53 --remove-rpath
54 Removes the DT_RPATH or DT_RUNPATH entry of the executable or
55 library.
56
57
58 --shrink-rpath
59 Remove from the RPATH all directories that do not contain a li‐
60 brary referenced by DT_NEEDED fields of the executable or li‐
61 brary.
62
63 For instance, if an executable references one library libfoo.so,
64 has an RPATH "/lib:/usr/lib:/foo/lib", and libfoo.so can only be
65 found in /foo/lib, then the new RPATH will be "/foo/lib".
66
67
68 --allowed-rpath-prefixes PREFIXES
69 Combined with the "--shrink-rpath" option, this can be used for
70 further rpath tuning. For instance, if an executable has an
71 RPATH "/tmp/build-foo/.libs:/foo/lib", it is probably desirable
72 to keep the "/foo/lib" reference instead of the "/tmp" entry.
73
74
75 --print-rpath
76 Prints the RPATH for an executable or library.
77
78
79 --force-rpath
80 Forces the use of the obsolete DT_RPATH in the file instead of
81 DT_RUNPATH. By default DT_RPATH is converted to DT_RUNPATH.
82
83
84 --add-needed LIBRARY
85 Adds a declared dependency on a dynamic library (DT_NEEDED).
86 This option can be give multiple times.
87
88
89 --replace-needed LIB_ORIG LIB_NEW
90 Replaces a declared dependency on a dynamic library with another
91 one (DT_NEEDED). This option can be give multiple times.
92
93
94 --remove-needed LIBRARY
95 Removes a declared dependency on LIBRARY (DT_NEEDED entry). This
96 option can be given multiple times.
97
98
99 --no-default-lib
100 Marks the object that the search for dependencies of this object
101 will ignore any default library search paths.
102
103
104 --output FILE
105 Set the output file name. If not specified, the input will be
106 modified in place.
107
108
109 --debug
110 Prints details of the changes made to the input file.
111
112
113 --version
114 Shows the version of patchelf.
115
116
118 Eelco Dolstra <e.dolstra@tudelft.nl>
119
120
122 elf(5), ld.so(8)
123
124
125
126
127
128PATCHELF JUNE 2010 PATCHELF(1)