Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
03746bf
Backport infra improvements from master to 0.15
Ericson2314 Aug 12, 2025
06b8a41
make objdump/objcopy/readelf configurable and respect cross-compiling…
Mic92 Nov 6, 2022
33e3e8b
tests/contiguous-note-sections.sh: use scratch directory
Bo98 Oct 10, 2022
2d18660
fix checkPhase for cross builds
Mic92 Nov 6, 2022
61fdb6e
tests: apply suggestions from shellcheck
Mic92 Feb 19, 2023
a97bfdf
Fix all shellcheck issues
brenoguim Mar 11, 2023
344efe7
README: move release history to ChangeLog.md
Mic92 Jul 16, 2022
c0ee925
Add 0.15 release info
Ericson2314 Aug 12, 2025
5baeaee
Add required includes in header file
cgzones Feb 21, 2023
728797d
Add misc functions annotations
cgzones Feb 21, 2023
547d8d7
Drop unnecessary friend declarations
cgzones Feb 21, 2023
d8de743
Use C++ casts instead of raw C ones in hdr()
cgzones Feb 21, 2023
de48fab
Avoid unnecessary copies in splitColonDelimitedString()
cgzones Feb 21, 2023
45a6dce
Close file before potentially throwing
cgzones Feb 21, 2023
2b9700b
Drop unnecessary casts in getElfType()
cgzones Feb 21, 2023
602405b
Avoid potential overflows in checkPointer()
cgzones Feb 21, 2023
986a0ae
Use C++11 [[noreturn]]
cgzones Feb 21, 2023
a188583
Drop superfluous semicolons
cgzones Feb 21, 2023
86c3d0f
Declare file local functions static
cgzones Feb 21, 2023
daba6af
Avoid dropping const qualifier
cgzones Feb 21, 2023
90bad95
Avoid implicit value truncations in wri()
cgzones Feb 21, 2023
89d9705
Avoid implicit conversion
cgzones Feb 21, 2023
4ac172b
Format markdown in the commit log
Ericson2314 Aug 12, 2025
64e8cf5
Add change log for a potential, not-yet-released 0.15.1
Ericson2314 Aug 12, 2025
db8cbe9
Release 0.15.1
Ericson2314 Aug 12, 2025
aeaaa42
Merge branch '0.15-maintenance' into 0.16-maintenance
Ericson2314 Aug 12, 2025
edec2a9
tests: apply suggestions from shellcheck
Mic92 Feb 19, 2023
248f6d7
Merge branch '0.16-maintenance' into 0.17-maintenance
Ericson2314 Aug 12, 2025
3449f5f
tests: apply suggestions from shellcheck
Mic92 Feb 19, 2023
6e05c48
Merge branch '0.17-maintenance' into HEAD
Ericson2314 Aug 12, 2025
731fcc2
Also pass STRIP to the tests
heirecka Nov 7, 2022
6b0d933
Also respect a prefixed nm and strings too
heirecka Apr 24, 2023
58f5b19
Release 0.15.2
Ericson2314 Aug 12, 2025
ca25385
Merge branch '0.15-maintenance' into 0.16-maintenance
Ericson2314 Aug 12, 2025
2a2bb07
Merge branch '0.16-maintenance' into 0.17-maintenance
Ericson2314 Aug 12, 2025
6d53678
Merge branch '0.17-maintenance' into 0.18-maintenance
Ericson2314 Aug 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig configuration for PatchELF
# http://EditorConfig.org

# Top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file, UTF-8 charset
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

# Match Nix files, set indent to spaces with width of two
[*.nix]
indent_style = space
indent_size = 2

# Match C++/C/shell, set indent to spaces with width of four
[*.{hpp,cc,hh,c,h,sh}]
indent_style = space
indent_size = 4

