summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-05-02 12:11:20 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-05-02 23:20:12 +0100
commitc19e2c23be453b6ba69aa456c6eb4dd1779dd860 (patch)
tree967bb4eab8d83a37246d4c06cca6ec3a2abf1a27
parent93aaa5e99475e9450d55c1b32f08199e533a3f65 (diff)
downloadpoky-c19e2c23be453b6ba69aa456c6eb4dd1779dd860.tar.gz
patchelf: Fix alignment patch
The previous fix was in the right direction but needed to account for the section alignment of the current section. Tweak the patch to handle this. (From OE-Core rev: e464efc07a8997c43998a9c6a9544be11ab4f303) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/patchelf/patchelf/alignmentfix.patch20
1 files changed, 11 insertions, 9 deletions
diff --git a/meta/recipes-devtools/patchelf/patchelf/alignmentfix.patch b/meta/recipes-devtools/patchelf/patchelf/alignmentfix.patch
index 62e11a5e7f..a06876e50a 100644
--- a/meta/recipes-devtools/patchelf/patchelf/alignmentfix.patch
+++ b/meta/recipes-devtools/patchelf/patchelf/alignmentfix.patch
@@ -31,12 +31,14 @@ Index: git/src/patchelf.cc
31=================================================================== 31===================================================================
32--- git.orig/src/patchelf.cc 32--- git.orig/src/patchelf.cc
33+++ git/src/patchelf.cc 33+++ git/src/patchelf.cc
34@@ -1035,6 +1035,8 @@ void ElfFile<ElfFileParamNames>::normali 34@@ -1010,8 +1010,9 @@ void ElfFile<ElfFileParamNames>::normali
35 phdrs.push_back(new_phdr); 35 size_t size = 0;
36 36 for (const auto & shdr : shdrs) {
37 curr_off += size; 37 if (rdi(shdr.sh_type) != SHT_NOTE) continue;
38+ /* The next section offset would be aligned */ 38- if (rdi(shdr.sh_offset) != curr_off) continue;
39+ curr_off = roundUp(curr_off, sectionAlignment); 39+ if (rdi(shdr.sh_offset) != roundUp(curr_off, rdi(shdr.sh_addralign))) continue;
40 } 40 size = rdi(shdr.sh_size);
41 } 41+ curr_off = roundUp(curr_off, rdi(shdr.sh_addralign));
42 wri(hdr->e_phnum, phdrs.size()); 42 break;
43 }
44 if (size == 0)