Commit Graph

731 Commits

Author SHA1 Message Date
Jörg Thalheim
edec2a9ad7 tests: apply suggestions from shellcheck
Re-cherry-pick for the files that were not in the last cherry-pick.

(cherry picked from commit be4b84635f)
2025-08-12 16:20:35 -04:00
John Ericson
aeaaa426ab Merge branch '0.15-maintenance' into 0.16-maintenance 2025-08-12 16:16:34 -04:00
John Ericson
db8cbe93f2 Release 0.15.1 0.15.1 2025-08-12 16:10:17 -04:00
John Ericson
64e8cf5c12 Add change log for a potential, not-yet-released 0.15.1 2025-08-12 15:59:26 -04:00
John Ericson
4ac172be9a Format markdown in the commit log 2025-08-12 15:48:41 -04:00
Christian Göttsche
89d970597f Avoid implicit conversion
Use auto to avoid implicit type conversion, hiding possible value
truncation.

(cherry picked from commit 00d1e82f2b)
2025-08-12 15:23:59 -04:00
Christian Göttsche
90bad95364 Avoid implicit value truncations in wri()
Abort on truncation of values being written to the ELF data, to prevent
silent behavior mismatch.

(cherry picked from commit 28e95b30f3)
2025-08-12 15:23:58 -04:00
Christian Göttsche
daba6af292 Avoid dropping const qualifier
(cherry picked from commit b5b59ca4cb)
2025-08-12 15:23:45 -04:00
Christian Göttsche
86c3d0f441 Declare file local functions static
(cherry picked from commit 889350de50)
2025-08-12 15:23:45 -04:00
Christian Göttsche
a188583fb0 Drop superfluous semicolons
(cherry picked from commit 1c2d1fffaf)
2025-08-12 15:23:45 -04:00
Christian Göttsche
986a0aeeba Use C++11 [[noreturn]]
(cherry picked from commit b2897ab819)
2025-08-12 15:23:45 -04:00
Christian Göttsche
602405bb13 Avoid potential overflows in checkPointer()
Prevent overflows in the addtion of q and size, and avoid truncations in
callers by using size_t as type for size.

(cherry picked from commit e883229437)
2025-08-12 15:23:45 -04:00
Christian Göttsche
2b9700b643 Drop unnecessary casts in getElfType()
Also declare the function static and warn if return value not used.

(cherry picked from commit 98d1813f25)
2025-08-12 15:23:45 -04:00
Christian Göttsche
45a6dcee39 Close file before potentially throwing
(cherry picked from commit c00676a28a)
2025-08-12 15:23:45 -04:00
Christian Göttsche
de48fab274 Avoid unnecessary copies in splitColonDelimitedString()
Avoid creating a stringstream by using find().

(cherry picked from commit a393454963)
2025-08-12 15:23:45 -04:00
Christian Göttsche
d8de743799 Use C++ casts instead of raw C ones in hdr()
(cherry picked from commit 404761cf4d)
2025-08-12 15:23:45 -04:00
Christian Göttsche
547d8d7bd2 Drop unnecessary friend declarations
(cherry picked from commit 09673eb553)
2025-08-12 15:23:45 -04:00
Christian Göttsche
728797dbed Add misc functions annotations
Make the behavior of functions more explicit.

(cherry picked from commit fbb12a72ad)
2025-08-12 15:23:45 -04:00
Christian Göttsche
5baeaeecd5 Add required includes in header file
Enable to parse the header file on its own, e.g. for language servers
(clangd).

(cherry picked from commit ce5907fc40)
2025-08-12 15:23:42 -04:00
John Ericson
c0ee925daf Add 0.15 release info
Taken for retroactive documentation from GitHub.
2025-08-12 15:15:07 -04:00
Jörg Thalheim
344efe7cef README: move release history to ChangeLog.md
John thinks its better that we keep this information in-repo. It just
doesn't need to go in the read-em.

Co-Authored-By: John Ericson <John.Ericson@Obsidian.Systems>
2025-08-12 15:14:33 -04:00
Breno Rodrigues Guimaraes
a97bfdf479 Fix all shellcheck issues
(cherry picked from commit 8adc31ed7b)
2025-08-12 15:06:56 -04:00
Jörg Thalheim
61fdb6e999 tests: apply suggestions from shellcheck
(cherry picked from commit be4b84635f)
2025-08-12 15:04:30 -04:00
Jörg Thalheim
2d18660af7 fix checkPhase for cross builds
fixes https://github.com/NixOS/patchelf/issues/417

