Commit Graph

404 Commits

Author SHA1 Message Date
Rolf Eike Beer
adee501ccb fix roundUp() to not truncate 64 bit values 2020-09-16 08:38:22 +02:00
Domen Kožar
67005a9588 Merge pull request #234 from abathur/patch-1
replace language:nix
2020-09-14 10:41:27 +02:00
Travis A. Everett
35e3af8c62 try skipping channel
per suggestion from Mic92 :)
2020-08-31 08:36:19 -05:00
Travis A. Everett
3b90db2e4a replace language:nix 2020-08-31 08:24:00 -05:00
Eelco Dolstra
8d3a16e972 Bump version 0.12 2020-08-27 13:57:16 +02:00
Eelco Dolstra
0ca35409fe Update README.md 2020-08-27 13:13:32 +02:00
Eelco Dolstra
416ea251bd Update README.md 2020-08-27 13:07:39 +02:00
Eelco Dolstra
23620e5927 README.md: Markdown cleanup 2020-08-27 13:07:09 +02:00
Domen Kožar
9d3fc11bc6 correct place for pull request template 2020-08-24 10:52:54 +02:00
Domen Kožar
9b12447172 pull request template 2020-08-24 10:51:24 +02:00
Eelco Dolstra
53a9eb8405 Merge pull request #231 from rmNULL/skip-overwriting-same-rpath
skip overwriting r(un)path data when old_rpath = new_rpath.
2020-08-19 11:43:10 +02:00
rmnull
5d99bcd974 skip overwriting r(un)path data when old_rpath = new_rpath.
Also handle the case of dyn rpath changed.
2020-08-19 13:59:44 +05:30
Eelco Dolstra
7aa6b90851 Merge pull request #229 from lheckemann/endianness-fix
patchelf: Check ELF endianness before writing new runpath
2020-08-17 14:53:39 +02:00
Bryce Ferguson
e88d83c8b4 patchelf: Check ELF endianness before writing new runpath
This commit modifies the way fields are written in the dynamic
section in order to account the architecture of the target ELF
file. Instead of copying the raw data, use the helper functions
to convert endianness.

Signed-off-by: Bryce Ferguson <bryce.ferguson@rockwellcollins.com>
2020-08-17 13:53:27 +02:00
Eelco Dolstra
985c8ae495 Merge pull request #228 from rmNULL/remove-dt_ignore
remove unused DT_IGNORE.
2020-08-13 09:21:00 +02:00
rmnull
4fc4d39f6b remove unused DT_IGNORE. 2020-08-12 21:08:07 +05:30
Eelco Dolstra
126372b636 Merge pull request #226 from corngood/clear-symbol-version
add --clear-symbol-version
2020-08-11 09:27:29 +02:00
Eelco Dolstra
29209a41a3 Merge pull request #227 from rmNULL/stable_sort
use stable_sort to maintain relative order for equal elements in sections
2020-08-11 07:29:14 +02:00
rmnull
e01f827029 use stable_sort to maintain relative order for equal elemnts in sections(&segments) 2020-08-11 05:08:15 +05:30
David McFarland
51a3d5b5ff add --clear-symbol-version
This sets the versym entry for a given symbol to 1.
2020-08-10 15:38:36 -03:00
Eelco Dolstra
61bc101769 Merge pull request #225 from Mic92/note-2
Better support relocating NOTE sections/segments + tests!
2020-07-31 10:07:17 +02:00
Jörg Thalheim
e2d2a908bc fix nix develop evaluation 2020-07-31 08:37:18 +01:00
Jörg Thalheim
9621e85b9e add regression test for NOTE section relocation 2020-07-31 08:33:32 +01:00
Domen Kožar
e61654be0a Merge pull request #219 from NixOS/aarch64
CI for aarch64
2020-06-23 14:51:22 +02:00
Domen Kožar
1e1867de90 CI for aarch64 2020-06-23 14:48:47 +02:00
Eelco Dolstra
33daa5afcb Merge pull request #216 from delroth/pagesize
Improve the default section alignment choice (> 4K page size compat)
2020-06-23 14:33:43 +02:00
Pierre Bourdon
43a33482b5 Better support relocating NOTE sections/segments
SHT_NOTE sections can be mapped in memory by PT_NOTE segments. When
rewriting an SHT_NOTE, attempt to also rewrite a matching segment if it
exists.

Note that an ELF can contain multiple SHT_NOTE sections, and a given
PT_NOTE segment can theoretically map multiple contiguous sections.
There are multiple ways this could be handled, the one picked here is to
pre-normalize PT_NOTE segments so that a multi-section segment gets
broken up into multiple separate segments instead.

Also fix (or more like hack around) alignment issues with note sections.
Keeping the original alignment value when possible is important because
it determines how the data within the section needs to be parsed.
2020-06-20 14:22:40 +02:00
Pierre Bourdon
0470d6921b Improve the default section alignment choice
Currently patchelf uses the host system's page size (determined at build
time) as the default section load memory alignment. This causes multiple
issues

