Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(CI): run tests on CentOS 7 #494

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
be8393c
Update elf.h based on Glibc
loongson-zn Jun 2, 2023
442793d
Merge #499
bors[bot] Jun 2, 2023
30da449
COPYING: change http to https
mtelka Jun 7, 2023
5197669
Merge #501
bors[bot] Jun 8, 2023
ea30aba
Bump cachix/install-nix-action from 20 to 22
dependabot[bot] Jun 19, 2023
c401289
Merge pull request #502 from NixOS/dependabot/github_actions/cachix/i…
domenkozar Jul 20, 2023
551a692
Bump docker/setup-qemu-action from 2 to 3
dependabot[bot] Sep 18, 2023
afd3cc9
Merge pull request #519 from NixOS/dependabot/github_actions/docker/s…
Mic92 Sep 19, 2023
917ea45
feat: add --no-clobber-old-sections switch
K900 Sep 21, 2023
7c2f768
Bump cachix/install-nix-action from 22 to 25
dependabot[bot] Jan 15, 2024
a0f5433
fix compilation with GCC7
neheb Aug 12, 2023
2745e24
Bump cachix/install-nix-action from 25 to 27
dependabot[bot] May 20, 2024
f0a2180
update flake
Mic92 Nov 17, 2024
cbc46af
make shebang in configure portable again
Mic92 Nov 18, 2024
7a471a6
set docker platform for cross-arch builds
Mic92 Nov 18, 2024
835f820
Bump cachix/install-nix-action from V27 to 30
dependabot[bot] Nov 18, 2024
b6cf11a
Fix rename-dynamic-symbols.sh test (issue #503)
jamborm Mar 8, 2024
1bd68c5
fix zsh completion
RocketMaDev Apr 6, 2024
4a6e1fd
enhance `--replace-needed` and `--remove-needed`
RocketMaDev Apr 6, 2024
513630d
correct patchelf argument completions
RocketMaDev Apr 9, 2024
b9976d6
switch to zsh grammar
RocketMaDev Apr 10, 2024
ace831c
elf.h: Update `RISC-V` relocations
michalbiesek Aug 15, 2023
1c443aa
Fix page size on Alpha
matoro Nov 5, 2023
27e4d7a
Restrict system operations on OpenBSD
klemensn Oct 18, 2023
1ded839
tests/short-first-segment: fix uname(1) usage and skip message
klemensn Oct 18, 2023
47ee15f
Bump actions/upload-artifact from 3 to 4
dependabot[bot] Nov 18, 2024
38c720f
Bump actions/download-artifact from 3 to 4
dependabot[bot] Nov 18, 2024
8a88cc8
fixup ci with new upload-artifact version
Mic92 Nov 18, 2024
065c848
tests: Check uname before gzip
Patryk27 Jun 7, 2024
7cd6f03
use more portable command -v to test if gzip exists
Mic92 Nov 18, 2024
d985189
partially revert "Fix page size on Alpha"
Mic92 Nov 18, 2024
0e33894
Fix alignment problem when rewriting sections
pablogsal Sep 5, 2024
fd9c6de
Bump actions/checkout from 3 to 4
dependabot[bot] Nov 18, 2024
0a64a88
Set interpreter only when necessary
yuta-hayama Jul 21, 2023
5017be7
Add test to set interpreter of same name
yuta-hayama Jul 21, 2023
f163e8d
Add `riscv64` support for flake.nix
michalbiesek Jul 2, 2023
769337c
fix shellcheck
Mic92 Nov 18, 2024
e2fe8cb
chore(CI): run tests on CentOS 7
mayeut Apr 29, 2023
146eafe
chore(CI): run tests on AlmaLinux 8
mayeut Apr 29, 2023
c18267a
chore(CI): run tests on Ubuntu 18.04
mayeut Apr 30, 2023
f5010b3
chore(CI): run tests on AlmaLinux 9
mayeut Dec 3, 2024
7deb203
chore(CI): run tests on Ubuntu 20.04/22.04 & 24.04
mayeut Dec 3, 2024
7a9feaf
fix some tests when running under QEMU
mayeut Dec 3, 2024
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
92 changes: 88 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ 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@v30
- 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 All @@ -28,3 +28,87 @@ jobs:
mkdir build && cd build
../configure --with-asan --with-ubsan
make -j$(nproc) check

glibc:
strategy:
fail-fast: false
matrix:
glibc: ["2_17", "2_27", "2_28", "2_31", "2_34", "2_35", "2_39"]
platform: ["x86_64", "ppc64le", "aarch64", "s390x"]
include:
- glibc: "2_17"
platform: "i686"
- glibc: "2_27"
platform: "i686"
- glibc: "2_27"
platform: "armv7l"
- glibc: "2_31"
platform: "armv7l"
- glibc: "2_35"
platform: "armv7l"
- glibc: "2_39"
platform: "armv7l"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
if: matrix.platform != 'x86_64'
uses: docker/setup-qemu-action@v3
- run: |
cat <<EOF > build.sh
set -e
set -x

if [ "${{ matrix.glibc }}" == "2_27" ]; then
apt-get update
apt-get -y install software-properties-common
add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt-get update
apt-get -y install automake g++-11 make
update-alternatives --install /usr/bin/c++ c++ $(which g++-11) 100
update-alternatives --install /usr/bin/cc cc $(which gcc-11) 100
elif [ "${{ matrix.glibc }}" == "2_31" ] || [ "${{ matrix.glibc }}" == "2_35" ] || [ "${{ matrix.glibc }}" == "2_39" ]; then
apt-get update
apt-get -y install automake g++ make
fi

c++ --version
ld --version
autoconf --version
./bootstrap.sh
mkdir build && cd build
../configure
make -j$(nproc) check || (cat tests/test-suite.log; exit 1)
EOF

if [ "${{ matrix.platform }}" == "x86_64" ]; then
DOCKER_PLATFORM=amd64
elif [ "${{ matrix.platform }}" == "i686" ]; then
DOCKER_PLATFORM=386
elif [ "${{ matrix.platform }}" == "aarch64" ]; then
DOCKER_PLATFORM=arm64/v8
elif [ "${{ matrix.platform }}" == "armv7l" ]; then
DOCKER_PLATFORM=arm/v7
else
DOCKER_PLATFORM=${{ matrix.platform }}
fi

if [ "${{ matrix.glibc }}" == "2_17" ]; then
IMAGE=quay.io/pypa/manylinux2014_${{ matrix.platform }}:latest
elif [ "${{ matrix.glibc }}" == "2_27" ]; then
IMAGE=ubuntu:18.04
elif [ "${{ matrix.glibc }}" == "2_28" ]; then
IMAGE=quay.io/pypa/manylinux_${{ matrix.glibc }}_${{ matrix.platform }}:latest
elif [ "${{ matrix.glibc }}" == "2_31" ]; then
IMAGE=ubuntu:20.04
elif [ "${{ matrix.glibc }}" == "2_34" ]; then
IMAGE=quay.io/pypa/manylinux_${{ matrix.glibc }}_${{ matrix.platform }}:latest
elif [ "${{ matrix.glibc }}" == "2_35" ]; then
IMAGE=ubuntu:22.04
elif [ "${{ matrix.glibc }}" == "2_39" ]; then
IMAGE=ubuntu:24.04
else
exit 1
fi

docker run --platform linux/${DOCKER_PLATFORM} -v $(pwd):/gha ${IMAGE} sh -ec "cd /gha && bash ./build.sh"
51 changes: 31 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,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@v30
- 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@v30
- 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@v4
with:
name: patchelf
name: patchelf-windows
path: dist
- name: Show binaries
run: dir .\\dist
Expand All @@ -71,11 +71,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@v4
with:
name: patchelf
name: patchelf-tarball
path: dist
- name: Build binaries
env:
Expand All @@ -100,7 +110,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 +119,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 +131,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@v4
with:
name: patchelf
pattern: patchelf-*
merge-multiple: true
path: dist
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
Expand Down
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>.
39 changes: 31 additions & 8 deletions completions/zsh/_patchelf
Original file line number Diff line number Diff line change
@@ -1,30 +1,53 @@
#compdef patchelf

_get_dep() {
# preparm have fewer checks, as they can't be the so to replace
if [[ -f $words[2] ]] { # check if arg #1 is a elf file and not a so
local deps=($(patchelf --print-needed $words[2] 2>/dev/null)) # discard error
if [[ $? -ne 0 ]] || [[ $#deps -eq 0 ]] { # if no dependency or not a elf
_files # fallback to _files
} else {
_values "LIBS" $deps # else use dependencies of the file as candidates
}
# postparm need to check
} elif [[ -f $words[-1] ]] && [[ -z ${words[-1]:e} ]] { # check arg #-1, as most people do like this
local deps=($(patchelf --print-needed $words[-1] 2>/dev/null))
if [[ $? -ne 0 ]] || [[ $#deps -eq 0 ]] {
_files
} else {
_values "LIBS" $deps
}
} else {
_files
}
}

local options=(
'--page-size[Uses the given page size]:SIZE'
'--set-interpreter[Change the dynamic loader of executable]:INTERPRETER:dynamic loader:_files'
'--page-size[Uses the given page size]:SIZE:'
'--set-interpreter[Change the dynamic loader of executable]:INTERPRETER:_files'
'(- : *)--print-interpreter[Prints the ELF interpreter of the executable]'
'(- : *)--print-os-abi[Prints the OS ABI of the executable]'
'--set-os-abi[Changes the OS ABI of the executable]:ABI:(none sysv hpux netbsd gnu linux solaris aix irix freebsd tru64 modesto openbsd arm_aeabi arm standalone)'
'(- : *)--print-soname[Prints DT_SONAME entry of .dynamic section]'
'--set-soname[Sets DT_SONAME entry of a library to SONAME]:SONAME'
'--set-soname[Sets DT_SONAME entry of a library to SONAME]:SONAME:'
'--set-rpath[Change the DT_RUNPATH of the executable or library to RUNPATH]:RUNPATH:_dirs'
'--add-rpath[Add RUNPATH to the existing DT_RUNPATH of the executable or library.]:RUNPATH:_dirs'
'--remove-rpath[Removes the DT_RPATH or DT_RUNPATH entry of the executable or library]'
'--shrink-rpath[Remove from the DT_RUNPATH or DT_RPATH all directories that do not contain a library referenced by DT_NEEDED fields of the executable or library]'
'--allowed-rpath-prefixes[Combined with the "--shrink-rpath" option, this can be used for further rpath tuning]:PREFIXES'
'--allowed-rpath-prefixes[Combined with the "--shrink-rpath" option, this can be used for further rpath tuning]:PREFIXES:'
'(- : *)--print-rpath[Prints the DT_RUNPATH or DT_RPATH for an executable or library]'
'--force-rpath[Forces the use of the obsolete DT_RPATH in the file instead of DT_RUNPATH]'
'--add-needed[Adds a declared dependency on a dynamic library]:LIBRARY'
'*--replace-needed[Replaces a declared dependency on a dynamic library with another one]:a declared dependency:LIB_ORIG:another declared dependency:LIB_NEW'
'--remove-needed[Removes a declared dependency on LIBRARY]:LIBRARY'
'--add-needed[Adds a declared dependency on a dynamic library]:LIBRARY:_files'
'*--replace-needed[Replaces a declared dependency on a dynamic library with another one]:LIB_ORIG:_get_dep:LIB_NEW:_files'
'--remove-needed[Removes a declared dependency on LIBRARY]:LIBRARY:_get_dep'
'(- : *)--print-needed[Prints all DT_NEEDED entries of the executable]'
'--no-default-lib[Marks the object so that the search for dependencies of this object will ignore any default library search paths]'
'--no-sort[Do not sort program headers or section headers]'
'--add-debug-tag[Adds DT_DEBUG tag to the .dynamic section if not yet present in an ELF object]'
'(- : *)--print-execstack[Prints the state of the executable flag of the GNU_STACK program header, if present]'
'--clear-execstack[Clears the executable flag of the GNU_STACK program header, or adds a new header]'
'--set-execstack[Sets the executable flag of the GNU_STACK program header, or adds a new header]'
'--rename-dynamic-symbols[Renames dynamic symbols]:NAME_MAP_FILE'
'--rename-dynamic-symbols[Renames dynamic symbols]:NAME_MAP_FILE:_files'
'--output[Set the output file name]:FILE:_files'
'--debug[Prints details of the changes made to the input file]'
'--version[Shows the version of patchelf]'
Expand Down
11 changes: 6 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
description = "A tool for modifying ELF executables and libraries";

inputs.nixpkgs.url = "nixpkgs/nixpkgs-unstable";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

outputs = { self, nixpkgs }:

let
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" "riscv64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;

version = nixpkgs.lib.removeSuffix "\n" (builtins.readFile ./version);
Expand Down Expand Up @@ -36,6 +36,11 @@
versionSuffix = ""; # obsolete
src = self;
preAutoconf = "echo ${version} > version";

# portable configure shouldn't have a shebang pointing to the nix store
postConfigure = ''
sed -i '1s|^.*$|#!/bin/sh|' ./configure
'';
postDist = ''
cp README.md $out/
echo "doc readme $out/README.md" >> $out/nix-support/hydra-build-products
Expand Down Expand Up @@ -76,10 +81,12 @@
[ self.hydraJobs.tarball
self.hydraJobs.build.x86_64-linux
self.hydraJobs.build.i686-linux
# FIXME: add aarch64 emulation to our github action...
# FIXME: add aarch64/riscv64 emulation to our github action...
#self.hydraJobs.build.aarch64-linux
#self.hydraJobs.build.riscv64-linux
self.hydraJobs.build-sanitized.x86_64-linux
#self.hydraJobs.build-sanitized.aarch64-linux
#self.hydraJobs.build-sanitized.riscv64-linux
self.hydraJobs.build-sanitized.i686-linux
self.hydraJobs.build-sanitized-clang.x86_64-linux
];
Expand Down
Loading
Loading