summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/patchelf/patchelf/0001-merge-from-PR243.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/patchelf/patchelf/0001-merge-from-PR243.patch')
-rw-r--r--meta/recipes-devtools/patchelf/patchelf/0001-merge-from-PR243.patch47
1 files changed, 47 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 @@
1From 6ac5c1350834b9da81ab90ab5ba4e5bf507c6c0d Mon Sep 17 00:00:00 2001
2From: Satadru Pramanik <satadru@gmail.com>
3Date: Thu, 20 May 2021 16:52:21 -0400
4Subject: [PATCH] merge from PR243
5
6Upstream-Status: Backport
7
8Reference to upstream patch:
9https://github.com/NixOS/patchelf/commit/4efbce410d00c8cb43f134181d07b364bcf78022
10
11[OP: tweak patch to apply to patchelf v0.10]
12Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
13[OP: tweak patch to apply to patchelf v0.12]
14Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
15---
16 src/patchelf.cc | 5 ++++-
17 1 file changed, 4 insertions(+), 1 deletion(-)
18
19diff --git a/src/patchelf.cc b/src/patchelf.cc
20index 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