Skip to content

Commit 9592fdf

Browse files
authored
Merge pull request #275 from rpurdie/master
patchelf: Fix alignment issues with contiguous note sections
2 parents 4d03718 + 2d0e0b9 commit 9592fdf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/patchelf.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,8 +1003,9 @@ void ElfFile<ElfFileParamNames>::normalizeNoteSegments()
10031003
size_t size = 0;
10041004
for (const auto & shdr : shdrs) {
10051005
if (rdi(shdr.sh_type) != SHT_NOTE) continue;
1006-
if (rdi(shdr.sh_offset) != curr_off) continue;
1006+
if (rdi(shdr.sh_offset) != roundUp(curr_off, rdi(shdr.sh_addralign))) continue;
10071007
size = rdi(shdr.sh_size);
1008+
curr_off = roundUp(curr_off, rdi(shdr.sh_addralign));
10081009
break;
10091010
}
10101011
if (size == 0)

0 commit comments

Comments
 (0)