Re: [BUG]: KVM: arm64: Fix symbol dependency in __hyp_call_panic_nvhe

From: David Brazdil
Date: Mon Sep 14 2020 - 09:42:19 EST


Hi Nikolaus,

> > Right, it got moved around in upstream.
>
> Maybe this has fixed something...
>

Thanks for reporting this. I've managed to reproduce the problem with Linaro
GCC 4.9.4 and I can also confirm that the same toolchain builds v5.9-rc5 fine.

As Sasha pointed out, the patch was part of a larger series that ended up
moving the definition of __hyp_panic_string to a different source file. That
means in 5.8.7 switch.c sees it declared as 'static const char[]' but in
5.9 it is declared as 'extern const char[]'. When changed to 'extern', 5.8.7
compiles fine so this sounds to me like a bug in GCC that has since been fixed.

That means we have two options:
(a) define __hyp_panic_string in a different .c file in all pre-5.9 branches, or
(b) revert the backported patch.

The patch was needed in 5.9 and should stay there. It wasn't needed in earlier
versions because the symbol was being kept alive by another user. It did "fix"
the inline asm semantics, but the problem was never triggered in pre-5.9.

Sasha, with this and the GCC bug in mind, would you agree that (b) is the
better course of action?

-David