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-11 12:02:29 +0100
commit7e61f58125c7fb5f38ae8d170164be2016c399ef (patch)
tree2104a86a7d8e14ef0020fe97fd96a1a7c46bc18e
parent865d46981a637dbb49bbb61fa6937379341f20c3 (diff)
downloadpoky-7e61f58125c7fb5f38ae8d170164be2016c399ef.tar.gz
poky-7e61f58125c7fb5f38ae8d170164be2016c399ef.tar.bz2
poky-7e61f58125c7fb5f38ae8d170164be2016c399ef.zip
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: 69e5a81ceeba3104ba5954dadc7c65cfa4b1be9b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit e464efc07a8997c43998a9c6a9544be11ab4f303) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> 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
===================================================================
--- git.orig/src/patchelf.cc
+++ git/src/patchelf.cc
-@@ -1035,6 +1035,8 @@ void ElfFile<ElfFileParamNames>::normali
- phdrs.push_back(new_phdr);
-
- curr_off += size;
-+ /* The next section offset would be aligned */
-+ curr_off = roundUp(curr_off, sectionAlignment);
- }
- }
- wri(hdr->e_phnum, phdrs.size());
+@@ -1010,8 +1010,9 @@ void ElfFile<ElfFileParamNames>::normali
+ size_t size = 0;
+ for (const auto & shdr : shdrs) {
+ if (rdi(shdr.sh_type) != SHT_NOTE) continue;
+- if (rdi(shdr.sh_offset) != curr_off) continue;
++ if (rdi(shdr.sh_offset) != roundUp(curr_off, rdi(shdr.sh_addralign))) continue;
+ size = rdi(shdr.sh_size);
++ curr_off = roundUp(curr_off, rdi(shdr.sh_addralign));
+ break;
+ }
+ if (size == 0)