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
16 executables 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 --remove-rpath
50 Removes the DT_RPATH or DT_RUNPATH entry of the executable or
51 library.
52
53
54 --shrink-rpath
55 Remove from the RPATH all directories that do not contain a
56 library referenced by DT_NEEDED fields of the executable or
57 library.
58
59 For instance, if an executable references one library libfoo.so,
60 has an RPATH "/lib:/usr/lib:/foo/lib", and libfoo.so can only be
61 found in /foo/lib, then the new RPATH will be "/foo/lib".
62
63
64 --allowed-rpath-prefixes PREFIXES
65 Combined with the "--shrink-rpath" option, this can be used for
66 further rpath tuning. For instance, if an executable has an
67 RPATH "/tmp/build-foo/.libs:/foo/lib", it is probably desirable
68 to keep the "/foo/lib" reference instead of the "/tmp" entry.
69
70
71 --print-rpath
72 Prints the RPATH for an executable or library.
73
74
75 --force-rpath
76 Forces the use of the obsolete DT_RPATH in the file instead of
77 DT_RUNPATH. By default DT_RPATH is converted to DT_RUNPATH.
78
79
80 --add-needed LIBRARY
81 Adds a declared dependency on a dynamic library (DT_NEEDED).
82 This option can be give multiple times.
83
84
85 --replace-needed LIB_ORIG LIB_NEW
86 Replaces a declared dependency on a dynamic library with another
87 one (DT_NEEDED). This option can be give multiple times.
88
89
90 --remove-needed LIBRARY
91 Removes a declared dependency on LIBRARY (DT_NEEDED entry). This
92 option can be given multiple times.
93
94
95 --no-default-lib
96 Marks the object that the search for dependencies of this object
97 will ignore any default library search paths.
98
99
100 --output FILE
101 Set the output file name. If not specified, the input will be
102 modified in place.
103
104
105 --debug
106 Prints details of the changes made to the input file.
107
108
109 --version
110 Shows the version of patchelf.
111
112
114 Eelco Dolstra <e.dolstra@tudelft.nl>
115
116
118 elf(5), ld.so(8)
119
120
121
122
123
124PATCHELF JUNE 2010 PATCHELF(1)