powerpc/boot: Stop using RELACOUNT
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Wed, 6 Apr 2022 07:00:38 +0000 (17:00 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 5 May 2022 12:11:58 +0000 (22:11 +1000)
commitc14d31bae372e050b053f2511fb3f0f90c27e4f9
tree1bf9764c251e090aee5b678aa76f05847d0c9c4b
parent3ba4289a3e7ff4a89a78c4f74d694a344e8d9cc9
powerpc/boot: Stop using RELACOUNT

So far the RELACOUNT tag from the ELF header was containing the exact
number of R_PPC_RELATIVE/R_PPC64_RELATIVE relocations. However the LLVM's
recent change [1] make it equal-or-less than the actual number which
makes it useless.

This replaces RELACOUNT in zImage loader with a pair of RELASZ and RELAENT.
The vmlinux relocation code is fixed in commit d79976918852
("powerpc/64: Add UADDR64 relocation support").

To make it more future proof, this walks through the entire .rela.dyn
section instead of assuming that the section is sorter by a relocation
type. Unlike d79976918852, this does not add unaligned UADDR/UADDR64
relocations as we are likely not to see those in practice - the zImage
is small and very arch specific so there is a smaller chance that some
generic feature (such as PRINK_INDEX) triggers unaligned relocations.

[1] https://github.com/llvm/llvm-project/commit/da0e5b885b25cf4

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220406070038.3704604-1-aik@ozlabs.ru
arch/powerpc/boot/crt0.S