Seva Alekseyev [Thu, 14 Sep 2023 13:27:12 +0000 (09:27 -0400)]
False positive on LocationParser.attribute_has_location() (#501)
* Fix for LocationParser.attribute_has_location
* Test for DWARFv3, section 5.6.6
* V5 ctrparts to GNU attribs that may be locations
* Test for the false negative
* Test explanation
Seva Alekseyev [Sun, 10 Sep 2023 02:30:11 +0000 (22:30 -0400)]
Support for DW_OP_WASM_location (#500)
Co-authored-by: Seva Alekseyev <sevaa@nih.gov>
Seva Alekseyev [Fri, 8 Sep 2023 15:44:11 +0000 (11:44 -0400)]
Dwarfdump test on Windows (#499)
Seva Alekseyev [Thu, 7 Sep 2023 14:09:30 +0000 (10:09 -0400)]
More Apple, LLVM attributes (#497)
Co-authored-by: Seva Alekseyev <sevaa@nih.gov>
Eli Bendersky [Wed, 6 Sep 2023 23:44:22 +0000 (16:44 -0700)]
Release 0.30
WÁNG Xuěruì [Wed, 6 Sep 2023 12:38:41 +0000 (20:38 +0800)]
Fix the LoongArch support code and some more (#483)
* Fix LoongArch support in dwarfdump.py
The e_machine constant is EM_LOONGARCH, and the emulation name is just
elf{32,64}-loongarch without the endian prefix.
Fixes: 6c36d79 ("add support for loongarch64 to dwarfdump (#458)")
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* Fix the EF_LOONGARCH_* symbol names
The current code gets the logic right, but not the symbol names. Fix
them for consistency with the canonical definition that's binutils.
Fixes: 2059475 ("Add support for LoongArch (#470)")
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* Fix a missing description string in elffile.py for LoongArch
Fixes: 2059475 ("Add support for LoongArch (#470)")
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* Provide EF_LARCH_* name aliases for the EF_LOONGARCH_* constants
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* Add definitions for LoongArch relocations
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* Add support for basic 32- and 64-bit LoongArch relocations
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* scripts/readelf.py: Properly format control chars in symbol names
This is necessary to match readelf behavior on fake symbol names, that
usually look like "L0^A" when rendered (being "L0\x01" in reality).
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* scripts/readelf.py: Fix register display order in _dump_debug_frames_interp
According to binutils sources (function frame_display_row in
binutils/dwarf.c), the apparent ordering of the ra register after other
registers is merely a side effect of most architectures allocating a
larger DWARF register number for their respective ra registers. This has
no effect on all readelf test cases, but is necessary for a future
LoongArch test binary to pass comparisons.
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
* Add test program and artifact covering basic LoongArch relocations
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
---------
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
Noam Yorav-Raphael [Mon, 4 Sep 2023 12:55:14 +0000 (15:55 +0300)]
Support MIPS64 .o files - don't remove has_addend (#495)
* Update relocation.py to support MIPS64 .o files. Add a test file. DWARF test still shows an error.
* Make test pass for test/testfiles_for_readelf/simple_mips_gcc.o.elf by having two _RELOCATION_RECIPES_MIPS, one for REL and one for RELA
* Adjust llvm-dwarfdump output for MIPS64 to match pyelftools and gcc-objdump.
* update dwarf_mips64el.o.elf
* Change dwarf_mips64el.c to not use globals
Now we don't depend on whether relocations on globals in .o should be performed or not.
* run_dwarfdump_test.py: add a comment to explain the special case.
---------
Co-authored-by: Noam Yorav-Raphael <noam.yoravraphael@mobileye.com>
Co-authored-by: Noam Yorav-Raphael <noamyr@mobileye.com>
Seva Alekseyev [Wed, 23 Aug 2023 14:32:24 +0000 (10:32 -0400)]
Friendly error in get_location_list_at_offset (#492)
Nick Desaulniers [Wed, 23 Aug 2023 12:23:34 +0000 (05:23 -0700)]
fix examples/dwarf_location_info.py (#490)
Pass along the DIE otherwise the following error is observed:
Traceback (most recent call last):
File "/tmp/pyelftools/examples/dwarf_location_info.py", line 110, in <module>
process_file(filename)
File "/tmp/pyelftools/examples/dwarf_location_info.py", line 78, in process_file
loc = loc_parser.parse_from_attribute(attr,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pyelftools/elftools/dwarf/locationlists.py", line 307, in parse_from_attribute
return self.location_lists.get_location_list_at_offset(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pyelftools/elftools/dwarf/locationlists.py", line 96, in get_location_list_at_offset
return self._parse_location_list_from_stream_v5(die.cu) if self.version >= 5 else self._parse_location_list_from_stream()
^^^^^^
AttributeError: 'NoneType' object has no attribute 'cu'
Seva Alekseyev [Wed, 23 Aug 2023 12:17:48 +0000 (08:17 -0400)]
ARM tag 46 (#491)
Seva Alekseyev [Tue, 22 Aug 2023 12:26:05 +0000 (08:26 -0400)]
readelf 2.41 with Ranges test excluded on 2 files (#489)
* readelf 2.41 with Ranges test excluded
* Ranges test reinstated except two binaries
---------
Co-authored-by: Seva <seva@sandbox.home>
Seva Alekseyev [Wed, 16 Aug 2023 00:31:26 +0000 (17:31 -0700)]
Missing tags (#487)
Seva Alekseyev [Thu, 29 Jun 2023 02:31:30 +0000 (22:31 -0400)]
Reporting the real attribute form for DW_FORM_indirect (#475)
* Reporting the real attribute form for DW_FORM_indirect
* Fixes
* Unit test
* Comments
* Typo
---------
Co-authored-by: Seva Alekseyev <sevaa@nih.gov>
Eli Bendersky [Fri, 21 Apr 2023 13:17:49 +0000 (06:17 -0700)]
Clean up some tabs and remove tox.ini which isn't used any more
Wu Xiaotian [Fri, 21 Apr 2023 13:13:14 +0000 (21:13 +0800)]
Add support for LoongArch (#470)
refer: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_e_flags_identifies_abi_type_and_version
Flier Lu [Mon, 17 Apr 2023 15:12:43 +0000 (23:12 +0800)]
add reloc type and recipe for eBPF (#466)
Eli Bendersky [Mon, 17 Apr 2023 13:38:25 +0000 (06:38 -0700)]
Create SECURITY.md
Seva Alekseyev [Tue, 21 Mar 2023 00:01:05 +0000 (20:01 -0400)]
Filename in lineprog index fix made DWARF5 aware (#463)
Ricardo Barbedo [Sat, 4 Feb 2023 00:41:41 +0000 (01:41 +0100)]
Add support for RISC-V attributes (#459)
* Add support for RISC-V attributes
* Fix typos and formatting
haomi123 [Mon, 30 Jan 2023 16:49:56 +0000 (00:49 +0800)]
add support for loongarch64 to dwarfdump (#458)
laqieer [Thu, 27 Oct 2022 20:05:50 +0000 (04:05 +0800)]
add support for arm to dwarfdump (#449)
refer to: https://github.com/eliben/pyelftools/pull/445
Seva Alekseyev [Tue, 18 Oct 2022 15:53:57 +0000 (11:53 -0400)]
Some GNU extension attributes (#447)
Nick Desaulniers [Sat, 15 Oct 2022 17:42:10 +0000 (10:42 -0700)]
add support for aarch64 to dwarfdump (#445)
llvm-dwarfdump prints
elf64-littleaarch64
We probably need more logic to differentiate between big endian (less
common) vs little endian (more common), but at least this allows us to
use ./scripts/dwarfdump on aarch64 targets now.
I probably should have added this to #318 / #317.
Kevin Phoenix [Sat, 24 Sep 2022 13:29:15 +0000 (06:29 -0700)]
Add pyproject.toml (#443)
Will Denissen [Thu, 22 Sep 2022 20:11:30 +0000 (22:11 +0200)]
Added Dwarfv5 CU headers (#442)
Extended readelf.py
Added test file compiled with
-gdebug_types-section to readelf tests
Seva Alekseyev [Mon, 22 Aug 2022 12:41:49 +0000 (08:41 -0400)]
Fix for CU version check in LocationListsPair (#439)
Eli Bendersky [Wed, 17 Aug 2022 12:46:40 +0000 (05:46 -0700)]
Minor stylistic fixes following up the previous commit
Ronan Dunklau [Wed, 17 Aug 2022 12:42:21 +0000 (14:42 +0200)]
Cache instantiation of DWARF structs. (#435)
This takes a huge amount of time when iterating over compile units.
Eli Bendersky [Tue, 16 Aug 2022 13:41:28 +0000 (06:41 -0700)]
Merge branch 'master' of github.com:eliben/pyelftools
Eli Bendersky [Tue, 16 Aug 2022 13:41:16 +0000 (06:41 -0700)]
Remove z.py
Seva Alekseyev [Tue, 16 Aug 2022 13:40:14 +0000 (09:40 -0400)]
Support for DW_FORM_data16, unit test (#437)
Fixes #436
Eli Bendersky [Tue, 16 Aug 2022 13:38:15 +0000 (06:38 -0700)]
Finish refactoring out py3compat and delete the file
Fixes #415
Eli Bendersky [Tue, 16 Aug 2022 13:31:35 +0000 (06:31 -0700)]
Remove int2byte and byte2int utilities from py3compat
Eli Bendersky [Tue, 16 Aug 2022 13:26:19 +0000 (06:26 -0700)]
Remove BytesIO and StringIO from py3compat
Eli Bendersky [Tue, 16 Aug 2022 13:21:11 +0000 (06:21 -0700)]
Remove path and maxint from py3compat
Eli Bendersky [Tue, 16 Aug 2022 13:15:04 +0000 (06:15 -0700)]
Move utilities from py3compat to utils
Eli Bendersky [Tue, 16 Aug 2022 13:03:20 +0000 (06:03 -0700)]
Remove iter* utilities from py3compat and refactor uses
Eli Bendersky [Mon, 15 Aug 2022 13:24:10 +0000 (06:24 -0700)]
Remove mention of supporting Python 2 from the README
Updates #415
Eli Bendersky [Mon, 15 Aug 2022 13:18:32 +0000 (06:18 -0700)]
Python version 3.10 needs quotes in the yaml file
Eli Bendersky [Mon, 15 Aug 2022 13:15:29 +0000 (06:15 -0700)]
Officially remove Python 2 support from this point forward
This change removes the support from setup.py and the testing files, and
adds an assertion to py3compat that will crash when pyelftools is run
w/ Python 2
Doesn't remove compatibility code, yet
Updates #415
Eli Bendersky [Wed, 10 Aug 2022 03:23:00 +0000 (20:23 -0700)]
Rejigger MANIFEST.in to properly include/exclude test stuff
Eli Bendersky [Tue, 9 Aug 2022 23:23:37 +0000 (16:23 -0700)]
Add back empty_pubtypes dir, and include *.common test files too
Eli Bendersky [Tue, 9 Aug 2022 23:18:01 +0000 (16:18 -0700)]
Rename test files with .debug
This is also added to MANIFEST.in
... and make the subdirectory executable again
Eli Bendersky [Tue, 9 Aug 2022 23:15:02 +0000 (16:15 -0700)]
Remove 'x' permissions from all test files in testfiles_for_unittests
Eli Bendersky [Tue, 9 Aug 2022 23:11:07 +0000 (16:11 -0700)]
Prepare for 0.29 release
Not tagging in Git yet -- testing distribution
Eli Bendersky [Tue, 9 Aug 2022 23:01:19 +0000 (16:01 -0700)]
Update tox to run all_tests
Javier Rascón Mesa [Tue, 9 Aug 2022 22:53:02 +0000 (00:53 +0200)]
Added out of bounds read detection for corrups section headers (#434)
* Added test for files with corrupt e_shoff & e_shnum
* Added basic detection for reading out of the stream bounds due to corrupt header
* Added None check when accessing '_section_header_stringtable'
* Fix to work on python2
Co-authored-by: halos <halos@synth>
Seva Alekseyev [Tue, 9 Aug 2022 22:51:27 +0000 (18:51 -0400)]
Include so, dat files in the test (#433)
Fixes #349
Ronan Dunklau [Mon, 8 Aug 2022 14:50:55 +0000 (16:50 +0200)]
Supplementary object files (#426)
* Recognize DW_FORM_ref_udata as a reference type.
References to other DIEs can also be implemented with a form
DW_FORM_ref_udata, for using the ULEB128 encoding
* Add support for DWARF supplementary object files.
Tim Gates [Wed, 13 Jul 2022 21:01:06 +0000 (07:01 +1000)]
docs: Fix a few typos (#431)
There are small typos in:
- elftools/common/py3compat.py
- elftools/dwarf/die.py
Fixes:
- Should read `representations` rather than `pepresentations`.
- Should read `purposes` rather than `pusposes`.
Seva Alekseyev [Tue, 12 Jul 2022 02:27:32 +0000 (22:27 -0400)]
Indirect encoding support (#430)
* Indirect encoding support
* Readelf fix for ranges/rnglists mix
* Typo, comments
Seva Alekseyev [Fri, 8 Jul 2022 12:41:52 +0000 (08:41 -0400)]
Mixing v4 and v5 loclists and rangelists sections (#429)
* More GNU note dumping
* aranges fix for empty sections
* Mixed v4/v5 sections.
* Test for readelf
* Comments, typo
Seva Alekseyev [Wed, 6 Jul 2022 17:06:37 +0000 (13:06 -0400)]
Autotest against llvm-dwarfdump (#428)
* Descriptive output dump file names on autotest
* Dwarfdump.py
* Test and test files for dwarfdump
* Loclist dump fix
* Permissions
* Fixes
Eli Bendersky [Fri, 17 Jun 2022 14:10:12 +0000 (07:10 -0700)]
Clean up whitespace
Seva Alekseyev [Fri, 17 Jun 2022 14:04:44 +0000 (10:04 -0400)]
Readelf upgraded to 2.38, format fixes (#420)
Seva Alekseyev [Fri, 17 Jun 2022 13:09:32 +0000 (09:09 -0400)]
Support for DWARFv5 debug_rnglists section (#419)
* Pre-DWARFv5 range section dumping, Ranges in readelf autotest
* DWARFv5 rnglists section support
* Autotest fixes
* Misleading comment
* Version, dwarfinfo now required in RangeLists constructor
Eli Bendersky [Fri, 17 Jun 2022 12:28:05 +0000 (05:28 -0700)]
Clarify instructions in test/external_tools
Eli Bendersky [Thu, 16 Jun 2022 13:47:35 +0000 (06:47 -0700)]
Add previously untested output file to test set
* By renaming it to have a .elf suffix
This also fixes descriptions for DW_FORM_sdata to comply with the recent output
format of readelf
Eli Bendersky [Thu, 16 Jun 2022 13:42:36 +0000 (06:42 -0700)]
Say which test file failed in readelf tests
[otherwise in parallel mode it's hard to know]
Seva Alekseyev [Thu, 16 Jun 2022 12:19:30 +0000 (08:19 -0400)]
DWARF 5 operations and DWARF5 location lists (#418)
* Test binary for DWARFv5 operations
* DWARFv5 ops, part 1: entry_value, const_type, deref_type
* DWARFv5 ops, part 2: regval_type, implicit_pointer, convert
* DWARFv5 loclists section parsing, take 1
* Foamtting fix
* Test fixes
* Lineprogram header file_entries with DWARFv5 now are indexable by string
* Excising the View column, if present, from GNU readelf..decodedline output
* Readelf test fixes
* Typo
* Formatting and comments
* More style fixes
Eli Bendersky [Mon, 13 Jun 2022 13:59:35 +0000 (06:59 -0700)]
Change supported Python versions in github actions (#416)
Eli Bendersky [Mon, 13 Jun 2022 12:49:02 +0000 (05:49 -0700)]
Whitespace cleanups
Seva Alekseyev [Mon, 13 Jun 2022 12:44:44 +0000 (08:44 -0400)]
Version 5 lineprogram header (#411)
* Version 5 lineprogram header, take 1
* Readelf/decodedline formatting fix
* DWARF 5 fields None, not missing
* Comment
* Sample binary
* Dump unit type in readelf info
* More languages described
* Describing form_line_strp
* Basic support for GNU_PROPERTY_X86_ISA_1
* Readelf decodedline format fixes to match with DWARF5
* Readelf test shorted out for the file/test where a bug in GNU readelf manifests, see PR #411.
* Newline :)
* Readelf' language names matched against binutils
* Comment about lineprogram files and directories
* GNU binutils bug worked around in a slightly less disturbing way - patched the binary, left a comment in the test script.
* Examples autotest no longer fails on Windows over expected path format
* Autotest fix
* Typo
* Windows compatibility, take 2
* No pathlib on Python 2
Co-authored-by: Seva Alekseyev <sevaa@nih.gov>
Eli Bendersky [Wed, 8 Jun 2022 12:57:46 +0000 (05:57 -0700)]
Reformat some docstrings
Eli Bendersky [Tue, 7 Jun 2022 23:20:05 +0000 (16:20 -0700)]
Minor cosmetic changes
Seva Alekseyev [Tue, 7 Jun 2022 23:17:31 +0000 (19:17 -0400)]
Support for sibling in form DW_FORM_ref_addr (#408)
Co-authored-by: Seva Alekseyev <sevaa@nih.gov>
Seva Alekseyev [Mon, 16 May 2022 13:58:24 +0000 (09:58 -0400)]
Storing the offset of DWARF operations within the expression block (#404)
* Storing the offset of every DWARF operations within the expression block
* Trivial auto test
Ronan Dunklau [Tue, 10 May 2022 13:56:32 +0000 (15:56 +0200)]
Improve DWARF 5 compatibility. (#400)
* Add support DW_FORM_implicit_const
* Add support for DW_FORM_line_strp
* Add new tests for DW_FORM_implicit_const and DW_FORM_linestrp.
Andreas Ziegler [Mon, 14 Feb 2022 13:44:27 +0000 (14:44 +0100)]
Add support for DT_RELR/SHT_RELR compressed relocation sections (#395)
As more and more tools now support DT_RELR compressed relocations
(most notably, the just released GNU binutils 2.38 [0]), let's add
support for reading these relocations as well.
The original discussion about advantages of packe RELATIVE
relocations can be found at [1]. In a nutshell, the format
exploits the fact that RELATIVE relocations are often placed
next to each other and (for x86_64) stores up to 64 relocations
in two 8-byte words. In a regular .rela.dyn table, these would
take up 24 * 64 = 1536 bytes.
The compressed relocations work as follows:
The first word in the section describes a base address and
contains an offset for a relocation. This offset must always
lie at an even address. Following this entry can be one or
more bitmap(s) which have their least significant bit set to 1.
All other bits describe (in increasing order of significance) if
the following continuous offsets also contain a relocation. The
addends for existing relocations are stored at the corresponding
offsets in the file (that is, they work like REL relocations).
A good description of the history of this feature and its current
adoption is the following blog post [2].
[0]: https://lists.gnu.org/archive/html/info-gnu/2022-02/msg00009.html
[1]: https://groups.google.com/g/generic-abi/c/bX460iggiKg?pli=1
[2]: https://maskray.me/blog/2021-10-31-relative-relocations-and-relr
Eli Bendersky [Thu, 3 Feb 2022 14:45:41 +0000 (06:45 -0800)]
Prepare for releasing version 0.28
Brendan Haines [Thu, 13 Jan 2022 23:07:39 +0000 (16:07 -0700)]
Update structs.py (#392)
Remove unused imports
Adam [Tue, 11 Jan 2022 12:05:21 +0000 (12:05 +0000)]
Add PS3/CellOS OSABI identifier (#389)
* Add PS3/CellOS OSABI identifier.
* Remove "OS" from CELL OS ABI
* Remove "OS" from CELL OS ABI
* Add Missing comma for ELFOSABI_CELL_LV2.
Marco Bonelli [Wed, 15 Dec 2021 19:25:34 +0000 (20:25 +0100)]
Add support for note GNU_PROPERTY_X86_FEATURE_1_AND (#388)
- Implement support for GNU property note type
GNU_PROPERTY_X86_FEATURE_1_AND (which is a feature bitmask) and its
relative flags.
- Fix off-by-one in "Data size" column alignment for readelf.py note
sections dump.
References:
- https://gitlab.com/x86-psABIs/x86-64-ABI
Eli Bendersky [Fri, 10 Dec 2021 14:57:26 +0000 (06:57 -0800)]
Rebuild readelf locally and add more instructions
Eli Bendersky [Fri, 10 Dec 2021 14:49:08 +0000 (06:49 -0800)]
Run readelf tests in parallel by default
Marco Bonelli [Fri, 10 Dec 2021 14:36:18 +0000 (15:36 +0100)]
Update readelf to v2.37, adapt readelf.py output and tests (#387)
Changes to conform the output of readelf.py to binutils readelf v2.37:
- Use singular "entry" when needed instead of "entries".
- Output the last entry for the .debug_line output table when
DW_LNE_end_sequence is encountered, as DWARF standard dictates. Looks
looks like this was a readelf bug which was fixed in commit
ba8826a82a29a19b78c18ce4f44fe313de279af7 of the GNU binutils-gdb repo.
- Add additional "Stmt" field in the .debug_line output table, and
ignore the new "View" field. The "Stmt" field has been implemented in
readelf.py. The "View" field is not something that the DWARF standard
defines, it's an internal register added to the line number
information state machine by binutils to perform assembler checks (see
commit
ba8826a82a29a19b78c18ce4f44fe313de279af7 of GNU binutils-gdb
repo for more info, in particular gas/doc/as.texinfo). "View" is
unimplemented in pyelftools for now and a special case has been added
in the readelf test suite to ignore it.
- Add support for printing section names when dumping .symtab entries of
st_type STT_SECTION as readelf v2.37 does (see commit
23356397449a8aa65afead0a895a20be53b3c6b0 of GNU binutils-gdb repo).
- Add suport for recognizing SOs specifically tagged as PIE (DT_FLAGS_1
dynamic tag with DF_1_PIE set). In such case, describe the file as
"Position-Independent Executable file" instead of "Shared object
file", as readelf v2.37 does.
- Add leading "0x" for version section addresses when dumping version
information (-V) as readelf does.
- Ignore "D (mbind)" in section headers flags legend (pyelftools does
not output this flag).
Special cases ADDED for run_readelf_tests.py:
- Ignore "View" column for --debug-dump=decodedline in readelf's output.
- Ignore ellipsis ("[...]") for long names/symbols/paths in readelf's
output.
Special cases REMOVED for run_readelf_tests.py:
- Detection of additional '@' after symbol names (flag_after_symtable)
seems to no longer be needed as all tests pass whitout this exception.
- Special case for DW_AT_apple_xxx seems to no longer be needed, readelf
now recognizes those.
- Special case for PT_GNU_PROPERTY no longer needed, readelf now
recognizes it.
Other changes:
- Add missing import in elftools/dwarf/lineprogram.py.
References:
- GNU binutils-gdb repo: https://sourceware.org/git/?p=binutils-gdb.git
Marco Bonelli [Tue, 7 Dec 2021 14:08:54 +0000 (15:08 +0100)]
Add support for .note.gnu.property notes section (#386)
* Add support for .note.gnu.properties notes section
References:
- Doc: https://github.com/hjl-tools/linux-abi/wiki/linux-abi-draft.pdf
- Linux: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=
00e19ceec80b03a43f626f891fcc53e57919f1b3
- Glibc: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/dl-prop.h;h=
385548fad3e4ad71dbdcdbfada58585c2f24ea5e;hb=HEAD
- Binutils: https://sourceware.org/git/?p=binutils-gdb.git&a=search&h=HEAD&st=commit&s=NT_GNU_PROPERTY_TYPE_0
* Add descriptions for .note.gnu.properties notes
* descriptions: add missing PT_GNU_PROPERTY description
* py3compat: add optional separator for bytes2hex
* readelf: align notes column headers
* elf/descriptions: conform to real readelf's output format
* test: special case some known readelf output quirks
* test: add test ELFs for .note.gnu.property notes
Seva Alekseyev [Wed, 17 Nov 2021 23:51:53 +0000 (18:51 -0500)]
DW_AT_private=0x24 (#382)
* DWARF 5 tags and attributes
* DW_AT_private
Co-authored-by: Seva Alekseyev <sevaa@nih.gov>
Seva Alekseyev [Sat, 6 Nov 2021 20:58:46 +0000 (16:58 -0400)]
DW_AT_virtual (#380)
* DWARF 5 tags and attributes
* DW_AT_virtual
Co-authored-by: Seva Alekseyev <sevaa@nih.gov>
Ulugbek Abdullaev [Fri, 29 Oct 2021 16:03:24 +0000 (18:03 +0200)]
add latest 'e_machine' mappings: EM_BPF, EM_CSKY, EM_FRV (#376)
Andreas Ziegler [Mon, 25 Oct 2021 14:31:14 +0000 (16:31 +0200)]
ELFFile: allow filtering by segment type in iter_segments() (#375)
This is very similar to the filtering implemented for
sections in commit
d71faebcd58e.
Karthikeyan Singaravelan [Sat, 16 Oct 2021 13:18:32 +0000 (18:48 +0530)]
Use assertEqual instead of assertEquals for Python 3.11 compatibility. (#374)
Marco Bonelli [Fri, 17 Sep 2021 20:37:03 +0000 (22:37 +0200)]
Keep raw note descriptors in ELF note sections as raw bytes (#372)
* ELF notes: keep raw note descriptors as bytes
* py3compat: add bytes2hex function
* elf/descriptions: use bytes2hex where needed
* ELF notes: convert to string only for known types
Jangseop Shin [Tue, 31 Aug 2021 13:19:27 +0000 (22:19 +0900)]
[example] bug fixes in dwarf_decode_address example (#361)
* [example] Handle lpe with end_sequence correctly
* [example] exclude highpc in address comparison in decode_funcname
Co-authored-by: Jangseop Shin <j.s.shin@samsung.com>
Lukas Dresel [Mon, 2 Aug 2021 15:30:19 +0000 (11:30 -0400)]
fixed parsing for structures containing uids or gids in core dumps for most architectures (#354)
* fixed parsing for structures containing uids or gids in core dumps for most architectures
* added testcase for mips corefile uid/gid parsing
* better description
* better email
William Woodruff [Thu, 27 May 2021 13:38:35 +0000 (09:38 -0400)]
dwarf: initial DWARFv5 support (#363)
* dwarf: initial DWARFv5 support
* dwarf/structs: use Embed to select header layout
* dwarf/structs: DW_FORM_strx family
Not sure how best to handle 24-bit values yet.
* dwarf/structs: use IfThenElse
`If` alone wraps the else in a `Value`.
* dwarf/structs: DW_FORM_addrx family handling
* dwarf_expr: support DW_OP_addrx
Not complete, but gets readelf.py to the end of a single
binary.
* dwarf/constants: DW_UT_* constants
* dwarf/structs: fix some DW_FORMs
* elftools, test: plumbing for DWARFv5 sections
* dwarf/constants: fix typo
* dwarf/structs: re-add a comment that got squashed
* dwarf/structs: DWARFv5 table header scaffolding
* dwarf/constants: typo
* test: add a basic DWARFv5 test
William Woodruff [Fri, 21 May 2021 13:20:12 +0000 (07:20 -0600)]
dwarf/constants: add DW_LNCT_* constants (#362)
These were introduced with DWARFv5 and are documented in S. 6.2.4.1.
Nick Desaulniers [Sat, 15 May 2021 03:34:21 +0000 (20:34 -0700)]
initial support for PPC64LE (#360)
* initial support for PPC64LE
See also:
https://openpowerfoundation.org/wp-content/uploads/2016/03/ABI64BitOpenPOWERv1.1_16July2015_pub4.pdf
3.4.1 Symbol Values
3.5.3 Relocation Types Table
Fixes #317
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
* remove references to LLVM_ADDR_SIG
LeadroyaL [Sun, 18 Apr 2021 13:30:12 +0000 (21:30 +0800)]
Support Android compressed rel/rela sections (#357)
Ref: https://android.googlesource.com/platform/bionic/+/refs/tags/android-11.0.0_r35/libc/include/elf.h
Peter LaFosse [Tue, 26 Jan 2021 00:11:51 +0000 (19:11 -0500)]
Fix/extend aarch64 register names table (#351)
Kyle Zeng [Wed, 20 Jan 2021 13:58:50 +0000 (06:58 -0700)]
fix wrong prpsinfo in 32bit coredump (#347)
* fix wrong prpsinfo in 32bit coredump
* add a sample coredump
* finish the testcase for 32bit core dump
Andreas Ziegler [Tue, 12 Jan 2021 15:03:47 +0000 (16:03 +0100)]
dynamic.py: move logic around to allow symbol access more easily (#346)
So far, the implementation of num_symbols() and get_symbol()
in the DynamicSegment class depended on iter_symbols().
However, most part of iter_symbols() is actually about
determining the number of symbols. Let's move that logic to
the correct method and use it in iter_symbols().
Additionally, in an ELF file without any exported symbols,
the hash table will be empty and will thus return a too low
number of symbols. However, a loader might still need to
access the imported symbols (which also have an entry in
the symbol table, with st_shndx set to SHN_UNDEF). To allow
this, make get_symbol() take any index and simply read the
symbol data from the corresponding index, and use
get_symbol() from iter_symbols(). This way, one can for
example use symbol index information from relocation entries
to directly access the symbol data.
These changes also make the logic in DynamicSegment resemble
the code in SymbolTableSection more closely.
Fixes: #342
Andreas Ziegler [Tue, 12 Jan 2021 00:27:24 +0000 (01:27 +0100)]
ELFFile: allow filtering of sections by type in iter_sections (#345)
As stated in the corresponding issue, we can already filter
the output of Dynamic.iter_tags() by the type of the tag
we're looking for.
Let's adapt the iteration over the sections of the ELF file
so that it only yields sections of a certain type if the
optional type parameter is passed to iter_sections().
By doing this we can also simplify two call sites inside
the ELFFile class.
Fixes: #344
Jonathan Bruchim [Mon, 7 Dec 2020 16:36:47 +0000 (18:36 +0200)]
added a method for returning the index of a section by name (#331)
* added an method for returning the index of a section by name
Signed-off-by: Jonathan <yonbruchim@gmail.com>
* changed naming of init mapping function
Signed-off-by: Jonathan <yonbruchim@gmail.com>
* Fixed CR
Added a test file containing 3 tests
1. test index of existing section
2. test index of missing section
3. test index of existing section when section_map_name is None
Signed-off-by: Jonathan Bruchim <yonbruchim@gmail.com>
Eli Bendersky [Tue, 27 Oct 2020 13:47:42 +0000 (06:47 -0700)]
Update .gitignore to ignore .egg-info dirs
Eli Bendersky [Tue, 27 Oct 2020 13:47:07 +0000 (06:47 -0700)]
Update TODO to mention git tag
Eli Bendersky [Tue, 27 Oct 2020 13:42:31 +0000 (06:42 -0700)]
remove dir that shouldn't be in git
Eli Bendersky [Tue, 27 Oct 2020 13:42:12 +0000 (06:42 -0700)]
Version 0.27 release
Eli Bendersky [Tue, 27 Oct 2020 13:29:22 +0000 (06:29 -0700)]
Add a bit more details to dwarf_pubnames_types example
Fix reference output and make test emit both outputs when they differ
Eli Bendersky [Tue, 27 Oct 2020 12:59:56 +0000 (05:59 -0700)]
Make dwarf_pubnames_types example a bit more general