summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix indentationEelco Dolstra2018-01-081-5/+5
|
* Merge branch 'strict_ordering' of https://github.com/kmillar/patchelfEelco Dolstra2018-01-081-3/+6
|\
| * Simplify ordering code as suggested in PR comments.Karl Millar2018-01-081-6/+6
| |
| * Modified CompPhdr::operator() so that it provides a strictKarl Millar2017-12-071-1/+4
| | | | | | | | weak ordering as required by std::sort.
* | Merge pull request #121 from dezgeg/better-error-messagesEelco Dolstra2018-01-051-4/+11
|\ \ | | | | | | Better error messages when run on statically-linked (or otherwise weird) binaries
| * | Give a better error message if the file lacks a section header tableTuomas Tynkkynen2017-04-191-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, patchelf outputs this when run on a UPX-compressed ELF file: patchelf: patchelf.cc:420: ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym, Elf_Verneed>::ElfFile(FileContents): Assertion `shstrtabIndex < shdrs.size()' failed. Make it give a nicer error message: patchelf: no section headers. The input file is probably a statically linked, self-decompressing binary Fixes #63
| * | Improve error message when run on statically linked binariesTuomas Tynkkynen2017-04-191-2/+6
| | | | | | | | | | | | | | | If .dynamic, .dynstr or .interp sections aren't found, give an extra hint to the user that the input file is statically linked.
* | | Merge pull request #129 from bjornfor/posixDomen Kožar2018-01-051-1/+1
|\ \ \ | | | | | | | | configure.ac: use "command -v" instead of "type -p"
| * | | configure.ac: use "command -v" instead of "type -p"Bjørn Forsman2017-08-011-1/+1
| | |/ | |/| | | | | | | | | | "type -p" is a Bash thing, whereas "command -v" is specified by POSIX (more portable).
* | | Merge pull request #141 from adam-trhon/patch-1Domen Kožar2018-01-051-0/+4
|\ \ \ | | | | | | | | Mention --set-soname in README
| * | | Mention --set-soname in READMEAdam Trhoň2017-12-121-0/+4
| |/ / | | | | | | Changing shared library SONAME is not a usual task and patchelf may be the only utility that can do it. As README does not mention this feature at all, one can easily miss it when searching for a suitable tool.
* | | Merge pull request #140 from bhipple/feature/centos-7.4-releaseDomen Kožar2018-01-051-0/+3
|\ \ \ | |/ / |/| | Add CentOS 7.4 to release RPM builds
| * | Add CentOS 7.4 to release RPM buildsBenjamin Hipple2017-12-091-0/+3
|/ / | | | | | | | | This provides RPMs for CentOS 7.4 users, and their counterparts on the enterprise release RHEL 7.4.
* | Merge pull request #125 from kroggen/patch-1Domen Kožar2017-06-151-0/+10
|\ \ | | | | | | added compillation steps on README
| * | added compillation steps on READMEBernardo Ramos2017-06-131-0/+10
|/ / | | | | It is lacking info on how to run the tests
* | Fix multiple --add-neededEelco Dolstra2017-05-031-0/+1
| | | | | | | | Reported by Jannis Harder.
* | Merge branch 'master' of https://github.com/rpurdie/patchelfEelco Dolstra2017-04-211-32/+40
|\ \ | |/ |/|
| * Avoid inflating file sizes needlessly and allow binaries to be strippedRichard Purdie2017-03-071-32/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current approach to changing sections in ET_DYN executables is to move the INTERP section to the end of the file. +This means changing PT_PHDR to add an extra PT_LOAD section so that the new section is mmaped into memory by the elf loader in the kernel. In order to extend PHDR, this means moving it to the end of the file. Its documented in BUGS there is a kernel 'bug' which means that if you have holes in memory between the base load address and the PT_LOAD segment that contains PHDR, it will pass an incorrect PHDR address to ld.so and fail to load the binary, segfaulting. To avoid this, the code currently inserts space into the binary to ensure that when loaded into memory there are no holes between the PT_LOAD sections. This inflates the binaries by many MBs in some cases. Whilst we could make them sparse, there is a second issue which is that strip can fail to process these binaries: $ strip fixincl Not enough room for program headers, try linking with -N [.note.ABI-tag]: Bad value This turns out to be due to libbfd not liking the relocated PHDR section either (https://github.com/NixOS/patchelf/issues/10). Instead this patch implements a different approach, leaving PHDR where it is but extending it in place to allow addition of a new PT_LOAD section. This overwrites sections in the binary but those get moved to the end of the file in the new PT_LOAD section. This is based on patches linked from the above github issue, however whilst the idea was good, the implementation wasn't correct and they've been rewritten here. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* | Fix Debian 7 buildEelco Dolstra2017-04-141-0/+1
| | | | | | | | http://hydra.nixos.org/build/49825195
* | Merge pull request #119 from jwilk/spellingDomen Kožar2017-04-043-3/+3
|\ \ | | | | | | Fix typos
| * | Fix typosJakub Wilk2017-04-043-3/+3
|/ /
* | ARM hackEelco Dolstra2017-03-081-1/+1
| |
* | Use newer Fedora/Ubuntu releasesEelco Dolstra2017-03-081-16/+12
| |
* | Test on aarch64-linuxEelco Dolstra2017-03-081-1/+1
|/
* Don't check whether DT_STRTAB matches .dynstrEelco Dolstra2017-02-171-23/+2
| | | | | | | We don't really care whether DT_STRTAB is correct, since we overwrite it anyway. https://github.com/NixOS/nixpkgs/issues/22333
* Mark the build job as reproducibleEelco Dolstra2016-12-081-0/+1
|
* Bump versionEelco Dolstra2016-09-201-1/+1
|
* Use exceptionsEelco Dolstra2016-09-191-16/+64
|
* --shrink-rpath: Ignore libraries for different architecturesEelco Dolstra2016-09-192-7/+17
| | | | Fixes #93.
* Factor out fetching ELF typeEelco Dolstra2016-09-191-24/+34
|
* Remove apparently incorrect usage of "static"Eelco Dolstra2016-09-191-5/+3
|
* Some C++11 cleanupEelco Dolstra2016-09-191-22/+15
|
* Cleanup: Remove "using namespace std"Eelco Dolstra2016-09-191-108/+104
|
* Use a std::vector for holding the file contentsEelco Dolstra2016-09-192-59/+60
|
* Remove tabEelco Dolstra2016-09-191-1/+1
|
* Merge pull request #98 from dezgeg/shrink-prefixEelco Dolstra2016-09-015-16/+107
|\ | | | | Add '--allowed-rpath-prefixes' option to '--shrink-rpath' …
| * Add '--allowed-rpath-prefixes' option to '--shrink-rpath'Tuomas Tynkkynen2016-06-035-7/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #97. In essence, the problem is that some packages in Nixpkgs have RPATHs pointing to both $NIX_BUILD_TOP and $out, e.g.: /tmp/nix-build-openldap-2.4.44.drv-0/openldap-2.4.44/libraries/libldap_r/.libs /tmp/nix-build-openldap-2.4.44.drv-0/openldap-2.4.44/libraries/liblber/.libs /nix/store/bfkmdxmv3a3f0g3d2q8jkdz2wam93c5z-openldap-2.4.44/lib /nix/store/bfkmdxmv3a3f0g3d2q8jkdz2wam93c5z-openldap-2.4.44/lib64 Currently, running `patchelf --shrink-rpath` does the wrong thing by keeping the /tmp/ paths and deleting the /nix/store ones. Now we can fix the problem by using patchelf --shrink-rpath --allowed-rpath-prefixes $NIX_STORE_DIR in the Nixpkgs fixupPhase instead.
| * Extract a function for splitting a colon-separated stringTuomas Tynkkynen2016-06-031-9/+19
|/ | | | | We're going to need this logic in another place, so make a function of this.
* ` -> 'Eelco Dolstra2016-05-031-32/+32
|
* Improve "cannot find section" error messageEelco Dolstra2016-05-031-1/+1
| | | | Issue #66
* Merge pull request #83 from chewi/patch-1Eelco Dolstra2016-04-281-1/+1
|\ | | | | Make tests run in serial as they break in parallel
| * Make tests run in serial as they break in parallelJames Le Cuirot2016-03-171-1/+1
| | | | | | It would be nice to fix them in parallel but I lack the time.
* | Merge pull request #81 from fsateler/force-pagesizeEelco Dolstra2016-04-281-4/+5
|\ \ | | | | | | no-rpath-prebuild: force pagesize to 4096 on prebuilt binaries
| * | no-rpath-prebuild: force pagesize to 4096 on prebuilt binariesFelipe Sateler2016-02-291-4/+5
| |/ | | | | | | | | They all have that page size, and the host-detected one might be different.
* | Merge pull request #86 from njsmith/masterEelco Dolstra2016-04-281-1/+1
|\ \ | | | | | | Fix bug in walking .gnu.version_r linked list
| * | Fix bug in walking .gnu.version_r linked listNathaniel J. Smith2016-04-021-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When writing the code to teach --replace-needed to modify the .gnu.version_r section (gh-85), I misunderstood how the ->vn_next pointers in the Elf_Verneed structs are supposed to be interpreted: I thought they gave an offset from the beginning of the section, but in fact they give an offset relative to the current struct. The resulting bug was very odd: generally, patchelf would complete without signalling an error, but it would only successfully replace filenames that occurred as either the first or second entries in the .gnu.version_r section, while the third or later entries would be left untouched. This commit fixes the interpretation of the ->vn_next pointers, so that now --replace-needed should work correctly even on ELF files with more than two version needed structs. Thanks to @matthew-brett for finding the bug / providing a test case, and to @rmcgibbo for helping me diagnose it.
* | Merge pull request #85 from njsmith/masterEelco Dolstra2016-04-011-6/+59
|\ \ | |/ |/| Teach --replace-needed to update .gnu.version_r table
| * Small cleanups to replaceNeededNathaniel J. Smith2016-04-011-14/+37
| | | | | | | | | | | | No semantic changes, but I noticed some small errors in the DT_NEEDED handling loop while I was adding the .gnu.version_r handling, so might as well fix them while I'm here.
| * Teach --replace-needed to update .gnu.version_r tableNathaniel J. Smith2016-04-011-4/+34
|/ | | | | | | | | | | | | | | | | | If the ELF binary that we're patching is linked to a DSO that uses symbol versioning, then the DSO's SONAME appears in two different places: once as a DT_NEEDED entry, and once in the .gnu.version_r version requirements section. Previously, patchelf --replace-needed would update DT_NEEDED entry, but fail to update the .gnu.version_r table. This resulted in completely broken binaries -- trying to load them would trigger an assertion failure inside the dynamic loader, as it tries to check the version of a library that was never loaded: Inconsistency detected by ld.so: dl-version.c: 224: _dl_check_map_versions: Assertion `needed != ((void *)0)' failed! This commit teaches --replace-needed to update the .gnu.version_r table. Fixes: gh-84
* Update README0.9Eelco Dolstra2016-02-291-1/+13
|