arm64: relocate-rela: Add support for ld.lld
authorAlistair Delva <adelva@google.com>
Wed, 20 Oct 2021 21:31:32 +0000 (21:31 +0000)
committerTom Rini <trini@konsulko.com>
Mon, 15 Nov 2021 19:33:32 +0000 (14:33 -0500)
commit9d3d981661000d8496d3b7836f3bd55d6534dd05
treef95003c3e313616247ed7d0b3036264d091e9b85
parent9272805139a104c83dff8230e03e9626dd9bc195
arm64: relocate-rela: Add support for ld.lld

Cap end of relocations by the binary size.

Linkers like to insert some auxiliary sections between .rela.dyn and
.bss_start. These sections don't make their way to the final binary, but
reloc_rela still tries to relocate them, resulting in attempted read
past the end of file.

When linking U-Boot with ld.lld, the STATIC_RELA feature (enabled by
default on arm64) breaks the build. After this patch, U-Boot can be
linked successfully with and without CONFIG_STATIC_RELA.

Originally-from: Elena Petrova <lenaptr@google.com>
Signed-off-by: Alistair Delva <adelva@google.com>
Cc: David Brazdil <dbrazdil@google.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Tom Rini <trini@konsulko.com>
tools/relocate-rela.c