Commit Graph

894 Commits

Author SHA1 Message Date
John Ericson
a7c595db2c Add Meson build
Progress on #599. Tests still need to be done, though.
2025-08-12 13:12:15 -04:00
John Ericson
2156b8e6ce Merge pull request #610 from NixOS/cmake
Add CMake build
2025-08-12 16:47:49 +00:00
david feurle
51cf74ce10 Add CMake build
Co-Authored-by: John Ericson <John.Ericson@Obsidian.Systems>
2025-08-12 12:42:49 -04:00
John Ericson
f8621b633a Merge pull request #609 from NixOS/windows-lighter-override
Make fewer assumptions in the windows override
2025-08-12 15:50:22 +00:00
John Ericson
1160a46b8b Make fewer assumptions in the windows override 2025-08-12 11:44:52 -04:00
John Ericson
c0c9f3a431 Merge pull request #603 from obsidiansystems/package.nix
Refactor nix code a bit to have regular `package.nix`
2025-08-12 15:41:15 +00:00
John Ericson
baf35300a0 Move Windows static logic out of patchelf.nix
This is too opinionated for the package itself, which is supposed to be
very open-ended about how something it is built. It should instead go
with the `NIX_CFLAGS_COMPILE = "-static"` that it is supposed to enable.
2025-08-12 11:36:28 -04:00
John Ericson
bba0d5bef3 Rename patchelf.nix to package.nix
Let's just call it by its conventional name, now.
2025-08-12 11:25:10 -04:00
Jörg Thalheim
63791a1532 Merge pull request #607 from NixOS/dev-tooling
Add developer tools
2025-08-12 07:08:27 +00:00
Jörg Thalheim
4671a3f234 ci: enable merge queue 2025-08-12 09:03:23 +02:00
Jörg Thalheim
7f42e30354 ci: enable merge queue 2025-08-11 19:45:02 +02:00
John Ericson
247faf774f Merge pull request #608 from NixOS/use-fileset
Use fileset to avoid rebuilds
2025-08-11 13:39:24 -04:00
John Ericson
18a5953fc5 Add developer tools
Code is taken from Nix.
2025-08-11 13:32:15 -04:00
John Ericson
cc8baeab6a Use fileset to avoid rebuilds 2025-08-11 13:32:06 -04:00
John Ericson
fe5819ed6c Merge pull request #602 from obsidiansystems/nixfmt
Format Nix code
2025-08-11 12:31:27 -04:00
dependabot[bot]
a4b21a9235 Bump actions/download-artifact from 4 to 5
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-11 08:49:31 +02:00
John Ericson
6c7c02dabf readme: Add title and link chatroom 2025-08-11 08:49:22 +02:00
John Ericson
06beb68dfa Create .git-blame-ignore-revs with previous commit 2025-08-10 16:02:42 -04:00
John Ericson
706478750f Format Nix code 2025-08-10 15:59:56 -04:00
murkvin
523f401584 fix: specify zsh completions in patchelf.spec.in
Problem: When building the patchelf RPM, zsh completions are installed (but not packaged). This causes an RPM build failure.

Solution: We need to identify the zsh completions in the generated RPM spec file.

Testing: I updated the RPM spec file and successfully built the RPM.
2025-02-15 08:40:35 +07:00
William Tassoux
b219056071 Fix support for files larger than 4GB 2025-02-06 03:58:04 +01:00
Jörg Thalheim
739a486ece add mergify configuration 2025-01-08 17:59:31 +01:00
Jörg Thalheim
cb520395c1 Revert "Add riscv64 support for flake.nix"
This reverts commit f163e8df3d.

We don't support riscv64 in hydra. This needs to be refactored to only
enable riscv64 in the flake but not in hydra jobs.
2025-01-08 17:56:27 +01:00
Patryk Wychowaniec
43b75fbc9f Allocate PHT & SHT at the end of the *.elf file 2025-01-07 07:29:30 +01:00
Jörg Thalheim
769337c227 fix shellcheck 2024-11-18 12:44:49 +01:00
Michal Biesek
f163e8df3d Add riscv64 support for flake.nix 2024-11-18 12:01:54 +01:00
Yuta Hayama
5017be7ae0 Add test to set interpreter of same name 2024-11-18 11:57:58 +01:00
Yuta Hayama
0a64a88208 Set interpreter only when necessary
If the given interpreter is already set, nothing needs to be done.
As with modifySoname(), it skips unnecessary processing.
2024-11-18 11:57:58 +01:00
dependabot[bot]
fd9c6ded20 Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 11:56:58 +01:00
Pablo Galindo
0e338941fc Fix alignment problem when rewriting sections
After commit ac212d0e6f the code to
rewrite alignment section has been changed to use the largest alignment
in the list of segments instead of the alignment that it's retrieved
using getPageSize().

