From 9fdfa49ac11eff7215fab8540114535b2c652b83 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Sun, 22 Aug 2021 14:50:33 +0200 Subject: patchelf: upgrade 0.12 -> 0.13 Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- .../6edec83653ce1b5fc201ff6db93b966394766814.patch | 44 ---------------------- .../patchelf/patchelf/alignmentfix.patch | 44 ---------------------- .../patchelf/patchelf/handle-read-only-files.patch | 16 ++++---- meta/recipes-devtools/patchelf/patchelf_0.12.bb | 20 ---------- meta/recipes-devtools/patchelf/patchelf_0.13.bb | 18 +++++++++ 5 files changed, 26 insertions(+), 116 deletions(-) delete mode 100644 meta/recipes-devtools/patchelf/patchelf/6edec83653ce1b5fc201ff6db93b966394766814.patch delete mode 100644 meta/recipes-devtools/patchelf/patchelf/alignmentfix.patch delete mode 100644 meta/recipes-devtools/patchelf/patchelf_0.12.bb create mode 100644 meta/recipes-devtools/patchelf/patchelf_0.13.bb (limited to 'meta') 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 @@ -From 6edec83653ce1b5fc201ff6db93b966394766814 Mon Sep 17 00:00:00 2001 -From: rmnull -Date: Tue, 18 Aug 2020 20:22:52 +0530 -Subject: [PATCH] mark phdrs synced with sections, avoid rechecking it when - syncing note sections to segments. - -This also serves as a bug fix when a previously synced note segment -overlaps with another section and creates a false alarm. - -Upstream-Status: Backport ---- - src/patchelf.cc | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/patchelf.cc b/src/patchelf.cc -index 05ec793..622f0b6 100644 ---- a/src/patchelf.cc -+++ b/src/patchelf.cc -@@ -669,6 +669,7 @@ void ElfFile::writeReplacedSections(Elf_Off & curOff, - memset(contents + rdi(shdr.sh_offset), 'X', rdi(shdr.sh_size)); - } - -+ std::set noted_phdrs = {}; - for (auto & i : replacedSections) { - std::string sectionName = i.first; - auto & shdr = findSection(sectionName); -@@ -721,7 +722,7 @@ void ElfFile::writeReplacedSections(Elf_Off & curOff, - shdr.sh_addralign = orig_shdr.sh_addralign; - - for (unsigned int j = 0; j < phdrs.size(); ++j) -- if (rdi(phdrs[j].p_type) == PT_NOTE) { -+ if (rdi(phdrs[j].p_type) == PT_NOTE && noted_phdrs.find(j) == noted_phdrs.end()) { - Elf_Off p_start = rdi(phdrs[j].p_offset); - Elf_Off p_end = p_start + rdi(phdrs[j].p_filesz); - Elf_Off s_start = rdi(orig_shdr.sh_offset); -@@ -739,6 +740,8 @@ void ElfFile::writeReplacedSections(Elf_Off & curOff, - phdrs[j].p_offset = shdr.sh_offset; - phdrs[j].p_vaddr = phdrs[j].p_paddr = shdr.sh_addr; - phdrs[j].p_filesz = phdrs[j].p_memsz = shdr.sh_size; -+ -+ noted_phdrs.insert(j); - } - } - 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 @@ -If a binary has multiple SHT_NOTE sections and corresponding PT_NOTE -headers, we can see the error: - -patchelf: cannot normalize PT_NOTE segment: non-contiguous SHT_NOTE sections - -if the SHT_NOTE sections aren't sized to end on aligned boundaries. An example -would be a binary with: - - [ 2] .note.ABI-tag NOTE 00000000000002f4 000002f4 - 0000000000000020 0000000000000000 A 0 0 4 - [ 3] .note.gnu.propert NOTE 0000000000000318 00000318 - 0000000000000030 0000000000000000 A 0 0 8 - [ 4] .note.gnu.build-i NOTE 0000000000000348 00000348 - 0000000000000024 0000000000000000 A 0 0 4 - - NOTE 0x0000000000000318 0x0000000000000318 0x0000000000000318 - 0x0000000000000030 0x0000000000000030 R 0x8 - NOTE 0x00000000000002f4 0x00000000000002f4 0x00000000000002f4 - 0x0000000000000078 0x0000000000000074 R 0x4 - -since the PT_NOTE section at 2f4 covers [2] and [3] but the code -calclates curr_off should be 314, not the 318 in the binary. This -is an alignment issue. - -To fix this, we need to round curr_off to the next section alignment. - -Upstream-Status: Submitted [https://github.com/NixOS/patchelf/pull/274] -Signed-off-by: Richard Purdie - -Index: git/src/patchelf.cc -=================================================================== ---- git.orig/src/patchelf.cc -+++ git/src/patchelf.cc -@@ -1010,8 +1010,9 @@ void ElfFile::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) 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 @@ -From 7f1fd10cfebd5ea2f3e1938abe1bd1c4828164a7 Mon Sep 17 00:00:00 2001 +From 682fb48c137b687477008b68863c2a0b73ed47d1 Mon Sep 17 00:00:00 2001 From: Fabio Berton Date: Fri, 9 Sep 2016 16:00:42 -0300 Subject: [PATCH] handle read-only files @@ -14,13 +14,13 @@ Signed-off-by: Fabio Berton src/patchelf.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) -Index: git/src/patchelf.cc -=================================================================== ---- git.orig/src/patchelf.cc -+++ git/src/patchelf.cc -@@ -499,9 +499,19 @@ void ElfFile::sortShd +diff --git a/src/patchelf.cc b/src/patchelf.cc +index fd1e7b7..a941da1 100644 +--- a/src/patchelf.cc ++++ b/src/patchelf.cc +@@ -527,9 +527,19 @@ void ElfFile::sortShdrs() - static void writeFile(std::string fileName, FileContents contents) + static void writeFile(const std::string & fileName, const FileContents & contents) { + struct stat st; + int fd; @@ -39,7 +39,7 @@ Index: git/src/patchelf.cc if (fd == -1) error("open"); -@@ -515,6 +525,10 @@ static void writeFile(std::string fileNa +@@ -543,6 +553,10 @@ static void writeFile(const std::string & fileName, const FileContents & content if (close(fd) != 0) error("close"); diff --git a/meta/recipes-devtools/patchelf/patchelf_0.12.bb b/meta/recipes-devtools/patchelf/patchelf_0.12.bb deleted file mode 100644 index 7c97ea0789..0000000000 --- a/meta/recipes-devtools/patchelf/patchelf_0.12.bb +++ /dev/null @@ -1,20 +0,0 @@ -SUMMARY = "Tool to allow editing of RPATH and interpreter fields in ELF binaries" -DESCRIPTION = "PatchELF is a simple utility for modifying existing ELF executables and libraries." -HOMEPAGE = "https://github.com/NixOS/patchelf" - -LICENSE = "GPLv3" - -SRC_URI = "git://github.com/NixOS/patchelf;protocol=https \ - file://handle-read-only-files.patch \ - file://6edec83653ce1b5fc201ff6db93b966394766814.patch \ - file://alignmentfix.patch \ - " -SRCREV = "8d3a16e97294e3c5521c61b4c8835499c9918264" - -S = "${WORKDIR}/git" - -LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" - -inherit autotools - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-devtools/patchelf/patchelf_0.13.bb b/meta/recipes-devtools/patchelf/patchelf_0.13.bb new file mode 100644 index 0000000000..1b0561b8ba --- /dev/null +++ b/meta/recipes-devtools/patchelf/patchelf_0.13.bb @@ -0,0 +1,18 @@ +SUMMARY = "Tool to allow editing of RPATH and interpreter fields in ELF binaries" +DESCRIPTION = "PatchELF is a simple utility for modifying existing ELF executables and libraries." +HOMEPAGE = "https://github.com/NixOS/patchelf" + +LICENSE = "GPLv3" + +SRC_URI = "git://github.com/NixOS/patchelf;protocol=https \ + file://handle-read-only-files.patch \ + " +SRCREV = "a949ff23315bbb5863627c4655fe216ecbf341a2" + +S = "${WORKDIR}/git" + +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +inherit autotools + +BBCLASSEXTEND = "native nativesdk" -- cgit 1.2.3-korg