BUGFIX: Fix endianness issues with PIE binaries #245
A few endianness issues were encountered when setting an RPATH on ppc32 PIEs (since they are of type DYN). This pull request fixes those issues, and adds regression tests for:
The text was updated successfully, but these errors were encountered:
Previously when running `patchelf --set-rpath "/usr/sbin" my_bin` on a PIE ppc32 binary that had no RPATH a few issues were encountered. This commit fixes: 1. The PT_PHDR being sorted improperly due to the type being read in incorrect endianness 2. The aligment being set to default 0x1000 due to the machine arch being read in incorrect endianness 3. The interpreter being clobbered due to the replace sections routine reading sh_offset and sh_size in incorrect endianness 4. The PHDR segment having an incorrect virt and phys address due to reading the e_phoff in the incorrect endianness This also fixes a read of the shdr.sh_type in writeReplacedSections but this was not encountered during testing.