Skip to content
Commit 5e0e1a86 authored by Samuel Holland's avatar Samuel Holland Committed by Michal Simek
Browse files

tools: relocate-rela: Fix ELF decoding on big-endian hosts



The new ELF decoding logic assumed that the target binary has the same
endianness as the host, which broke building ARM64 firmware binaries on
big-endian machines.

This commit fixes the ELF64 decoding to be host-endianness-neutral, and
applies the same changes to the ELF32 decoding. It does not fix the
microblaze-specific dynamic symbol decoding.

It also corrects the functions used for byte swapping in rela_elf64()
and rela_elf32(). The result is the same, but semantically the code is
converting bytes read from a foreign-endianness file to host byte order.

Fixes: 4c9e2d64 ("tools: relocate-rela: Read rela start/end directly from ELF")
Fixes: a1405d9c ("tools: relocate-rela: Check that relocation works only for EM_AARCH64")
Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20220715064026.54551-1-samuel@sholland.org


Signed-off-by: default avatarMichal Simek <michal.simek@amd.com>
parent 71f07731
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment