Eli Bendersky [Fri, 13 Mar 2020 12:23:00 +0000 (05:23 -0700)]
Clean up whitespace
Eli Bendersky [Mon, 9 Mar 2020 12:42:34 +0000 (05:42 -0700)]
Remove some unconditional printouts in unit tests
Andreas Ziegler [Mon, 9 Mar 2020 12:39:23 +0000 (13:39 +0100)]
{GNU,}HashSection: Implement symbol lookup (#290)
In super-stripped binaries, symbol tables can not be accessed
directly as we do not have section headers to find them. In
this case, we can already use the mandatory DynamicSegment
which provides methods for individual access and iteration
over symbols via a minimal implementation of symbol hash
sections which only provided the number of symbols so far.
As we can also directly look up symbols via the hash table,
let's implement this functionality as well.
The code is based on @rhelmot's implementation as discussed
in #219, with some changes around reading the hash parameters.
For supporting individual symbol lookup, we also need the
corresponding symbol table to get the Symbol objects if the
matching hash was found in the hash section. In regular ELF
files, the symbol table is denoted by the section index
provided in the sh_link field of the hash section and
automatically created when building the hash section, for
super-stripped binaries we can use the DynamicSegment (which
needs to be present in any case) as the symbol table as it
also provides a get_symbol() method relying on other ways to
determine the list of symbols. Both of these variants can be
seen in the improved test_hash.py file.
The hash tables are implemented in a base class which does not
derive from the Section class in order to allow instantiation
even if no section headers are present in the underlying file.
Pierre-Marie de Rodat [Mon, 9 Mar 2020 12:36:55 +0000 (13:36 +0100)]
Minor enhancements for readelf-based tests (#293)
* Add handling for SHT_MIPS_ABIFLAGS section types
* Add handling for SHF_MASKPROC section flags
* Add handling for DT_MIPS_FLAGS dynamic table entries
* Display DT_MIPS_SYMTABNO and DT_MIPS_LOCAL_GOTNO entries as decimal ints
* Adjust display of NT_GNU_GOLD_VERSION notes
Andreas Ziegler [Sat, 7 Mar 2020 14:32:40 +0000 (15:32 +0100)]
readelf: print addend for RELA relocations without symbol (#292)
* readelf: print addend for RELA relocations without symbol
When processing relocations from a SHT_RELA type section, GNU
readelf displays the value of the 'r_addend' field if no
symbol index is given (that is, 'r_info_sym' is 0).
By also implementing this we can better test the output for
64-bit binaries which commonly use SHT_RELA relocations.
The included test file is the same as tls.elf but compiled
for x86_64. Its code is the following:
__thread int i;
int main(){}
and it is compiled using the following command line:
$ gcc -m64 -o tls64.elf tls.c
* test: add source file for tls{,64}.elf
The comments at the top describe how to compile the source
file into tls.elf and tls64.elf.
Eli Bendersky [Sat, 7 Mar 2020 14:26:31 +0000 (06:26 -0800)]
Fix up README
Andreas Ziegler [Sat, 7 Mar 2020 14:05:42 +0000 (15:05 +0100)]
readelf.py: adapt section mapping output for .tbss sections (#289)
* readelf.py: adapt section mapping output for .tbss sections
GNU readelf does not show the .tbss section as part of the
loaded data segment when listing the section to segment
mappings, using the ELF_TBSS_SPECIAL macro in
include/elf/internal.h to skip printing the section name.
Implement the same logic in readelf.py.
* test: add test file for .tbss output in readelf.py
This test file includes a .tbss section which is not output
by GNU readelf as part of the loaded data segment when
listing the section to segment mappings.
The source code for tls.elf is simply:
__thread int i;
int main(){}
The file was compiled using the following command line:
$ gcc -o tls.elf -m32 tls.c
Seva Alekseyev [Sat, 7 Mar 2020 14:05:01 +0000 (09:05 -0500)]
DW_AT_const_value is not a location, take 2 (#277)
Fixes #274
Eli Bendersky [Sat, 7 Mar 2020 13:42:21 +0000 (05:42 -0800)]
Reformat comments and a bit of test logic
Audrey Dutcher [Sat, 7 Mar 2020 13:39:13 +0000 (20:39 +0700)]
Add resilience for degenerate cases present in files with only debug information (#287)
Some ELF files which contain only debug symbols have important sections present in the section table but marked as NOBITS instead of PROGBITS. Attempting to extract the segments can lead to crashes through parsing invalid data.
The first patch modifies the dynamic segment/section specifically to add a flag for this case, since it seems to assume that there will always be at least one entry, DT_NULL.
The second patch modifies the segment code more generally to return a dummy answer for what data it holds. The actual way that this change prevents a crash is while trying to parse .eh_frame when it is in fact NOBITS - originally I had a more targeted patch, but decided that it was important enough to do more generally
Eli Bendersky [Sat, 7 Mar 2020 13:35:44 +0000 (05:35 -0800)]
Reflow comments and clean up whitespace
Eli Bendersky [Sat, 7 Mar 2020 13:34:36 +0000 (05:34 -0800)]
Merge branch 'master' of github.com:eliben/pyelftools
Seva Alekseyev [Sat, 7 Mar 2020 13:34:29 +0000 (08:34 -0500)]
ref_addr size changed between v2 and v3 - take 2 (#273)
In DWARF 2, the DW_FORM_ref_addr format matches the target address size, while in DWARF3+ it matches the bitness of the CU record. Here are the relevant fragments from the spec, part 7:
v2:
The second type of reference is the address of any debugging information entry within the same executable or shared object; it may refer to an entry in a different compilation unit from the unit containing the reference. This type of reference (DW_FORM_ref_addr) is the size of an address on the target architecture; it is relocatable in a relocatable object file and relocated in an executable file or shared object.
v3:
The second type of reference can identify any debugging information entry within a program; in particular, it may refer to an entry in a different compilation unit from the unit containing the reference, and may refer to an entry in a different shared object. This type of reference (DW_FORM_ref_addr) is an offset from the beginning of the .debug_info section of the target executable or shared object; it is relocatable in a relocatable object file and frequently relocated in an executable file or shared object. For references from one shared object or static executable file to another, the relocation and identification of the target object must be performed by the consumer. In the 32-bit DWARF format, this offset is a 4-byte unsigned value; in the 64-bit DWARF format, it is an 8-byte unsigned value (see Section 7.4).
If elftools encounters 32-bit DWARF v2 targeting a 64-bit architecture, it will misparse DW_FORM_ref_addr and crash downstream.
I encountered this in an iOS binary from 2017, built with Xcode several versions ago for ARM64. This probably never came up before because by the time 64 bit code became relevant, most toolchains would generate DWARF 3 or newer.
Co-authored-by: Seva Alekseyev <sevaa@nih.gov>
Eli Bendersky [Sat, 7 Mar 2020 13:25:38 +0000 (05:25 -0800)]
Fix typo in comment
William Woodruff [Sat, 7 Mar 2020 13:24:43 +0000 (08:24 -0500)]
examples: Add dwarf_lineprogram_filenames.py (#285)
This adds an example of the operation discussed in #283.
Usage:
python3 ./dwarf_lineprogram_filenames.py --test x.elf y.elf z.elf
Andreas Ziegler [Fri, 6 Mar 2020 14:00:26 +0000 (15:00 +0100)]
construct_utils.py: add missing import (#291)
Add a forgotten import of SizeofError.
Fixes: #278
Eli Bendersky [Tue, 4 Feb 2020 14:21:28 +0000 (06:21 -0800)]
Move test file name to be included in distribution
Fixes #260
Eli Bendersky [Tue, 4 Feb 2020 13:42:26 +0000 (05:42 -0800)]
Reformat whitespace in dwarf enums
Seva Alekseyev [Tue, 4 Feb 2020 13:37:04 +0000 (08:37 -0500)]
DWARF 5 tags and attributes (#271)
Eli Bendersky [Tue, 4 Feb 2020 13:33:02 +0000 (05:33 -0800)]
Trim whitespace
Fish [Tue, 4 Feb 2020 13:32:30 +0000 (06:32 -0700)]
Make sure ELFFile.has_dwarf_info() returns a boolean. (#266)
Andreas Ziegler [Tue, 4 Feb 2020 13:30:09 +0000 (14:30 +0100)]
segments.py: fix TLS checks in section_in_segment() (#275)
While the comment in section_in_segment() suggests that the
logic follows the logic inside ELF_SECTION_IN_SEGMENT_1 with
the strict parameter set, all of the checks in the binutils
macro are written so that they must succeed for the section
to be contained in the current segment. In our implementation,
however, the checks were not properly negated.
This showed in the case of .tdata and .tbss which did not
appear in the section to segment mapping (these sections are
found in glibc, for example).
Fix it up by aligning the logic more closely to the binutils
macro by implementing the same logic and returning False only
if the checks fail. Additionally, introduce the third check
from the upstream binutils which checks the combination of
SHT_ALLOC sections and PT_LOAD-like segments.
Furthermore, in the original check, the PT_GNU_RELRO type was
misspelled with a 0 (zero) instead of an O so this check
could never have worked.
Fixes: #263
Eli Bendersky [Tue, 4 Feb 2020 13:20:27 +0000 (05:20 -0800)]
Travis: drop Python 3.4, add 3.8
Tim Gates [Mon, 16 Dec 2019 13:23:09 +0000 (00:23 +1100)]
Fix simple typo: wether -> whether (#259)
Closes #258
Eli Bendersky [Mon, 9 Dec 2019 13:24:36 +0000 (05:24 -0800)]
Tweak release instructions in TODO
Eli Bendersky [Thu, 5 Dec 2019 13:43:23 +0000 (05:43 -0800)]
Update release notes in TODO
Eli Bendersky [Thu, 5 Dec 2019 13:34:21 +0000 (05:34 -0800)]
Prepare for release 0.26
William Woodruff [Fri, 8 Nov 2019 03:07:28 +0000 (22:07 -0500)]
Lazy DIE parsing (#249)
Supersedes/closes #216.
William Woodruff [Sun, 27 Oct 2019 13:10:49 +0000 (09:10 -0400)]
elf/constants: Add SHN_XINDEX (#248)
Olof Johansson [Mon, 21 Oct 2019 12:18:44 +0000 (05:18 -0700)]
Include README.rst instead of README in manifest (#247)
`setup.py bdist_wheel` warns about not finding README.
William Woodruff [Fri, 18 Oct 2019 16:17:27 +0000 (12:17 -0400)]
dwarf/die: Handle DW_FORM_flag_present in value translation (#246)
* dwarf/die: Handle DW_FORM_flag_present in value translation
When an attribute has form DW_FORM_flag_present it is implicitly
indicated as present, with no actual value.
Ref. DWARFv4, section 7.
* test: Add DW_FORM_flag_present value test
* test: Fix iteration
* test: Remove old assert
William Woodruff [Fri, 4 Oct 2019 22:24:46 +0000 (18:24 -0400)]
dwarf/constants: More DW_LANG, DW_ATE constants (#245)
Most of these were added in DWARFv5.
Eli Bendersky [Fri, 4 Oct 2019 13:08:39 +0000 (06:08 -0700)]
Realign columns for some constants
William Woodruff [Fri, 4 Oct 2019 13:06:05 +0000 (09:06 -0400)]
dwarf/enums: More attributes, tags, and forms (#244)
William Woodruff [Thu, 3 Oct 2019 14:13:39 +0000 (10:13 -0400)]
dwarf/enums Add GNU parameter tags (#242)
William Woodruff [Wed, 18 Sep 2019 12:21:42 +0000 (08:21 -0400)]
dwarf_expr: Add DW_OP_{lo,hi}_user (#239)
William Woodruff [Tue, 17 Sep 2019 12:17:55 +0000 (08:17 -0400)]
dwarf_expr: Add DWARFv5 OPs (#240)
Eli Bendersky [Wed, 11 Sep 2019 13:02:15 +0000 (06:02 -0700)]
Portable import of collections.Mapping
Tested with Python 3.8
Based on #237 by @Plailect. Closes #237
Anders Dellien [Fri, 2 Aug 2019 13:56:49 +0000 (15:56 +0200)]
Improved handling of location information (#225)
This commit moves some of the location-handling code from the examples
to a new class (LocationParser) in order to make it more reusable.
Also adds two test files containing location information.
Dmitry Koltunov [Tue, 30 Jul 2019 03:11:38 +0000 (06:11 +0300)]
Fix for `CFIEntry.get_decoded()` (#232)
* test: test `CFIEntry.get_decoded()`
This test detects an error in `CFIEntry.get_decoded()`, that occurs when
decodes the `DW_CFA_def_cfa_register` instruction without some CFA
definition previously.
Signed-off-by: Koltunov Dmitry <koltunov@ispras.ru>
* add empty `cfa` for fixup decode of the `DW_CFA_def_cfa_register`
Signed-off-by: Koltunov Dmitry <koltunov@ispras.ru>
William Woodruff [Thu, 18 Jul 2019 13:29:00 +0000 (09:29 -0400)]
dwarf/descriptions: Remove DW_LANG_Upc (#234)
The standard defines only DW_LANG_UPC, and this
value also contained a typo.
William Woodruff [Thu, 18 Jul 2019 13:28:23 +0000 (09:28 -0400)]
dwarf_expr: Add DW_OP_{implicit,stack}_value (#233)
Eli Bendersky [Sat, 22 Jun 2019 12:19:54 +0000 (05:19 -0700)]
Bump minimal supported Python 3.x version to 3.4 and add testing with 3.7
Scott Johnson [Sat, 22 Jun 2019 12:16:23 +0000 (05:16 -0700)]
Fix deprecation warning in Python 3.7 (#231)
$SITE_PYTHON/lib/python3.7/site-packages/elftools/construct/lib/container.py:5
Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
This change is compatible with Python 3.3 and up, when the ABCs were
moved to collections.abc. Backward compatibility is retained through
the try/except block.
zephyrj [Mon, 22 Apr 2019 12:07:27 +0000 (13:07 +0100)]
Add ability to parse the NT_FILE note found in core files (#220)
Andreas Ziegler [Tue, 19 Mar 2019 01:48:19 +0000 (02:48 +0100)]
Improve symbol table handling in DynamicSegment (#219)
dynamic: parse DT_{GNU_}HASH for number of symbols
In ultra-stripped binaries we can find the symbol table by
parsing the dynamic segment and using the pointer in the
DT_SYMTAB tag as the base address. However, we don't know
anything about the number of symbols in the symbol table.
Earlier, this code relied on finding the closest pointer
value bigger than the base address of the symbol table. In
PIE executables and shared libraries however this method
could break as the pointer value for DT_SYMTAB is in the same
range as things like DT_RELASZ or DT_STRSZ, leading to a too
small number of symbols returned by iter_symbols().
The crashpad project has implemented a different strategy to
find the number of symbols: parsing the symbol lookup hash
tables (see [0]) as every symbol must have a corresponding
entry in the hash table. This commit implements this
behaviour for DynamicSegment, leaving the old code as a
backup if neither DT_HASH or DT_GNU_HASH tags have been
found.
For DT_HASH type tables, it is quite easy as the header
already contains the number of entries. For DT_GNU_HASH
things are a bit more complicated as we need to work forward
from the highest symbol referenced in the header (a good
explanation of the format can be found at [1]).
[0]: https://github.com/chromium/crashpad/commit/
1f1657d573c789aa36b6022440e34d9ec30d894c
[1]: https://flapenguin.me/2017/05/10/elf-lookup-dt-gnu-hash/
* dynamic: provide more functions for symbol access
So far, the DynamicSegment only provided a method to iterate
over all symbols but for some use cases it might be useful to
use the recovered symbol table more like a normal
SymbolTableSection.
To this end, provide get_symbol(index) to fetch a symbol by
its index, num_symbols() to get the total number of symbols
and get_symbol_by_name(name) to look for a list of symbols
with a given name.
Robert Xiao [Sat, 16 Mar 2019 13:48:47 +0000 (06:48 -0700)]
Enable parsing of relocations pointed to by DYNAMIC. (#135)
Robert Xiao [Mon, 11 Mar 2019 13:28:25 +0000 (06:28 -0700)]
Fix LookupError when testing with tox (#221)
On macOS I'm getting the following error when testing with tox on py27:
```
ERROR: invocation failed (exit code 1), logfile: /devel/pyelftools/.tox/py27/log/py27-33.log
ERROR: actionid: py27
msg: installpkg
cmdargs: ['/devel/pyelftools/.tox/py27/bin/pip', 'install', '-U', '--no-deps', '/devel/pyelftools/.tox/dist/pyelftools-0.25.zip']
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Processing ./.tox/dist/pyelftools-0.25.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/qz/XXX/T/pip-req-build-890d2p/setup.py", line 47, in <module>
scripts=['scripts/readelf.py']
File "/devel/pyelftools/.tox/py27/lib/python2.7/site-packages/setuptools/__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "/devel/pyelftools/.tox/py27/lib/python2.7/site-packages/setuptools/__init__.py", line 137, in _install_setup_requires
dist.parse_config_files(ignore_option_errors=True)
File "/devel/pyelftools/.tox/py27/lib/python2.7/site-packages/setuptools/dist.py", line 704, in parse_config_files
self._parse_config_files(filenames=filenames)
File "/devel/pyelftools/.tox/py27/lib/python2.7/site-packages/setuptools/dist.py", line 600, in _parse_config_files
reader = io.TextIOWrapper(fp, encoding=encoding)
LookupError: unknown encoding:
```
This is due to the specification of LC_ALL as simply `en_US` without an encoding. Python 3.x seems to be fine with this, but Python 2.7 barfs. As a fix, setting `LC_ALL` to `en_US.utf-8` (including an explicit encoding spec) works.
Andreas Ziegler [Sat, 16 Feb 2019 13:25:59 +0000 (14:25 +0100)]
Also decode strings in _DynamicStringTable.get_string() (#217)
StringTableSection.get_string() returns an UTF-8 decoded
string (or '' if fetching the string failed) since #182
but the code in _DynamicStringTable was never updated to
decode anything at all so it just returns a bytes sequence
in Python 3.
Let's convert the string there as well to be able to use
both string tables the same way without having to worry
about decoding. Adapt the test cases accordingly.
Eli Bendersky [Thu, 31 Jan 2019 14:24:36 +0000 (06:24 -0800)]
Remove py34 testing target
Eli Bendersky [Thu, 31 Jan 2019 14:24:25 +0000 (06:24 -0800)]
Small stylistic fixes
Vasily E [Thu, 31 Jan 2019 14:17:14 +0000 (17:17 +0300)]
Fixup error on empty .debug_pubtypes section (#215)
* tox: explicitly set locale
Locale affects GNU binutils output translation which cause
run_readelf_tests.py to fail if system language is not English.
Signed-off-by: Efimov Vasily <real@ispras.ru>
* test: unittest reproducing error with empty ".debug_pubtypes" section
Signed-off-by: Efimov Vasily <real@ispras.ru>
* NameLUT: use `construct.If` to declare "name" field
This patch also fixes problem with empty first entry.
Signed-off-by: Efimov Vasily <real@ispras.ru>
* NameLUT._get_entries: remove unused `bytes_read`
Signed-off-by: Efimov Vasily <real@ispras.ru>
Anders Dellien [Wed, 30 Jan 2019 14:33:03 +0000 (15:33 +0100)]
Support for DWARFv4 location lists in dwarf_location_lists.py (#214)
In DWARFv4 the location lists are referenced with the 'sec_offset'
attribute form instead of 'data4' or 'data8'.
Anders Dellien [Mon, 24 Dec 2018 16:56:52 +0000 (17:56 +0100)]
More efficient AbbrevDecl handling (#212)
Create all the AbbrevDecl objects during parsing and later return
references to them - this gives a small performance gain.
rvijayc [Mon, 24 Dec 2018 14:02:08 +0000 (06:02 -0800)]
Added support for decoding .debug_pubtypes and .debug_pubnames sections (#208)
* Added support for decoding .debug_pubtypes and .debug_pubnames sections
* Added reference output to dwarf_pubnames_types.py example.
* Added readelf support, fixed review comments and documentation updates
* Avoid printing the entire die in pubnames example to workaround Python2 vs 3 imcompatibilites
Anders Dellien [Thu, 20 Dec 2018 13:21:35 +0000 (14:21 +0100)]
Simplify handling of null DIEs (#209)
The code that is intended to coalesce null DIEs into the DIE that
precedes them does not do that and is actually not needed as the
'unflattening' procedure takes care of any unexpected null DIEs.
Also added a unit test for verifying the DIE size calculation.
rvijayc [Tue, 18 Dec 2018 13:46:05 +0000 (05:46 -0800)]
Bugfix: Reset prevstate if line program sequence ends (#211)
gahag [Sun, 25 Nov 2018 22:06:14 +0000 (20:06 -0200)]
Implemented ELFFile.get_machine_arch for the remaining architectures. (#206)
* Implemented ELFFile.get_machine_arch for the remaining architectures.
Added all architectures according to the ENUM_E_MACHINE.
* Refactored if statement into dict.get.
Anders Dellien [Sat, 27 Oct 2018 12:19:16 +0000 (14:19 +0200)]
Remove unnecessary 'preserve_stream_pos' (#204)
The stream position in the .debug_info stream can't change when
reading from the .debug_abbrev stream.
Andreas Ziegler [Thu, 25 Oct 2018 12:31:20 +0000 (14:31 +0200)]
ARMAttribute: fix access to structs, stream and nul (#203)
The __init__ function of ARMAttribute has two parameters
structs and stream through which the caller can pass in the
relevant objects (ARMAttributesSubsubsection does that after
seeking to the right position in stream).
The accesses for TAG_SECTION and TAG_SYMBOL, however, were
referring to non-existing members instead of the parameters.
Additionally, one assertion tries to access an undefined
'null_byte' variable which should be 'nul' instead.
Andreas Ziegler [Thu, 4 Oct 2018 12:15:49 +0000 (14:15 +0200)]
Provide enums for DT_FLAGS and DT_FLAGS_1 (#200)
* Provide enums for DT_FLAGS and DT_FLAGS_1
This change adds two enums with the name to value mappings
for the two flags fields in the dynamic section. The values
and corresponding names are taken from the elf/elf.h file
in the most recent glibc version.
The enums are also used to print the names instead of the
raw hex values for DT_FLAGS and DT_FLAGS_1 in
scripts/readelf.py.
Fixes: #189
* Add test file for DT_FLAGS/DT_FLAGS_1 parsing
The test file has the DF_BIND_NOW and DF_ORIGIN flags set
in DT_FLAGS as well as DF_1_NOW, DF_1_GLOBAL, DF_1_NOOPEN
and DF_1_ORIGIN flags in DF_FLAGS_1.
This is the source code for the dt_flags.elf file:
#include <stdio.h>
int function(const char *arg){
printf("Hello, %s!", arg);
return 0;
}
and was compiled using the following command line:
$ gcc -shared -m32 \
-Wl,-rpath,'$ORIGIN/lib',-z,global,-z,origin,-z,nodlopen,-z,now \
-o testfiles_for_readelf/dt_flags.elf dt_flags.c
Dmitry Koltunov [Wed, 5 Sep 2018 22:00:34 +0000 (01:00 +0300)]
Fix division in calculation function for 'R_ARM_CALL' (#196)
Eli Bendersky [Wed, 5 Sep 2018 12:42:10 +0000 (05:42 -0700)]
Move arm reloc test to proper location and simplify its code a bit
Eli Bendersky [Wed, 5 Sep 2018 12:35:33 +0000 (05:35 -0700)]
Simplify arm reloc test file
Eli Bendersky [Wed, 5 Sep 2018 12:32:04 +0000 (05:32 -0700)]
Rename input files for arm relocation test to be more consistent
Eli Bendersky [Wed, 5 Sep 2018 12:29:44 +0000 (05:29 -0700)]
Redo the new arm reloc test as a proper unit test, aligned with other tests
Dmitry Koltunov [Wed, 5 Sep 2018 12:25:28 +0000 (15:25 +0300)]
Call relocation for ARM V3 (#194)
* Add support for 'R_ARM_CALL' relocation type
* Add test script and test files to verify support for 'R_ARM_CALL'
Signed-off-by: Koltunov Dmitry <koltunov@ispras.ru>
Eli Bendersky [Sat, 1 Sep 2018 13:14:35 +0000 (06:14 -0700)]
Add .o test files to manifest
Eli Bendersky [Sat, 1 Sep 2018 13:07:39 +0000 (06:07 -0700)]
Update version to 0.25 to prepare for release
Eli Bendersky [Sat, 1 Sep 2018 13:03:53 +0000 (06:03 -0700)]
Update CHANGES, add 3.6 testing to Travis and fixup README
Frederik Sdun [Mon, 16 Jul 2018 13:22:55 +0000 (15:22 +0200)]
Handle ARM relocations (#121)
* relocation: handle ARM binaries
* relocation: handle R_ARM_ABS32 for ARM machines
* testfiles: add reloc_arm_gcc.o.elf
Generated on Ubuntu 14.04 using: arm-linux-gnueabi-gcc-4.7 -c -g -o reloc_armhf_gcc.o.elf hello.c
* testfiles: add reloc_armhf_gcc.o.elf
Generated on Ubuntu 14.04 using: arm-linux-gnueabihf-gcc-4.7 -c -g -o reloc_armhf_gcc.o.elf hello.c
* readelf: print soft-float abi for ARM if EF_ARM_ABI_FLOAT_SOFT in flags
* readelf: print hard-float abi for ARM if EF_ARM_ABI_FLOAT_HARD in flags
* readelf: print BE8 info for armeb binaries
* testfiles: add simple_armhf_gcc.o.elf
Generated on Ubuntu 14.04 using: arm-linux-gnueabihf-gcc-4.7 -g -o simple_armhf_gcc.o.elf hello.c
* elf: remove unwind from dicts and set ARM_EXIDX description
* testfiles: add reloc_armsf_gcc.o.elf as soft float testcase taken from binutils 2.30
* testfiles: add reloc_armeb_gcc.o.elf as arm big endian testcase taken from binutils 2.30 testcase arm-be8
* readelf: print endian info LE8 if flag was set in header flags
Eli Bendersky [Wed, 7 Mar 2018 13:23:18 +0000 (05:23 -0800)]
Enable --parallel tests for readelf in the tox config
Eli Bendersky [Wed, 7 Mar 2018 13:21:02 +0000 (05:21 -0800)]
Merge branch 'master' of github.com:eliben/pyelftools
Eli Bendersky [Tue, 6 Mar 2018 20:59:47 +0000 (12:59 -0800)]
Add basic parallel execution capabilities to readelf tests
Eli Bendersky [Tue, 6 Mar 2018 20:07:15 +0000 (12:07 -0800)]
Add timings for steps of execution in running these tests
Eli Bendersky [Tue, 6 Mar 2018 13:56:18 +0000 (05:56 -0800)]
Update CHANGES
Eli Bendersky [Tue, 6 Mar 2018 13:55:28 +0000 (05:55 -0800)]
Switch readelf.py to using argparse instead of optparse
Eli Bendersky [Tue, 6 Mar 2018 13:41:08 +0000 (05:41 -0800)]
Switch run_readelf_tests to use argparse instead of optparse
emersion [Tue, 6 Mar 2018 13:16:41 +0000 (14:16 +0100)]
Fix DW_CFA_remember_state (#184)
* Fix #103
* Fix description for DW_CFA_def_cfa_expression
* Add test file for issue #103
Audrey Dutcher [Fri, 23 Feb 2018 13:30:52 +0000 (05:30 -0800)]
Choose members of the dynamic tag enum based on the current machine (#183)
* Only use processor/os specific dynamic tags if that processor or os is in use
* Add testcase for machine-specific dynamic tags
* Clarify layout of ENUM_D_TAG
Audrey Dutcher [Fri, 23 Feb 2018 13:28:51 +0000 (05:28 -0800)]
Convert all ascii decoding to utf-8 decoding (#182)
* Convert all ascii-decoding to utf-8 decoding
* Add testcase for unicode symbols
Eli Bendersky [Sat, 17 Feb 2018 13:12:52 +0000 (05:12 -0800)]
Fix #181 for real
EM_BLAKCFIN --> EM_BLACKFIN
Eli Bendersky [Fri, 16 Feb 2018 13:59:14 +0000 (05:59 -0800)]
Merge branch 'master' of github.com:eliben/pyelftools
Eli Bendersky [Fri, 16 Feb 2018 13:58:44 +0000 (05:58 -0800)]
Fix a typo EM_BLAFKIN --> EM_BLACKFIN
Fixes #181
Eli Bendersky [Wed, 14 Feb 2018 23:58:39 +0000 (15:58 -0800)]
Update README
emersion [Sat, 20 Jan 2018 17:18:09 +0000 (18:18 +0100)]
Do not crash if CIE doesn't define CFA (#177)
Eli Bendersky [Tue, 16 Jan 2018 13:43:00 +0000 (05:43 -0800)]
Mention recent changes in CHANGES
Eli Bendersky [Mon, 15 Jan 2018 22:31:31 +0000 (14:31 -0800)]
e_machine-dependent p_type parsing;
This should address #71 and #121, hopefully
Eli Bendersky [Mon, 15 Jan 2018 22:14:11 +0000 (14:14 -0800)]
Implement e_machine-based section type decoding
Eli Bendersky [Mon, 15 Jan 2018 13:50:13 +0000 (05:50 -0800)]
Adding a dict-merging utility
Eli Bendersky [Tue, 9 Jan 2018 14:56:24 +0000 (06:56 -0800)]
Some whitespace fixes
Audrey Dutcher [Fri, 5 Jan 2018 21:54:59 +0000 (13:54 -0800)]
Don't include 'meta-tag' markers in descriptions of ENUM_D_TAG (#176)
Fixes #150
Eli Bendersky [Fri, 5 Jan 2018 13:52:11 +0000 (05:52 -0800)]
Add a local .vimrc for pyelftools
AG [Sun, 26 Nov 2017 21:41:15 +0000 (16:41 -0500)]
Fix merge conflicts for ABIFLAGS branch (#168)
AG [Sun, 26 Nov 2017 21:41:04 +0000 (16:41 -0500)]
Arm exidx (#172)
* Fix merge conflicts for ABIFLAGS branch
* Fix EXIDX output to match binutils readelf -e
AG [Sun, 26 Nov 2017 13:57:43 +0000 (08:57 -0500)]
Many improvements to MIPS flags handling to make output consistent with GNU binutils readelf + typo (#165)
* Add EF_MIPS_PIC for E_FLAGS for statically linked MIPS-I executable produced by MUSL
pyelftools picked up CPIC but not PIC
binutils readelf says:
Flags: 0x1007, noreorder, pic, cpic, o32, mips1
pyelftools said (before this change):
Flags: 0x1007, noreorder, cpic, o32, mips1
Reproduce with the binary available at:
https://github.com/mzpqnxow/embedded-toolkit/blob/master/prebuilt_static_bins/gdbserver/gdbserver-6.8-mips-i-rtl819x-lexra
* Fix order of fix, was "cpic, pic" needs to be "pic, cpic", reordered the if statement to address this
* - Improve reporting on MIPS flags, fix many inconsistencies with GNU binutils
- Fix `desrciption` typo that raises fatal exception when encountering an unknown ABI
- Add E_FLAGS_MASKS constants to simplify ABI logic
* Add masks for E_FLAGS to simplify ABI logic
AG [Sun, 26 Nov 2017 13:50:49 +0000 (08:50 -0500)]
Add TLS and PowerPC to Machine and Program Headers description tables to match binutils output (#163)
Before:
...
Machine: <unknown>
...
Program Headers:
...
<unknown> 0x0bcd0c 0x100ccd0c 0x100ccd0c 0x00000 0x00008 R 0x4
...
After:
...
Machine: PowerPC
Program Headers:
...
TLS 0x0bcd0c 0x100ccd0c 0x100ccd0c 0x00000 0x00008 R 0x4
...
Reproduced and then tested change against statically linked PPC binary produced by MUSL:
https://github.com/mzpqnxow/embedded-toolkit/blob/master/prebuilt_static_bins/gdbserver/gdbserver-7.12-ppc-sysv
tyb0807 [Tue, 21 Nov 2017 05:00:08 +0000 (06:00 +0100)]
ARM build attributes section parsing (#160)
alon [Tue, 21 Nov 2017 04:54:13 +0000 (06:54 +0200)]
DIE.__repr__ typo: s/chidren/children/ (#161)
Eli Bendersky [Sat, 18 Nov 2017 17:37:45 +0000 (09:37 -0800)]
Clean up some whitespace