Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
patchelf: increase the page size alignment on Aarch64 to support 64K pages #89317
Motivation for this change
NixOS built binaries currently do not work on ARMv8 systems configured for 64K wide pages (the more common default is 4K pages, like x86). This is because even though the usual compiler toolchains properly generate ELF files with 64K segment alignment, patchelf will sometimes rewrite segments and align them to 4K instead. The 4K value comes from the fact that the current Hydra ARMv8 builder uses 4K pages, which in itself is kind of undesirable (leaking details of the build infrastructure into packages).
I currently lack enough system diversity to test this (my only ARMv8 box is the one that's broken...), so feedback welcome.
Note that this change leaves cross-compilation to aarch64 as "broken" as it is now -- patchelf doesn't know about the target architecture being patched, so it will just use the 4K value from the host instead.
The better solution would be something like NixOS/patchelf#80 .
I think there are basically 2 approaches for a long term fix in patchelf.
(1) will still require changes to patchelf for each new architecture with page size != 4K. (2) is theoretically better IMO by just following whatever the toolchain generated.
Both of these options would fix the cross-compilation problem and the reproducibility problem.