diff options
Diffstat (limited to 'meta/recipes-devtools/patchelf/patchelf')
-rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/6edec83653ce1b5fc201ff6db93b966394766814.patch | 44 | ||||
-rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch | 27 |
2 files changed, 20 insertions, 51 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 @@ -From 6edec83653ce1b5fc201ff6db93b966394766814 Mon Sep 17 00:00:00 2001 -From: rmnull <rmnull@users.noreply.github.com> -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<ElfFileParamNames>::writeReplacedSections(Elf_Off & curOff, - memset(contents + rdi(shdr.sh_offset), 'X', rdi(shdr.sh_size)); - } - -+ std::set<unsigned int> noted_phdrs = {}; - for (auto & i : replacedSections) { - std::string sectionName = i.first; - auto & shdr = findSection(sectionName); -@@ -721,7 +722,7 @@ void ElfFile<ElfFileParamNames>::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<ElfFileParamNames>::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/handle-read-only-files.patch b/meta/recipes-devtools/patchelf/patchelf/handle-read-only-files.patch index bf721c1af8..b755a263a4 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 <fabio.berton@ossystems.com.br> Date: Fri, 9 Sep 2016 16:00:42 -0300 Subject: [PATCH] handle read-only files @@ -18,9 +18,9 @@ Index: git/src/patchelf.cc =================================================================== --- git.orig/src/patchelf.cc +++ git/src/patchelf.cc -@@ -499,9 +499,19 @@ void ElfFile<ElfFileParamNames>::sortShd +@@ -534,9 +534,19 @@ void ElfFile<ElfFileParamNames>::sortShd - static void writeFile(std::string fileName, FileContents contents) + static void writeFile(const std::string & fileName, const FileContents & contents) { + struct stat st; + int fd; @@ -39,14 +39,27 @@ Index: git/src/patchelf.cc if (fd == -1) error("open"); -@@ -515,6 +525,10 @@ static void writeFile(std::string fileNa +@@ -551,8 +561,6 @@ static void writeFile(const std::string + bytesWritten += portion; + } - if (close(fd) != 0) - error("close"); +- if (close(fd) >= 0) +- return; + /* + * Just ignore EINTR; a retry loop is the wrong thing to do. + * +@@ -561,9 +569,11 @@ static void writeFile(const std::string + * http://utcc.utoronto.ca/~cks/space/blog/unix/CloseEINTR + * https://sites.google.com/site/michaelsafyan/software-engineering/checkforeintrwheninvokingclosethinkagain + */ +- if (errno == EINTR) +- return; +- error("close"); ++ if ((close(fd) < 0) && errno != EINTR) ++ error("close"); + + if (chmod(fileName.c_str(), st.st_mode) != 0) + error("chmod"); -+ } |