# Match diffs, avoid to trim trailing whitespace
[*.{diff,patch}]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Manual nixfmt run
706478750fc8574ed816ef746d3ad3790b2ea66a
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
name: "CI"
on:
pull_request:
merge_group:
push:
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: shellcheck tests/*.sh
nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- run: nix-build -A hydraJobs.release
ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: get toolchain version
run: |
c++ --version
Expand Down
52 changes: 32 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Publish
on:
pull_request:
merge_group:
push:
branches:
- '*'
Expand All @@ -13,44 +14,44 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- name: Build tarballs
run: |
nix build -L .#hydraJobs.tarball
install -D ./result/tarballs/*.tar.bz2 ./dist/patchelf-$(cat version).tar.bz2
install -D ./result/tarballs/*.tar.gz ./dist/patchelf-$(cat version).tar.gz
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: patchelf
name: patchelf-tarball
path: dist/*

build_windows:
name: Build windows executable
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- name: Build windows executable
run: |
nix build -L .#patchelf-win32 .#patchelf-win64
install -D ./result/bin/patchelf.exe ./dist/patchelf-win32-$(cat version).exe
install -D ./result-1/bin/patchelf.exe ./dist/patchelf-win64-$(cat version).exe
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: patchelf
name: patchelf-windows
path: dist/*

test_windows:
name: Test windows binaries
needs: [build_windows]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- uses: actions/checkout@v4
- uses: actions/download-artifact@v5
with:
name: patchelf
name: patchelf-windows
path: dist
- name: Show binaries
run: dir .\\dist
Expand All @@ -71,11 +72,21 @@ jobs:
steps:
- name: Set up QEMU
if: matrix.platform != 'amd64'
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- uses: actions/download-artifact@v3
- name: Set docker arch
run: |
platform=${{ matrix.platform }}
if [[ $platform == arm64v8 ]]; then
platform=arm64
elif [[ $platform == arm32v7 ]]; then
platform=arm
fi
echo "DOCKER_PLATFORM=$platform" >> $GITHUB_ENV

- uses: actions/download-artifact@v5
with:
name: patchelf
name: patchelf-tarball
path: dist
- name: Build binaries
env:
Expand All @@ -100,7 +111,7 @@ jobs:
else
ENTRYPOINT=
fi
docker run -e CXXFLAGS -v $(pwd):/gha ${{ matrix.platform }}/alpine:edge ${ENTRYPOINT} sh -ec "cd /gha && sh ./build.sh"
docker run --platform "$DOCKER_PLATFORM" -e CXXFLAGS -v $(pwd):/gha ${{ matrix.platform }}/alpine:edge ${ENTRYPOINT} sh -ec "cd /gha && sh ./build.sh"
- name: Check binaries
run: |
cat <<EOF > check.sh
Expand All @@ -109,10 +120,10 @@ jobs:
tar -xf ./dist/patchelf-*-*.tar.gz
./bin/patchelf --version
EOF
docker run -v $(pwd):/gha ${{ matrix.platform }}/debian:unstable-slim sh -ec "cd /gha && sh ./check.sh"
- uses: actions/upload-artifact@v3
docker run --platform "$DOCKER_PLATFORM" -v $(pwd):/gha ${{ matrix.platform }}/debian:unstable-slim sh -ec "cd /gha && sh ./check.sh"
- uses: actions/upload-artifact@v4
with:
name: patchelf
name: patchelf-${{ matrix.platform }}
path: dist/*

publish:
Expand All @@ -121,9 +132,10 @@ jobs:
if: github.event_name == 'push' && github.repository == 'NixOS/patchelf' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v5
with:
name: patchelf
pattern: patchelf-*
merge-multiple: true
path: dist
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Makefile
.deps
*.o

CMakeLists.txt.user

/tests/*.log
/tests/*.trs
/tests/no-rpath
Expand Down
26 changes: 26 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
queue_rules:
- name: default
merge_conditions:
- check-success=Build static musl binaries (amd64)
- check-success=Build static musl binaries (arm32v7)
- check-success=Build static musl binaries (arm64v8)
- check-success=Build static musl binaries (i386)
- check-success=Build static musl binaries (ppc64le)
- check-success=Build static musl binaries (riscv64)
- check-success=Build static musl binaries (s390x)
- check-success=Build tarballs
- check-success=Build windows executable
- check-success=Publish tarballs & binaries
- check-success=Test windows binaries
- check-success=nix
- check-success=shellcheck
- check-success=ubuntu
merge_method: rebase
batch_size: 5
pull_request_rules:
- name: merge using the merge queue
conditions:
- base=master
- label~=merge-queue|dependencies
actions:
queue: {}
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.5)

project(patchelf)

file(READ version VERSION)

include(GNUInstallDirs)

add_subdirectory(src)
# add_subdirectory(tests) # TODO

install(FILES patchelf.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)

install(FILES README.md DESTINATION ${CMAKE_INSTALL_DOCDIR})

install(FILES completions/zsh/_patchelf
DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions)
8 changes: 4 additions & 4 deletions COPYING
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/philosophy/why-not-lgpl.html>.
Loading
Loading