summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-04-20 15:13:53 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-05-04 22:57:51 +0100
commit70fb6c0d86ce1d1a1715904056bdd0d95225b6b3 (patch)
treedb3dc0fdaf7126840491168cf8c1df2d83d721c8 /meta
parent49034c5cdac61d12931d21653fc40b3e8b2c8906 (diff)
downloadpoky-70fb6c0d86ce1d1a1715904056bdd0d95225b6b3.tar.gz
patchelf: Backport fix from upstream for note section overlap error
Backport a patch from upstream to fix an error: patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections seen on our ubuntu1604 autobuilder worker. (From OE-Core rev: 738530b30c2538f7ecd151c0f0f5283075230bab) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 80e8f7d34d7032cc94b61bf155eac7648e6b6c74) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/patchelf/patchelf/6edec83653ce1b5fc201ff6db93b966394766814.patch44
-rw-r--r--meta/recipes-devtools/patchelf/patchelf_0.12.bb1
2 files changed, 45 insertions, 0 deletions
diff --git a/meta/recipes-devtools/patchelf/patchelf/6edec83653ce1b5fc201ff6db93b966394766814.patch b/meta/recipes-devtools/patchelf/patchelf/6edec83653ce1b5fc201ff6db93b966394766814.patch
new file mode 100644
index 0000000000..ba35ec6ffc
--- /dev/null
+++ b/meta/recipes-devtools/patchelf/patchelf/6edec83653ce1b5fc201ff6db93b966394766814.patch
@@ -0,0 +1,44 @@
1From 6edec83653ce1b5fc201ff6db93b966394766814 Mon Sep 17 00:00:00 2001
2From: rmnull <rmnull@users.noreply.github.com>
3Date: Tue, 18 Aug 2020 20:22:52 +0530
4Subject: [PATCH] mark phdrs synced with sections, avoid rechecking it when
5 syncing note sections to segments.
6
7This also serves as a bug fix when a previously synced note segment
8overlaps with another section and creates a false alarm.
9
10Upstream-Status: Backport
11---
12 src/patchelf.cc | 5 ++++-
13 1 file changed, 4 insertions(+), 1 deletion(-)
14
15diff --git a/src/patchelf.cc b/src/patchelf.cc
16index 05ec793..622f0b6 100644
17--- a/src/patchelf.cc
18+++ b/src/patchelf.cc
19@@ -669,6 +669,7 @@ void ElfFile<ElfFileParamNames>::writeReplacedSections(Elf_Off & curOff,
20 memset(contents + rdi(shdr.sh_offset), 'X', rdi(shdr.sh_size));
21 }
22
23+ std::set<unsigned int> noted_phdrs = {};
24 for (auto & i : replacedSections) {
25 std::string sectionName = i.first;
26 auto & shdr = findSection(sectionName);
27@@ -721,7 +722,7 @@ void ElfFile<ElfFileParamNames>::writeReplacedSections(Elf_Off & curOff,
28 shdr.sh_addralign = orig_shdr.sh_addralign;
29
30 for (unsigned int j = 0; j < phdrs.size(); ++j)
31- if (rdi(phdrs[j].p_type) == PT_NOTE) {
32+ if (rdi(phdrs[j].p_type) == PT_NOTE && noted_phdrs.find(j) == noted_phdrs.end()) {
33 Elf_Off p_start = rdi(phdrs[j].p_offset);
34 Elf_Off p_end = p_start + rdi(phdrs[j].p_filesz);
35 Elf_Off s_start = rdi(orig_shdr.sh_offset);
36@@ -739,6 +740,8 @@ void ElfFile<ElfFileParamNames>::writeReplacedSections(Elf_Off & curOff,
37 phdrs[j].p_offset = shdr.sh_offset;
38 phdrs[j].p_vaddr = phdrs[j].p_paddr = shdr.sh_addr;
39 phdrs[j].p_filesz = phdrs[j].p_memsz = shdr.sh_size;
40+
41+ noted_phdrs.insert(j);
42 }
43 }
44
diff --git a/meta/recipes-devtools/patchelf/patchelf_0.12.bb b/meta/recipes-devtools/patchelf/patchelf_0.12.bb
index 95886c6d3a..2eb09aee32 100644
--- a/meta/recipes-devtools/patchelf/patchelf_0.12.bb
+++ b/meta/recipes-devtools/patchelf/patchelf_0.12.bb
@@ -6,6 +6,7 @@ LICENSE = "GPLv3"
6 6
7SRC_URI = "git://github.com/NixOS/patchelf;protocol=https \ 7SRC_URI = "git://github.com/NixOS/patchelf;protocol=https \
8 file://handle-read-only-files.patch \ 8 file://handle-read-only-files.patch \
9 file://6edec83653ce1b5fc201ff6db93b966394766814.patch \
9 " 10 "
10SRCREV = "8d3a16e97294e3c5521c61b4c8835499c9918264" 11SRCREV = "8d3a16e97294e3c5521c61b4c8835499c9918264"
11 12