eliben / pyelftools

Parsing ELF and DWARF in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support AArch64 in ELF32 (ILP32)

ondrudav opened this issue · comments

ILP32 on AArch64 produces ELF32 files with alternative relocation codes as defined by: https://github.com/ARM-software/abi-aa/blob/b0f1111afbd7d0aa8f2b160dd63971e69c99955a/aaelf64/aaelf64.rst#L1028

Currently this results in Unsupported relocation type: X exceptions

I'm considering adding the codes to ENUM_RELOC_TYPE_AARCH64 and _RELOCATION_RECIPES_AARCH64 as it's the simplest but this has 2 downsides:

  1. Lack of error when a code occurs in a file of the opposite variation.
  2. R_AARCH64_NONE and R_AARCH64_P32_NONE are both 0 and readelf.py won't tell the difference.
    • Note: the code only knows R_AARCH64_NONE under the alias 256

The other option is another pair of enum + dict for ILP32 and conditionals in _do_apply_relocation() and describe_reloc_type() if I'm not missing anything.