(cherry picked from commit f7b184c004)
2025-08-12 15:04:13 -04:00
Bo Anderson
33e3e8b617 tests/contiguous-note-sections.sh: use scratch directory
(cherry picked from commit a93de9d4ce)
2025-08-12 15:03:34 -04:00
Jörg Thalheim
06b8a41214 make objdump/objcopy/readelf configurable and respect cross-compiling related prefixes
(cherry picked from commit b0599fe776)
2025-08-12 14:59:49 -04:00
John Ericson
03746bff2c Backport infra improvements from master to 0.15
This is the version currently used in Nixpkgs as the stable version, so
I am interested in seeing it be developable, even as the hope is to move
to a newer version.
2025-08-12 14:54:44 -04:00
Jörg Thalheim
438d23e29c no newline in version file 0.16.1 2022-10-28 09:41:27 +02:00
Jörg Thalheim
c6d9c49f24 patchelf: bump version 2022-10-28 09:39:02 +02:00
Jörg Thalheim
af77f12554 Merge pull request #415 from Bo98/load-overlap-fix
Rework file shifting to avoid sections crossing multiple segments
0.16.0
2022-10-26 08:47:39 +02:00
Jörg Thalheim
ec72eeb4dd Merge pull request #421 from NixOS/riscv64
ci: add riscv64 support
2022-10-26 08:46:23 +02:00
Jörg Thalheim
7b9def4069 ci: add riscv64 support 2022-10-26 08:41:36 +02:00
Jörg Thalheim
2d6e7cf421 Merge pull request #420 from NixOS/flake-update
Flake update
2022-10-26 08:27:53 +02:00
Jörg Thalheim
582a96a2e3 update nixpkgs 2022-10-26 08:22:00 +02:00
Bo Anderson
15f02b0f7a Skip empty PT_NOTE sections
Previous versions of patchelf prior to 0.12 could create empty PT_NOTE sections. For backwards compatibility reasons, we should not error on such binaries.

Fixes #400.
2022-10-26 08:20:56 +02:00
Jörg Thalheim
0582e4d9c2 Merge pull request #412 from Bo98/scratch-fix
tests/contiguous-note-sections.sh: use scratch directory
2022-10-26 08:18:51 +02:00
Jörg Thalheim
55d5db9dde Merge pull request #411 from Bo98/notes-bounds
Fix out of bounds access when increasing program header table
2022-10-26 08:18:40 +02:00
Jörg Thalheim
80329739f3 Merge pull request #414 from Bo98/gnu-property
Sync .note.gnu.property to PT_GNU_PROPERTY
2022-10-26 08:17:51 +02:00
Jörg Thalheim
b751eeb137 Merge pull request #419 from xiaoxiaoafeifei/master
Fix Out-of-bounds read in the function modifyRPath
2022-10-26 08:11:17 +02:00
Jörg Thalheim
ea989aeee2 Merge pull request #409 from NixOS/cxx-17
fix c++17 check
2022-10-26 08:10:42 +02:00
zhailiangliang
96c8422e37 Out-of-bounds read exists in the function modifyRPath 2022-10-26 10:48:04 +08:00
Jörg Thalheim
75f25a3b59 Merge pull request #418 from NixOS/dependabot/github_actions/cachix/install-nix-action-18
Bump cachix/install-nix-action from 17 to 18
2022-10-17 08:27:14 +02:00
dependabot[bot]
dd391aa751 Bump cachix/install-nix-action from 17 to 18
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 17 to 18.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v17...v18)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-17 01:46:41 +00:00
Bo Anderson
109b771f53 Rework file shifting to avoid sections crossing multiple segments
Fixes #403.
2022-10-13 18:25:04 +01:00
Bo Anderson
de79f1a144 Sync .note.gnu.property to PT_GNU_PROPERTY 2022-10-10 16:43:48 +01:00
Bo Anderson
a93de9d4ce tests/contiguous-note-sections.sh: use scratch directory 2022-10-10 15:14:31 +01:00
Bo Anderson
fc21d139a4 Fix out of bounds access when increasing program header table 2022-10-10 15:13:11 +01:00
Jörg Thalheim
9921136529 fix c++17 check
https://github.com/NixOS/patchelf/issues/393

Appearantly there are compilers that support -std=c++17 but do not
really support c++17.
2022-10-09 14:30:03 +02:00
Jörg Thalheim
683e41d340 Merge pull request #381 from crystax/master
Add --print-os-abi and --set-os-abi options
2022-09-28 11:44:58 +02:00
Jörg Thalheim
7281d999e9 Merge pull request #407 from robert-scheck/glibc-hwcaps
Handle glibc-hwcaps on ppc64le on CentOS/RHEL/Rocky 8 for tests/replace-add-needed.sh (fixes #406)
2022-09-27 21:52:14 +02:00