about summary refs log tree commit diff
path: root/scripts/glibcelf.py
Commit message (Collapse)AuthorAgeFilesLines
* elf: Extract glibcelf constants from <elf.h>Florian Weimer2022-09-221-641/+375
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The need to maintain elf/elf.h and scripts/glibcelf.py in parallel results in a backporting hazard: they need to be kept in sync to avoid elf/tst-glibcelf consistency check failures. glibcelf (unlike tst-glibcelf) does not use the C implementation to extract constants. This applies the additional glibcpp syntax checks to <elf.h>. This changereplaces the types derived from Python enum types with custom types _TypedConstant, _IntConstant, and _FlagConstant. These types have fewer safeguards, but this also allows incremental construction and greater flexibility for grouping constants among the types. Architectures-specific named constants are now added as members into their superclasses (but value-based lookup is still restricted to generic constants only). Consequently, check_duplicates in elf/tst-glibcelf has been adjusted to accept differently-named constants of the same value if their subtypes are distinct. The ordering check for named constants has been dropped because they are no longer strictly ordered. Further test adjustments: Some of the type names are different. The new types do not support iteration (because it is unclear whether iteration should cover the all named values (including architecture-specific constants), or only the generic named values), so elf/tst-glibcelf now uses by_name explicit (to get all constants). PF_HP_SBP and PF_PARISC_SBP are now of distinct types (PfHP and PfPARISC), so they are how both present on the Python side. EM_NUM and PT_NUM are filtered (which was an oversight in the old conversion). The new version of glibcelf should also be compatible with earlier Python versions because it no longer depends on the enum module and its advanced features. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
* scripts/glibcelf.py: Add hashing supportFlorian Weimer2022-08-231-0/+19
| | | | | | | | ELF and GNU hashes can now be computed using the elf_hash and gnu_hash functions. Reviewed-by: Carlos O'Donell <carlos@redhat.com> Tested-by: Carlos O'Donell <carlos@redhat.com>
* LoongArch: Add relocations and ELF flags to elf.h and scripts/glibcelf.pycaiyinyu2022-07-261-1/+2
|
* scripts/glibcelf.py: Add PT_AARCH64_MEMTAG_MTE constantAdhemerval Zanella2022-06-061-0/+4
| | | | | | | It was added in commit 603e5c8ba7257483c162cabb06eb6f79096429b6. This caused the elf/tst-glibcelf consistency check to fail. Reviewed-by: Florian Weimer <fweimer@redhat.com>
* scripts/glibcelf.py: Add *T_RISCV_* constantsFlorian Weimer2022-05-161-0/+12
| | | | | | | | | SHT_RISCV_ATTRIBUTES, PT_RISCV_ATTRIBUTES, DT_RISCV_VARIANT_CC were added in commit 0b6c6750732483b4d59c2fcb45484079cd84157d ("Update RISC-V specific ELF definitions"). This caused the elf/tst-glibcelf consistency check to fail. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Define DT_RELR related macros and typesH.J. Lu2022-04-261-0/+4
|
* scripts/glibcelf.py: Mark as UNSUPPORTED on Python 3.5 and earlierFlorian Weimer2022-04-251-0/+6
| | | | | enum.IntFlag and enum.EnumMeta._missing_ support are not part of earlier Python versions.
* scripts: Add glibcelf.py moduleFlorian Weimer2022-04-221-0/+1135
Hopefully, this will lead to tests that are easier to maintain. The current approach of parsing readelf -W output using regular expressions is not necessarily easier than parsing the ELF data directly. This module is still somewhat incomplete (e.g., coverage of relocation types and versioning information is missing), but it is sufficient to perform basic symbol analysis or program header analysis. The EM_* mapping for architecture-specific constant classes (e.g., SttX86_64) is not yet implemented. The classes are defined for the benefit of elf/tst-glibcelf.py. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>