forked from easybuilders/easybuild-easyconfigs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix alignment bug in patchelf-0.18.0 by patch
- Loading branch information
1 parent
7f1f0e6
commit 40d2488
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
easybuild/easyconfigs/p/patchelf/patchelf-0.18.0_fix-alignment.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Author - Pavel Tománek | ||
Fix alignment problem when rewriting sections | ||
https://github.com/NixOS/patchelf/pull/566 | ||
--- src/patchelf.cc.orig 2024-10-07 16:45:17.515584318 +0200 | ||
+++ src/patchelf.cc 2024-10-07 16:47:14.622270000 +0200 | ||
@@ -843,7 +843,7 @@ | ||
neededSpace += headerTableSpace; | ||
debug("needed space is %d\n", neededSpace); | ||
|
||
- Elf_Off startOffset = roundUp(fileContents->size(), getPageSize()); | ||
+ Elf_Off startOffset = roundUp(fileContents->size(), alignStartPage); | ||
|
||
// In older version of binutils (2.30), readelf would check if the dynamic | ||
// section segment is strictly smaller than the file (and not same size). | ||
@@ -879,7 +879,7 @@ | ||
rdi(lastSeg.p_type) == PT_LOAD && | ||
rdi(lastSeg.p_flags) == (PF_R | PF_W) && | ||
rdi(lastSeg.p_align) == alignStartPage) { | ||
- auto segEnd = roundUp(rdi(lastSeg.p_offset) + rdi(lastSeg.p_memsz), getPageSize()); | ||
+ auto segEnd = roundUp(rdi(lastSeg.p_offset) + rdi(lastSeg.p_memsz), alignStartPage); | ||
if (segEnd == startOffset) { | ||
auto newSz = startOffset + neededSpace - rdi(lastSeg.p_offset); | ||
wri(lastSeg.p_filesz, wri(lastSeg.p_memsz, newSz)); | ||
@@ -898,6 +898,7 @@ | ||
wri(phdr.p_filesz, wri(phdr.p_memsz, neededSpace)); | ||
wri(phdr.p_flags, PF_R | PF_W); | ||
wri(phdr.p_align, alignStartPage); | ||
+ assert(startPage % alignStartPage == startOffset % alignStartPage); | ||
} | ||
|
||
normalizeNoteSegments(); |