summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* * Fix computation of the new start page.Eelco Dolstra2005-10-031-15/+22
|
* * Add a test for programs that crash when .dynstr etc. are moved.Eelco Dolstra2005-10-033-7/+40
|
* * Use a bigger maximum size.Eelco Dolstra2005-10-021-1/+2
|
* * Handle the case where no RPATH is present, so the .dynamic table hasEelco Dolstra2005-10-014-77/+152
| | | | | to be increased.
* * Handle `--set-rpath' for the growing case.Eelco Dolstra2005-09-304-22/+58
|
* * `patchelf --set-rpath': short case.Eelco Dolstra2005-09-303-19/+35
|
* * Refactoring continued: `--shrink-rpath' works again.Eelco Dolstra2005-09-301-134/+61
|
* * Clear out trailing and padding space.Eelco Dolstra2005-09-301-1/+6
|
* * Revert.Eelco Dolstra2005-09-301-1/+1
|
* * Refactoring continued: `--set-interpreter' works again.Eelco Dolstra2005-09-302-50/+92
|
* * Start of refactoring to support growing the RPATH.Eelco Dolstra2005-09-301-28/+207
|
* * Doh!Eelco Dolstra2005-09-301-1/+1
|
* * Also try a interpreter with a long name.Eelco Dolstra2005-09-303-6/+26
|
* * Set a interpreter with a short name.Eelco Dolstra2005-09-302-3/+3
|
* * C++-ify.Eelco Dolstra2005-09-302-97/+93
|
* * Use a real programming language.Eelco Dolstra2005-09-303-5/+7
|
* * Don't use an impure test path.Eelco Dolstra2005-09-291-1/+1
|
* * Debug.Eelco Dolstra2005-09-291-1/+1
|
* * Add an operation `--print-rpath' to print the RPATH of the libraryEelco Dolstra2005-09-292-9/+19
| | | | | or executable and exit.
* * Put in a highly Nix-specific hack to make the tests work.Eelco Dolstra2005-09-291-1/+1
|
* * Add a failing test for `--set-rpath'. Test-driven development!Eelco Dolstra2005-09-292-1/+23
|
* * Added some real tests.Eelco Dolstra2005-09-294-3/+58
|
* * Added a flag `--print-interpreter' that prints the path of theEelco Dolstra2005-09-291-3/+16
| | | | | executable's ELF interpreter on standard output and exits.
* * Add dist files.Eelco Dolstra2005-09-292-1/+4
|
* * Add tests.Eelco Dolstra2005-09-2910-7/+63
|
* * Document other people's bugs ;-)Eelco Dolstra2005-09-291-0/+6
|
* * Dummy commit.Eelco Dolstra2005-08-231-1/+1
|
* * Don't remove non-absolute paths from the RPATH like "$ORIGIN".Eelco Dolstra2005-02-231-6/+16
|
* * Keep same permissions, and handle the case where the file isEelco Dolstra2004-09-271-7/+21
| | | | | read-only.
* * Fix equality check.Eelco Dolstra2004-09-272-471/+1
|
* * Autoconfiscate patchelf.Eelco Dolstra2004-09-245-13/+496
|
* * The new interpreter can be specified with the `--interpreterEelco Dolstra2004-09-242-89/+256
| | | | | | | | | FILENAME' switch. * Shrinking of the RPATH. The switch `--shrink-rpath' will cause all directories in the RPATH that don't actually contain libraries required by the executable to be removed from the RPATH. * Only grow the front of the executable if needed.
* * Also move the section header table to the start of the file.Eelco Dolstra2004-09-241-16/+22
|
* * Dummy test program.Eelco Dolstra2004-09-241-0/+9
|
* * Made changing the ELF interpreter more robust. Previously I justEelco Dolstra2004-09-242-13/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | added the new PT_INTERP segment at the end of the file, which however makes it (typically) appear right in the middle of the (uninitialised) data segment. Worse, it wasn't guaranteed that the new segment was mapped into memory, and the dynamic loader does expect that. If the segment crossed or started beyond the last page of the last mapped segment, the program would crash. The "simple" solution is to add a PT_LOAD segment that maps the PT_INTERP segment into memory, but that creates a new problem, namely, that we then have to grow the program header table. Moving the program header table to the end of the file doesn't work, unfortunately, due to a bug in the Linux kernel: the address that it passes to the interpreter is wrong if there are holes or duplicates in the address space (it passes the base address + the program header table offset, instead of the virtual address specified in the PT_PHDR segment) - this is almost always the case due to the uninitialised part of the data segment which doesn't appear in the executable. The real solution used now is to move the entire contents of the executable one page (4096 bytes), put the new program header table (and the PT_INTERP segment) in the first page of the file thus created, add a PT_LOAD segment that starts one page before the original segments of the executable (typically 0x8047000 and 0x8048000, respectively), and adjust the internal offsets in the ELF header and program and section headers. The downside is that it makes all executables 4 KB larger.
* * Bug fix.Eelco Dolstra2004-09-241-2/+3
|
* * Proof-of-concept of a tool to patch *existing* ELF executable to useEelco Dolstra2004-09-232-0/+133
our own glibc, to change the rpath, and so on. This enable us to use third-party programs in a pure Nix environment, and to "shrink" the rpath of Nix-built executables to contain only those directories that are actually needed (in order to reduce the number of retained dependencies). In order to use our own glibc, we have to set the executable's ELF interpreter field to our glib'c ld-linux.so instead of the typical /lib/ld-linux.so.2. The name of the interpreter is stored in the PT_INTERP segment of the executable. A complication is that this segment is too small to store the path to our ld-linux.so. We cannot just make this segment bigger, since the segment is actually mapped into the executable's virtual memory space, so that making it bigger will move all following segments in memory. That would break executables, since they are typically not position-independant (they expect to be loaded at specific addresses in memory). The solution is to add a *new* segment at the end of the executable. (The data containing the original PT_INTERP segment becomes "dead" space within the executable.) This seems to work: e.g., I've succesfully patched SuSE's /bin/cat. Something similar could be done for the rpath, although that's a bit more complicated since the rpath string is stored indirectly (the PT_DYNAMIC segment merely contains a pointer to a string in the DT_STRTAB section of the executable, which we cannot grow either, so we would have to copy it to the end of the file).