On Fri, Mar 05, 2021 at 12:21:24PM -0800, Sami Tolvanen wrote: > allmodconfig + CONFIG_LTO_CLANG_THIN=y fails to build due to following > linker errors: > > ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21CC): > relocation R_AARCH64_CONDBR19 out of range: 2031220 is not in > [-1048576, 1048575]; references hyp_panic > >>> defined in vmlinux.o > > ld.lld: error: irqbypass.c:(function __guest_enter: .text+0x21E0): > relocation R_AARCH64_ADR_PREL_LO21 out of range: 2031200 is not in > [-1048576, 1048575]; references hyp_panic > >>> defined in vmlinux.o > > This is because with LTO, the compiler ends up placing hyp_panic() > more than 1MB away from __guest_enter(). Use an unconditional branch > and adr_l instead to fix the issue. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1317 > Reported-by: Nathan Chancellor <nat...@kernel.org> > Suggested-by: Marc Zyngier <m...@kernel.org> > Suggested-by: Ard Biesheuvel <a...@kernel.org> > Signed-off-by: Sami Tolvanen <samitolva...@google.com> > --- > arch/arm64/kvm/hyp/entry.S | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-)
Acked-by: Will Deacon <w...@kernel.org> Will