Unfortunately the code didn't update the offset as well to keep the
invariant p_vaddr % alignment == p_offset % alignment.
2024-11-18 11:54:42 +01:00
Jörg Thalheim
d985189c25 partially revert "Fix page size on Alpha"
this broke tests on other architectures
2024-11-18 11:46:09 +01:00
Jörg Thalheim
7cd6f031c0 use more portable command -v to test if gzip exists
This also works with the busybox version.
2024-11-18 11:46:09 +01:00
Patryk Wychowaniec
065c8484e3 tests: Check uname before gzip 2024-11-18 11:46:09 +01:00
Jörg Thalheim
8a88cc8684 fixup ci with new upload-artifact version 2024-11-18 11:46:09 +01:00
dependabot[bot]
38c720faf8 Bump actions/download-artifact from 3 to 4
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)
2024-11-18 11:46:09 +01:00
dependabot[bot]
47ee15f2a4 Bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 11:46:09 +01:00
Klemens Nanni
1ded8392b1 tests/short-first-segment: fix uname(1) usage and skip message
Replace non-portable GNU `-i, --hardware-platform` with `-m[, --machine]`
to fix "unknown error" usage error on, e.g. OpenBSD.

Also fix the check's backwards logic.  OpenBSD/spar64 now prints
	-skipping test: not supported on x86_64 Linux
	+skipping test: amd64 Linux required
2024-11-18 11:08:47 +01:00
Klemens Nanni
27e4d7af87 Restrict system operations on OpenBSD
Use pledge(2)[0] to limit patchelf(1) to read, write and create files.
It never deals with TTY, network, process management or other subsystems.

Do so immediately in main() since mainWrapped() itself parses files
whilst parsing command line arguments (--rename-dynamic-symbols).

This is to reduce patchelf's attack surface and potential damage when
dealing with untrusted ELF programs.

No behaviour change in tests or real world usage observed on
OpenBSD/amd64 7.4 (0.18.0 tests: 56/52/2/2 TOTAL/PASS/FAIL/SKIP).

0: https://man.openbsd.org/pledge.2
2024-11-18 11:07:59 +01:00
matoro
1c443aa1c7 Fix page size on Alpha
All tests pass.

Also explicitly specifies -no-pie for executables which should have it
disabled, to be compatible with gccs built with --enable-default-pie.
2024-11-18 11:07:31 +01:00
Michal Biesek
ace831cc97 elf.h: Update RISC-V relocations
glibc: commit: 6f962278e24bdf5cb5f310c5a17add41da95407c

Signed-off-by: Michal Biesek <michalbiesek@gmail.com>
2024-11-18 11:06:42 +01:00
RocketDev
b9976d63c2 switch to zsh grammar 2024-11-18 11:05:37 +01:00
RocketDev
513630db29 correct patchelf argument completions 2024-11-18 11:05:37 +01:00
RocketDev
4a6e1fde22 enhance --replace-needed and --remove-needed 2024-11-18 11:05:37 +01:00
RocketDev
1bd68c54cc fix zsh completion 2024-11-18 11:05:37 +01:00
Martin Jambor
b6cf11a31b Fix rename-dynamic-symbols.sh test (issue #503)
when building and then checking patchelf on openSUSE Leap 15.5, the
rename-dynamic-symbols.sh test fails.  The test builds a test library
and executable called many-syms-main, then runs patchelf to rename
symbols and then checks that many-syms-main still runs successfully.

On Leap the run fails with many messages like

  ./many-syms-main: Symbol `f1947' causes overflow in R_X86_64_PC32 relocation

and then terminates with a Segmentation fault.  The interesting bit is
that it however fails so even before patchelf touches it.

The binary is built and linked with option -pie which produces an
executable which is supposedly position independent but does not
actually contain code position independent code which requires
compiler option -fPIE (of -fpie or -fPIC or -fpic).  As a result the
calls in the generated assembly do not go through the PLT.

This patch merely adresses that by adding the -fPIE option to the
CFLAGS for the test.
2024-11-18 11:05:01 +01:00
dependabot[bot]
835f8207c2 Bump cachix/install-nix-action from V27 to 30
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from V27 to 30. This release includes the previously tagged commit.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/V27...v30)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 11:04:16 +01:00
Jörg Thalheim
7a471a6fc1 set docker platform for cross-arch builds 2024-11-18 10:57:40 +01:00
Jörg Thalheim
cbc46af556 make shebang in configure portable again 2024-11-18 10:57:40 +01:00
Jörg Thalheim
f0a21807d6 update flake 2024-11-18 10:57:40 +01:00
dependabot[bot]
2745e244f5 Bump cachix/install-nix-action from 25 to 27
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 25 to 27.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v25...V27)

---
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>
2024-11-17 20:21:49 +01:00