summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/patchelf
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-04-23 10:12:08 +0100
commit63b0992ab7f6d2596bcc47641c308b2c4d853445 (patch)
tree00cb62cd1c9700576fca950f11fa8a5d88c3a801 /meta/recipes-devtools/patchelf
parentc365e382334f61d538d8064ae44a737fd0f47d73 (diff)
downloadpoky-63b0992ab7f6d2596bcc47641c308b2c4d853445.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: 80e8f7d34d7032cc94b61bf155eac7648e6b6c74) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/patchelf')
-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