diff options
| -rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/0001-merge-from-PR243.patch | 47 | ||||
| -rw-r--r-- | meta/recipes-devtools/patchelf/patchelf_0.12.bb | 1 |
2 files changed, 48 insertions, 0 deletions
diff --git a/meta/recipes-devtools/patchelf/patchelf/0001-merge-from-PR243.patch b/meta/recipes-devtools/patchelf/patchelf/0001-merge-from-PR243.patch new file mode 100644 index 0000000000..a5322f0375 --- /dev/null +++ b/meta/recipes-devtools/patchelf/patchelf/0001-merge-from-PR243.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | From 6ac5c1350834b9da81ab90ab5ba4e5bf507c6c0d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Satadru Pramanik <satadru@gmail.com> | ||
| 3 | Date: Thu, 20 May 2021 16:52:21 -0400 | ||
| 4 | Subject: [PATCH] merge from PR243 | ||
| 5 | |||
| 6 | Upstream-Status: Backport | ||
| 7 | |||
| 8 | Reference to upstream patch: | ||
| 9 | https://github.com/NixOS/patchelf/commit/4efbce410d00c8cb43f134181d07b364bcf78022 | ||
| 10 | |||
| 11 | [OP: tweak patch to apply to patchelf v0.10] | ||
| 12 | Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> | ||
| 13 | [OP: tweak patch to apply to patchelf v0.12] | ||
| 14 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
| 15 | --- | ||
| 16 | src/patchelf.cc | 5 ++++- | ||
| 17 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
| 18 | |||
| 19 | diff --git a/src/patchelf.cc b/src/patchelf.cc | ||
| 20 | index 1854cfa..73a3a86 100644 | ||
| 21 | --- a/src/patchelf.cc | ||
| 22 | +++ b/src/patchelf.cc | ||
| 23 | @@ -774,12 +774,15 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary() | ||
| 24 | PT_LOAD segment located directly after the last virtual address | ||
| 25 | page of other segments. */ | ||
| 26 | Elf_Addr startPage = 0; | ||
| 27 | + Elf_Addr firstPage = 0; | ||
| 28 | for (unsigned int i = 0; i < phdrs.size(); ++i) { | ||
| 29 | Elf_Addr thisPage = roundUp(rdi(phdrs[i].p_vaddr) + rdi(phdrs[i].p_memsz), getPageSize()); | ||
| 30 | if (thisPage > startPage) startPage = thisPage; | ||
| 31 | + if (rdi(phdrs[i].p_type) == PT_PHDR) firstPage = rdi(phdrs[i].p_vaddr) - rdi(phdrs[i].p_offset); | ||
| 32 | } | ||
| 33 | |||
| 34 | debug("last page is 0x%llx\n", (unsigned long long) startPage); | ||
| 35 | + debug("first page is 0x%llx\n", (unsigned long long) firstPage); | ||
| 36 | |||
| 37 | /* When normalizing note segments we will in the worst case be adding | ||
| 38 | 1 program header for each SHT_NOTE section. */ | ||
| 39 | @@ -852,7 +855,7 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary() | ||
| 40 | assert(curOff == startOffset + neededSpace); | ||
| 41 | |||
| 42 | /* Write out the updated program and section headers */ | ||
| 43 | - rewriteHeaders(hdr->e_phoff); | ||
| 44 | + rewriteHeaders(firstPage + hdr->e_phoff); | ||
| 45 | } | ||
| 46 | |||
| 47 | |||
diff --git a/meta/recipes-devtools/patchelf/patchelf_0.12.bb b/meta/recipes-devtools/patchelf/patchelf_0.12.bb index 390a8110da..007435a719 100644 --- a/meta/recipes-devtools/patchelf/patchelf_0.12.bb +++ b/meta/recipes-devtools/patchelf/patchelf_0.12.bb | |||
| @@ -8,6 +8,7 @@ SRC_URI = "git://github.com/NixOS/patchelf;protocol=https;branch=master \ | |||
| 8 | file://handle-read-only-files.patch \ | 8 | file://handle-read-only-files.patch \ |
| 9 | file://6edec83653ce1b5fc201ff6db93b966394766814.patch \ | 9 | file://6edec83653ce1b5fc201ff6db93b966394766814.patch \ |
| 10 | file://alignmentfix.patch \ | 10 | file://alignmentfix.patch \ |
| 11 | file://0001-merge-from-PR243.patch \ | ||
| 11 | " | 12 | " |
| 12 | SRCREV = "8d3a16e97294e3c5521c61b4c8835499c9918264" | 13 | SRCREV = "8d3a16e97294e3c5521c61b4c8835499c9918264" |
| 13 | 14 | ||
