fix(qemu): fix 32-bit builds with stack protector

When using the ENABLE_STACK_PROTECTOR=strong build option, the QEMU code
will try to use the RNDR CPU instructions to initialise the stack
canary. Since the instructions are defined for AArch64 only, this will
fail to build for AArch32.

And even though we now always return "false" when asked about the
availability of the RNDR instruction, the compiler will still leave the
reference to read_rdnr() in, if optimisations are turned off (-O0).

Avoid this by providing a dummy read_rndr() implementation, that makes
the linker happy in any case.

This fixes the QEMU build for AArch32 with ENABLE_STACK_PROTECTOR=strong

Change-Id: Ibf450ba4a46167fdf3a14a527d338350ced8b5ba
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
This commit is contained in:
Andre Przywara 2023-05-23 10:34:38 +01:00
parent 733d112f05
commit e57ca899ef

View file

@ -8,6 +8,7 @@
#ifndef ARCH_HELPERS_H
#define ARCH_HELPERS_H
#include <assert.h>
#include <cdefs.h>
#include <stdbool.h>
#include <stdint.h>
@ -352,6 +353,17 @@ DEFINE_DCOP_PARAM_FUNC(cvac, DCCMVAC)
*/
DEFINE_COPROCR_RW_FUNCS(clusterpwrdn, CLUSTERPWRDN)
/*
* RNDR is AArch64 only, so just provide a placeholder here to make the
* linker happy.
*/
static inline u_register_t read_rndr(void)
{
assert(1);
return 0;
}
/* Previously defined accessor functions with incomplete register names */
#define dsb() dsbsy()
#define dmb() dmbsy()