target/arm/kvm: Make uncalled stubs explicitly unreachable
commit281a3c330e0d694ce4f364fa0f74738ac4afd6dc
authorAndrew Jones <drjones@redhat.com>
Thu, 1 Oct 2020 06:17:14 +0000 (1 08:17 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 8 Oct 2020 14:24:32 +0000 (8 15:24 +0100)
tree1f6d76a4c97d29c7b8c7cf3c8ae5732793811ceb
parent94c7fefcb456b0b26f04b30e6df54a0c872e862d
target/arm/kvm: Make uncalled stubs explicitly unreachable

When we compile without KVM support !defined(CONFIG_KVM) we generate
stubs for functions that the linker will still encounter. Sometimes
these stubs can be executed safely and are placed in paths where they
get executed with or without KVM. Other functions should never be
called without KVM. Those functions should be guarded by kvm_enabled(),
but should also be robust to refactoring mistakes. Putting a
g_assert_not_reached() in the function should help. Additionally,
the g_assert_not_reached() calls may actually help the linker remove
some code.

We remove the stubs for kvm_arm_get/put_virtual_time(), as they aren't
necessary at all - the only caller is in kvm.c

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
Message-id: 20201001061718.101915-3-drjones@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/kvm_arm.h