diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2021-08-22 14:50:33 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-08-23 08:25:52 +0100 |
commit | 253fca82465c004ae9cb40aa8c2b35e918565fc0 (patch) | |
tree | 3787e21ae9f9a71f2058bc59df67e2bf5ed0df2f /meta/recipes-devtools | |
parent | 9a262e903894a9b52a8710ed47f5af9107962424 (diff) | |
download | poky-253fca82465c004ae9cb40aa8c2b35e918565fc0.tar.gz |
patchelf: upgrade 0.12 -> 0.13
(From OE-Core rev: 9fdfa49ac11eff7215fab8540114535b2c652b83)
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/6edec83653ce1b5fc201ff6db93b966394766814.patch | 44 | ||||
-rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/alignmentfix.patch | 44 | ||||
-rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch | 16 | ||||
-rw-r--r-- | meta/recipes-devtools/patchelf/patchelf_0.13.bb (renamed from meta/recipes-devtools/patchelf/patchelf_0.12.bb) | 4 |
4 files changed, 9 insertions, 99 deletions
diff --git a/meta/recipes-devtools/patchelf/patchelf/6edec83653ce1b5fc201ff6db93b966394766814.patch b/meta/recipes-devtools/patchelf/patchelf/6edec83653ce1b5fc201ff6db93b966394766814.patch deleted file mode 100644 index ba35ec6ffc..0000000000 --- a/meta/recipes-devtools/patchelf/patchelf/6edec83653ce1b5fc201ff6db93b966394766814.patch +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | From 6edec83653ce1b5fc201ff6db93b966394766814 Mon Sep 17 00:00:00 2001 | ||
2 | From: rmnull <rmnull@users.noreply.github.com> | ||
3 | Date: Tue, 18 Aug 2020 20:22:52 +0530 | ||
4 | Subject: [PATCH] mark phdrs synced with sections, avoid rechecking it when | ||
5 | syncing note sections to segments. | ||
6 | |||
7 | This also serves as a bug fix when a previously synced note segment | ||
8 | overlaps with another section and creates a false alarm. | ||
9 | |||
10 | Upstream-Status: Backport | ||
11 | --- | ||
12 | src/patchelf.cc | 5 ++++- | ||
13 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/src/patchelf.cc b/src/patchelf.cc | ||
16 | index 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/alignmentfix.patch b/meta/recipes-devtools/patchelf/patchelf/alignmentfix.patch deleted file mode 100644 index a06876e50a..0000000000 --- a/meta/recipes-devtools/patchelf/patchelf/alignmentfix.patch +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | If a binary has multiple SHT_NOTE sections and corresponding PT_NOTE | ||
2 | headers, we can see the error: | ||
3 | |||
4 | patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections | ||
5 | |||
6 | if the SHT_NOTE sections aren't sized to end on aligned boundaries. An example | ||
7 | would be a binary with: | ||
8 | |||
9 | [ 2] .note.ABI-tag NOTE 00000000000002f4 000002f4 | ||
10 | 0000000000000020 0000000000000000 A 0 0 4 | ||
11 | [ 3] .note.gnu.propert NOTE 0000000000000318 00000318 | ||
12 | 0000000000000030 0000000000000000 A 0 0 8 | ||
13 | [ 4] .note.gnu.build-i NOTE 0000000000000348 00000348 | ||
14 | 0000000000000024 0000000000000000 A 0 0 4 | ||
15 | |||
16 | NOTE 0x0000000000000318 0x0000000000000318 0x0000000000000318 | ||
17 | 0x0000000000000030 0x0000000000000030 R 0x8 | ||
18 | NOTE 0x00000000000002f4 0x00000000000002f4 0x00000000000002f4 | ||
19 | 0x0000000000000078 0x0000000000000074 R 0x4 | ||
20 | |||
21 | since the PT_NOTE section at 2f4 covers [2] and [3] but the code | ||
22 | calclates curr_off should be 314, not the 318 in the binary. This | ||
23 | is an alignment issue. | ||
24 | |||
25 | To fix this, we need to round curr_off to the next section alignment. | ||
26 | |||
27 | Upstream-Status: Submitted [https://github.com/NixOS/patchelf/pull/274] | ||
28 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
29 | |||
30 | Index: git/src/patchelf.cc | ||
31 | =================================================================== | ||
32 | --- git.orig/src/patchelf.cc | ||
33 | +++ git/src/patchelf.cc | ||
34 | @@ -1010,8 +1010,9 @@ void ElfFile<ElfFileParamNames>::normali | ||
35 | size_t size = 0; | ||
36 | for (const auto & shdr : shdrs) { | ||
37 | if (rdi(shdr.sh_type) != SHT_NOTE) continue; | ||
38 | - if (rdi(shdr.sh_offset) != curr_off) continue; | ||
39 | + if (rdi(shdr.sh_offset) != roundUp(curr_off, rdi(shdr.sh_addralign))) continue; | ||
40 | size = rdi(shdr.sh_size); | ||
41 | + curr_off = roundUp(curr_off, rdi(shdr.sh_addralign)); | ||
42 | break; | ||
43 | } | ||
44 | if (size == 0) | ||
diff --git a/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch b/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch index bf721c1af8..63080a42d4 100644 --- a/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch +++ b/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 7f1fd10cfebd5ea2f3e1938abe1bd1c4828164a7 Mon Sep 17 00:00:00 2001 | 1 | From 682fb48c137b687477008b68863c2a0b73ed47d1 Mon Sep 17 00:00:00 2001 |
2 | From: Fabio Berton <fabio.berton@ossystems.com.br> | 2 | From: Fabio Berton <fabio.berton@ossystems.com.br> |
3 | Date: Fri, 9 Sep 2016 16:00:42 -0300 | 3 | Date: Fri, 9 Sep 2016 16:00:42 -0300 |
4 | Subject: [PATCH] handle read-only files | 4 | Subject: [PATCH] handle read-only files |
@@ -14,13 +14,13 @@ Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br> | |||
14 | src/patchelf.cc | 16 +++++++++++++++- | 14 | src/patchelf.cc | 16 +++++++++++++++- |
15 | 1 file changed, 15 insertions(+), 1 deletion(-) | 15 | 1 file changed, 15 insertions(+), 1 deletion(-) |
16 | 16 | ||
17 | Index: git/src/patchelf.cc | 17 | diff --git a/src/patchelf.cc b/src/patchelf.cc |
18 | =================================================================== | 18 | index fd1e7b7..a941da1 100644 |
19 | --- git.orig/src/patchelf.cc | 19 | --- a/src/patchelf.cc |
20 | +++ git/src/patchelf.cc | 20 | +++ b/src/patchelf.cc |
21 | @@ -499,9 +499,19 @@ void ElfFile<ElfFileParamNames>::sortShd | 21 | @@ -527,9 +527,19 @@ void ElfFile<ElfFileParamNames>::sortShdrs() |
22 | 22 | ||
23 | static void writeFile(std::string fileName, FileContents contents) | 23 | static void writeFile(const std::string & fileName, const FileContents & contents) |
24 | { | 24 | { |
25 | + struct stat st; | 25 | + struct stat st; |
26 | + int fd; | 26 | + int fd; |
@@ -39,7 +39,7 @@ Index: git/src/patchelf.cc | |||
39 | if (fd == -1) | 39 | if (fd == -1) |
40 | error("open"); | 40 | error("open"); |
41 | 41 | ||
42 | @@ -515,6 +525,10 @@ static void writeFile(std::string fileNa | 42 | @@ -543,6 +553,10 @@ static void writeFile(const std::string & fileName, const FileContents & content |
43 | 43 | ||
44 | if (close(fd) != 0) | 44 | if (close(fd) != 0) |
45 | error("close"); | 45 | error("close"); |
diff --git a/meta/recipes-devtools/patchelf/patchelf_0.12.bb b/meta/recipes-devtools/patchelf/patchelf_0.13.bb index 7c97ea0789..1b0561b8ba 100644 --- a/meta/recipes-devtools/patchelf/patchelf_0.12.bb +++ b/meta/recipes-devtools/patchelf/patchelf_0.13.bb | |||
@@ -6,10 +6,8 @@ LICENSE = "GPLv3" | |||
6 | 6 | ||
7 | SRC_URI = "git://github.com/NixOS/patchelf;protocol=https \ | 7 | SRC_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 \ | ||
10 | file://alignmentfix.patch \ | ||
11 | " | 9 | " |
12 | SRCREV = "8d3a16e97294e3c5521c61b4c8835499c9918264" | 10 | SRCREV = "a949ff23315bbb5863627c4655fe216ecbf341a2" |
13 | 11 | ||
14 | S = "${WORKDIR}/git" | 12 | S = "${WORKDIR}/git" |
15 | 13 | ||