- Cross-compilation: when using patchelf on ELFs targetting a different
  architecture from the host, the host page size is still used by
  default.

- Variable page size architectures: ARMv8 systems can be configured in
  either 4K, 16K, or 64K page size mode depending on kernel
  configuration. An ARMv8 patchelf built on a 4K page size system will
  end up creating ELFs that cannot be used on a 64K page size system.

- Reproducibility: the page size of the machine that built patchelf
  "leaks" into the binary.

The build time --with-page-size as well as the run time --page-size
options can be used to work around some of these issues. But it's much
better to have patchelf do the right thing without explicit
configuration.

This commit adds support for inferring page size from the ELF header's
"machine" field. The default values are extracted from GNU gold's source
code. Note that both --with-page-size as well as --page-size continue to
work and take precedence on the default value.
2020-06-20 01:46:23 +02:00
Domen Kožar
7013e59d5a Merge pull request #210 from AaronDMarasco/const_cleanup
Some const-correctness and C++11 auto
2020-06-16 10:18:46 +02:00
Domen Kožar
4dc6e9e3d5 Merge pull request #130 from am813nt/master
Fixed parallel execution of tests (parallel-tests in automake)
2020-06-16 10:18:22 +02:00
Domen Kožar
d9c9926f24 Merge pull request #209 from AaronDMarasco/libasan
Add libasan build option and test print-needed
2020-06-12 09:44:28 +02:00
Aaron D. Marasco
e522b14edc Add libasan build option and test print-needed
(cherry picked from commit 288eb61a173ce6f4cdf0be0d744c9c6b6b5598a4)
2020-06-10 09:51:37 -04:00
Aaron D. Marasco
208303b066 Some const-correctness and C++11 auto
(cherry picked from commit 76e2cdbee4705c45cae4eca55278530a02be2f83)
2020-06-10 09:39:53 -04:00
Eelco Dolstra
d6b2a72d9e Bump version number 0.11 2020-06-09 14:33:53 +02:00
Domen Kožar
7297cb0f9a README: no more homepage 2020-06-08 10:37:21 +02:00
Domen Kožar
dadb65f97e README: strip bug was fixed 2020-06-05 17:14:46 +02:00
Domen Kožar
aa0b0e705f Merge pull request #104 from mkoloberdin/master
tests: Do not exit on an expected failure code.
2020-06-03 23:21:11 +02:00
Domen Kožar
81c0ea3eb8 README: clarify testing 2020-06-03 18:52:58 +02:00
Domen Kožar
083cbd5264 Add issue templates 2020-06-03 17:09:49 +02:00
Domen Kožar
4aff679d9e Merge pull request #171 from lkollar/no-memset-soname
Remove zeroing out logic in modifySoname
2020-06-03 16:02:39 +02:00
Domen Kožar
640a35faaa Merge pull request #202 from rpurdie/master
Fix shared library corruption when rerunning patchelf
2020-06-03 16:01:03 +02:00
Domen Kožar
6dfc3c20a9 Merge pull request #204 from NixOS/github-actions
github actions -> travis
2020-06-03 15:51:09 +02:00
Domen Kožar
ab0d67ba18 nixpkgs: 19.03 -> 20.03 2020-06-03 15:49:33 +02:00
Domen Kožar
2e881abad1 github actions -> travis 2020-06-03 15:49:33 +02:00
Domen Kožar
12e2b7b813 Merge pull request #127 from bartosh/master
fix adjusting startPage
2020-06-03 15:34:06 +02:00
Domen Kožar
12e462204c Merge pull request #203 from priegger/fix/readme
fix README -> README.me in some more places
2020-06-03 14:08:00 +02:00
Philipp Riegger
2805175e8f fix README -> README.me in some more places 2020-06-03 14:03:32 +02:00
Domen Kožar
67091ca1f9 Merge pull request #137 from speleo3/force-rpath-94
Consistently use --force-rpath
2020-06-03 13:45:12 +02:00
Thomas Holder
6e5e98ce77 Consistently use --force-rpath (fixes #94) 2020-06-03 13:37:13 +02:00
Richard Purdie
ad5f1f078b Fix shared library corruption when rerunning patchelf
When running patchelf on some existing patchelf'd binaries to change to longer
RPATHS, ldd would report the binaries as invalid. The output of objdump -x on
those libraryies should show the top of the .dynamic section is getting trashed,
something like:

0x600000001 0x0000000000429000
0x335000 0x0000000000335000
0xc740 0x000000000000c740
0x1000 0x0000000000009098
SONAME libglib-2.0.so.0

(which should be RPATH and DT_NEEDED entries)

This was tracked down to the code which injects the PT_LOAD section.

The issue is that if the program headers were previously relocated to the end
of the file which was how patchelf operated previously, the relocation code
wouldn't work properly on a second run as it now assumes they're located after
the elf header. This change forces them back to immediately follow the elf
header which is where the code has made space for them.

Should fix https://github.com/NixOS/patchelf/issues/170
and https://github.com/NixOS/patchelf/issues/192

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-03 12:14:58 +01:00