1 |
commit: 91a4b954e9ae0cc8e15ee0b0cd900c933ac38e41 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Feb 24 19:19:21 2017 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Feb 24 19:19:21 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91a4b954 |
7 |
|
8 |
dev-python/pyelftools: drop old <0.24 versions |
9 |
|
10 |
dev-python/pyelftools/Manifest | 2 - |
11 |
.../files/pyelftools-0.22-dyntable.patch | 153 --------------------- |
12 |
.../files/pyelftools-0.22-grace-string-dyn.patch | 75 ---------- |
13 |
dev-python/pyelftools/pyelftools-0.22.ebuild | 35 ----- |
14 |
dev-python/pyelftools/pyelftools-0.23-r1.ebuild | 30 ---- |
15 |
5 files changed, 295 deletions(-) |
16 |
|
17 |
diff --git a/dev-python/pyelftools/Manifest b/dev-python/pyelftools/Manifest |
18 |
index 426cd3327b..1515a8186a 100644 |
19 |
--- a/dev-python/pyelftools/Manifest |
20 |
+++ b/dev-python/pyelftools/Manifest |
21 |
@@ -1,3 +1 @@ |
22 |
-DIST pyelftools-0.22.tar.gz 395525 SHA256 9f7dd617b8a577a3834e7dd7f34f49df21c0670e67a48b21add19abe1adffb60 SHA512 10a84d9d0e28cb609f252990fbc05747e0840c5efeeb6890e13076aa2d59780c7d1a5bd6036dee6f8b252a984796a3834183ccab1c1988473bc69646fe56867b WHIRLPOOL eac57cef3f4159deac907394995655e227aa1d034a3b4ec54728531d08ef1b4f8edee33d971a3423b32d08efba621496bb5e778ba090bc264db6d006da4f8842 |
23 |
-DIST pyelftools-0.23.tar.gz 401363 SHA256 fc57aadd096e8f9b9b03f1a9578f673ee645e1513a5ff0192ef439e77eab21de SHA512 47102b2b0c69f357ba1c6af8e45157cd5395a74aaaf10fcccbf5b2d584a494aa16b1f6d08599459ae036f45888cb0fe422cb3241458e6ee0f1e8e1f32b3ae5d0 WHIRLPOOL 1492b08020bb7a106b939c8691f9910949a9d36241a8379f5358832b7b79a6ac1fdac4aaa928d65cd25fe466cb96bb38ef383bd9e79ae5fe0417aad53a1387a4 |
24 |
DIST pyelftools-0.24.tar.gz 411874 SHA256 e9dd97d685a5b96b88a988dabadb88e5a539b64cd7d7927fac9a7368dc4c459c SHA512 5169617f9a8446ffc21dfc44ee185a388c8945a0296bdc6752483b0756888dccb10e3ee88e529d101cf31a4595de924b5c95f5459d5ee4448f57c0c4f2c56887 WHIRLPOOL 9523129a70f76a89ca6779f00df46f975b38080a2303cf1fb3666188be0aef2602f4970d195a70325f4a44e687e6393eb779a5f7d7431400f96a8ae602a32b26 |
25 |
|
26 |
diff --git a/dev-python/pyelftools/files/pyelftools-0.22-dyntable.patch b/dev-python/pyelftools/files/pyelftools-0.22-dyntable.patch |
27 |
deleted file mode 100644 |
28 |
index 7f77304998..0000000000 |
29 |
--- a/dev-python/pyelftools/files/pyelftools-0.22-dyntable.patch |
30 |
+++ /dev/null |
31 |
@@ -1,153 +0,0 @@ |
32 |
-From b3157177bde20a2b0d0ada7b2ba44144ee5aea6f Mon Sep 17 00:00:00 2001 |
33 |
-From: Mike Frysinger <vapier@g.o> |
34 |
-Date: Sun, 9 Jun 2013 18:42:40 -0400 |
35 |
-Subject: [PATCH] support parsing of dynamic ELFs w/out section headers |
36 |
-MIME-Version: 1.0 |
37 |
-Content-Type: text/plain; charset=UTF-8 |
38 |
-Content-Transfer-Encoding: 8bit |
39 |
- |
40 |
-At runtime, ELFs do not use the section headers at all. Instead, only |
41 |
-the program segments and dynamic tags get used. This means you can |
42 |
-strip the section table completely from an ELF and have it still work. |
43 |
- |
44 |
-In practice, people rarely do this, but it's not unheard of. Make the |
45 |
-Dynamic tags work even in these cases by loading the strings table the |
46 |
-same way the runtime loader does: |
47 |
- * parse the symtab address from DT_STRTAB |
48 |
- * locate the file offset via the program segments |
49 |
- |
50 |
-In order to avoid circular deps (parsing a dyntag requires walking parsed |
51 |
-dyntags), add a set of internal funcs for returning the raw values. |
52 |
- |
53 |
-You can see this in action: |
54 |
-$ eu-strip -g --strip-sections a.out |
55 |
-$ readelf -S a.out |
56 |
-<nothing> |
57 |
-$ lddtree.py ./a.out |
58 |
-a.out (interpreter => /lib64/ld-linux-x86-64.so.2) |
59 |
- libïäöëß.so => None |
60 |
- libc.so.6 => /lib64/libc.so.6 |
61 |
- |
62 |
-Signed-off-by: Mike Frysinger <vapier@g.o> |
63 |
---- |
64 |
- elftools/elf/dynamic.py | 81 ++++++++++++++++++--- |
65 |
- test/test_dynamic.py | 28 ++++++- |
66 |
- .../aarch64_super_stripped.elf | Bin 0 -> 4136 bytes |
67 |
- 3 files changed, 97 insertions(+), 12 deletions(-) |
68 |
- create mode 100755 test/testfiles_for_unittests/aarch64_super_stripped.elf |
69 |
- |
70 |
-diff --git a/elftools/elf/dynamic.py b/elftools/elf/dynamic.py |
71 |
-index d9db870..ad5111f 100644 |
72 |
---- a/elftools/elf/dynamic.py |
73 |
-+++ b/elftools/elf/dynamic.py |
74 |
-@@ -11,9 +11,22 @@ import itertools |
75 |
- from .sections import Section |
76 |
- from .segments import Segment |
77 |
- from ..common.exceptions import ELFError |
78 |
--from ..common.utils import struct_parse |
79 |
-- |
80 |
--from .enums import ENUM_D_TAG |
81 |
-+from ..common.utils import struct_parse, parse_cstring_from_stream |
82 |
-+ |
83 |
-+ |
84 |
-+class _DynamicStringTable(object): |
85 |
-+ """ Bare string table based on values found via ELF dynamic tags and |
86 |
-+ loadable segments only. Good enough for get_string() only. |
87 |
-+ """ |
88 |
-+ def __init__(self, stream, table_offset): |
89 |
-+ self._stream = stream |
90 |
-+ self._table_offset = table_offset |
91 |
-+ |
92 |
-+ def get_string(self, offset): |
93 |
-+ """ Get the string stored at the given offset in this string table. |
94 |
-+ """ |
95 |
-+ return parse_cstring_from_stream(self._stream, |
96 |
-+ self._table_offset + offset) |
97 |
- |
98 |
- |
99 |
- class DynamicTag(object): |
100 |
-@@ -61,27 +76,71 @@ class Dynamic(object): |
101 |
- self._num_tags = -1 |
102 |
- self._offset = position |
103 |
- self._tagsize = self._elfstructs.Elf_Dyn.sizeof() |
104 |
-- self._stringtable = stringtable |
105 |
-+ self.__stringtable = stringtable |
106 |
- |
107 |
-- def iter_tags(self, type=None): |
108 |
-- """ Yield all tags (limit to |type| if specified) |
109 |
-+ @property |
110 |
-+ def _stringtable(self): |
111 |
-+ """ Return a string table for looking up dynamic tag related strings. |
112 |
-+ |
113 |
-+ This won't be a "full" string table object, but will at least support |
114 |
-+ the get_string() function. |
115 |
-+ """ |
116 |
-+ if self.__stringtable: |
117 |
-+ return self.__stringtable |
118 |
-+ |
119 |
-+ # If the ELF has stripped its section table (which is unusual, but |
120 |
-+ # perfectly valid), we need to use the dynamic tags to locate the |
121 |
-+ # dynamic string table. |
122 |
-+ strtab = None |
123 |
-+ for tag in self._iter_tags(type='DT_STRTAB'): |
124 |
-+ strtab = tag['d_val'] |
125 |
-+ break |
126 |
-+ # If we found a dynamic string table, locate the offset in the file |
127 |
-+ # by using the program headers. |
128 |
-+ if strtab: |
129 |
-+ for segment in self._elffile.iter_segments(): |
130 |
-+ if (strtab >= segment['p_vaddr'] and |
131 |
-+ strtab < segment['p_vaddr'] + segment['p_filesz']): |
132 |
-+ self.__stringtable = _DynamicStringTable( |
133 |
-+ self._stream, |
134 |
-+ segment['p_offset'] + (strtab - segment['p_vaddr'])) |
135 |
-+ return self.__stringtable |
136 |
-+ |
137 |
-+ # That didn't work for some reason. Let's use the section header |
138 |
-+ # even though this ELF is super weird. |
139 |
-+ self.__stringtable = self._elffile.get_section_by_name(b'.dynstr') |
140 |
-+ |
141 |
-+ return self.__stringtable |
142 |
-+ |
143 |
-+ def _iter_tags(self, type=None): |
144 |
-+ """ Yield all raw tags (limit to |type| if specified) |
145 |
- """ |
146 |
- for n in itertools.count(): |
147 |
-- tag = self.get_tag(n) |
148 |
-- if type is None or tag.entry.d_tag == type: |
149 |
-+ tag = self._get_tag(n) |
150 |
-+ if type is None or tag['d_tag'] == type: |
151 |
- yield tag |
152 |
-- if tag.entry.d_tag == 'DT_NULL': |
153 |
-+ if tag['d_tag'] == 'DT_NULL': |
154 |
- break |
155 |
- |
156 |
-- def get_tag(self, n): |
157 |
-- """ Get the tag at index #n from the file (DynamicTag object) |
158 |
-+ def iter_tags(self, type=None): |
159 |
-+ """ Yield all tags (limit to |type| if specified) |
160 |
-+ """ |
161 |
-+ for tag in self._iter_tags(type=type): |
162 |
-+ yield DynamicTag(tag, self._stringtable) |
163 |
-+ |
164 |
-+ def _get_tag(self, n): |
165 |
-+ """ Get the raw tag at index #n from the file |
166 |
- """ |
167 |
- offset = self._offset + n * self._tagsize |
168 |
-- entry = struct_parse( |
169 |
-+ return struct_parse( |
170 |
- self._elfstructs.Elf_Dyn, |
171 |
- self._stream, |
172 |
- stream_pos=offset) |
173 |
-- return DynamicTag(entry, self._stringtable) |
174 |
-+ |
175 |
-+ def get_tag(self, n): |
176 |
-+ """ Get the tag at index #n from the file (DynamicTag object) |
177 |
-+ """ |
178 |
-+ return DynamicTag(self._get_tag(n), self._stringtable) |
179 |
- |
180 |
- def num_tags(self): |
181 |
- """ Number of dynamic tags in the file |
182 |
--- |
183 |
-2.0.0 |
184 |
- |
185 |
|
186 |
diff --git a/dev-python/pyelftools/files/pyelftools-0.22-grace-string-dyn.patch b/dev-python/pyelftools/files/pyelftools-0.22-grace-string-dyn.patch |
187 |
deleted file mode 100644 |
188 |
index 1c9552d027..0000000000 |
189 |
--- a/dev-python/pyelftools/files/pyelftools-0.22-grace-string-dyn.patch |
190 |
+++ /dev/null |
191 |
@@ -1,75 +0,0 @@ |
192 |
-From 80305ad20ebd481dde19fa7ff2d90249269aa588 Mon Sep 17 00:00:00 2001 |
193 |
-From: Eli Bendersky <eliben@×××××.com> |
194 |
-Date: Wed, 23 Apr 2014 16:44:11 -0700 |
195 |
-Subject: [PATCH] Issue #29: Fail more gracefully when no string table is found |
196 |
- for dynamic. |
197 |
- |
198 |
---- |
199 |
- elftools/elf/dynamic.py | 4 ++++ |
200 |
- test/test_dynamic.py | 25 +++++++++++++++++++++++++ |
201 |
- 2 files changed, 29 insertions(+) |
202 |
- create mode 100644 test/test_dynamic.py |
203 |
- |
204 |
-diff --git a/elftools/elf/dynamic.py b/elftools/elf/dynamic.py |
205 |
-index e36598e..6f88bf9 100644 |
206 |
---- a/elftools/elf/dynamic.py |
207 |
-+++ b/elftools/elf/dynamic.py |
208 |
-@@ -10,6 +10,7 @@ import itertools |
209 |
- |
210 |
- from .sections import Section |
211 |
- from .segments import Segment |
212 |
-+from ..common.exceptions import ELFError |
213 |
- from ..common.utils import struct_parse |
214 |
- |
215 |
- from .enums import ENUM_D_TAG |
216 |
-@@ -29,6 +30,8 @@ class DynamicTag(object): |
217 |
- 'DT_SUNW_FILTER']) |
218 |
- |
219 |
- def __init__(self, entry, stringtable): |
220 |
-+ if stringtable is None: |
221 |
-+ raise ELFError('Creating DynamicTag without string table') |
222 |
- self.entry = entry |
223 |
- if entry.d_tag in self._HANDLED_TAGS: |
224 |
- setattr(self, entry.d_tag[3:].lower(), |
225 |
-@@ -114,6 +117,7 @@ class DynamicSegment(Segment, Dynamic): |
226 |
- # So we must look for the dynamic section contained in the dynamic |
227 |
- # segment, we do so by searching for the dynamic section whose content |
228 |
- # is located at the same offset as the dynamic segment |
229 |
-+ stringtable = None |
230 |
- for section in elffile.iter_sections(): |
231 |
- if (isinstance(section, DynamicSection) and |
232 |
- section['sh_offset'] == header['p_offset']): |
233 |
-diff --git a/test/test_dynamic.py b/test/test_dynamic.py |
234 |
-new file mode 100644 |
235 |
-index 0000000..0ee9b35 |
236 |
---- /dev/null |
237 |
-+++ b/test/test_dynamic.py |
238 |
-@@ -0,0 +1,25 @@ |
239 |
-+#------------------------------------------------------------------------------- |
240 |
-+# elftools tests |
241 |
-+# |
242 |
-+# Eli Bendersky (eliben@×××××.com) |
243 |
-+# This code is in the public domain |
244 |
-+#------------------------------------------------------------------------------- |
245 |
-+try: |
246 |
-+ import unittest2 as unittest |
247 |
-+except ImportError: |
248 |
-+ import unittest |
249 |
-+import os |
250 |
-+ |
251 |
-+from utils import setup_syspath; setup_syspath() |
252 |
-+from elftools.common.exceptions import ELFError |
253 |
-+from elftools.elf.dynamic import DynamicTag |
254 |
-+ |
255 |
-+ |
256 |
-+class TestDynamicTag(unittest.TestCase): |
257 |
-+ def test_requires_stringtable(self): |
258 |
-+ with self.assertRaises(ELFError): |
259 |
-+ dt = DynamicTag('', None) |
260 |
-+ |
261 |
-+ |
262 |
-+if __name__ == '__main__': |
263 |
-+ unittest.main() |
264 |
--- |
265 |
-2.0.0 |
266 |
- |
267 |
|
268 |
diff --git a/dev-python/pyelftools/pyelftools-0.22.ebuild b/dev-python/pyelftools/pyelftools-0.22.ebuild |
269 |
deleted file mode 100644 |
270 |
index aec8e53944..0000000000 |
271 |
--- a/dev-python/pyelftools/pyelftools-0.22.ebuild |
272 |
+++ /dev/null |
273 |
@@ -1,35 +0,0 @@ |
274 |
-# Copyright 1999-2016 Gentoo Foundation |
275 |
-# Distributed under the terms of the GNU General Public License v2 |
276 |
-# $Id$ |
277 |
- |
278 |
-EAPI="5" |
279 |
- |
280 |
-PYTHON_COMPAT=( python{2_7,3_4} ) |
281 |
-inherit distutils-r1 |
282 |
- |
283 |
-DESCRIPTION="pure-Python library for analyzing ELF files and DWARF debugging information" |
284 |
-HOMEPAGE="https://pypi.python.org/pypi/pyelftools https://github.com/eliben/pyelftools" |
285 |
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" |
286 |
- |
287 |
-LICENSE="public-domain" |
288 |
-SLOT="0" |
289 |
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" |
290 |
-IUSE="examples" |
291 |
- |
292 |
-PATCHES=( |
293 |
- "${FILESDIR}"/${P}-grace-string-dyn.patch |
294 |
- "${FILESDIR}"/${P}-dyntable.patch |
295 |
-) |
296 |
- |
297 |
-python_test() { |
298 |
- # readelf_tests often fails due to host `readelf` changing output format |
299 |
- local t |
300 |
- for t in all_unittests examples_test ; do |
301 |
- "${PYTHON}" ./test/run_${t}.py || die "Tests fail with ${EPYTHON}" |
302 |
- done |
303 |
-} |
304 |
- |
305 |
-python_install_all() { |
306 |
- use examples && local EXAMPLES=( examples/. ) |
307 |
- distutils-r1_python_install_all |
308 |
-} |
309 |
|
310 |
diff --git a/dev-python/pyelftools/pyelftools-0.23-r1.ebuild b/dev-python/pyelftools/pyelftools-0.23-r1.ebuild |
311 |
deleted file mode 100644 |
312 |
index deffb37f4a..0000000000 |
313 |
--- a/dev-python/pyelftools/pyelftools-0.23-r1.ebuild |
314 |
+++ /dev/null |
315 |
@@ -1,30 +0,0 @@ |
316 |
-# Copyright 1999-2016 Gentoo Foundation |
317 |
-# Distributed under the terms of the GNU General Public License v2 |
318 |
-# $Id$ |
319 |
- |
320 |
-EAPI="5" |
321 |
- |
322 |
-PYTHON_COMPAT=( python2_7 python3_{4,5} ) |
323 |
-inherit distutils-r1 |
324 |
- |
325 |
-DESCRIPTION="pure-Python library for analyzing ELF files and DWARF debugging information" |
326 |
-HOMEPAGE="https://pypi.python.org/pypi/pyelftools https://github.com/eliben/pyelftools" |
327 |
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" |
328 |
- |
329 |
-LICENSE="public-domain" |
330 |
-SLOT="0" |
331 |
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" |
332 |
-IUSE="examples" |
333 |
- |
334 |
-python_test() { |
335 |
- # readelf_tests often fails due to host `readelf` changing output format |
336 |
- local t |
337 |
- for t in all_unittests examples_test ; do |
338 |
- "${PYTHON}" ./test/run_${t}.py || die "Tests fail with ${EPYTHON}" |
339 |
- done |
340 |
-} |
341 |
- |
342 |
-python_install_all() { |
343 |
- use examples && local EXAMPLES=( examples/. ) |
344 |
- distutils-r1_python_install_all |
345 |
-} |