powerpc: Introduce and enforce assembler checks on GPR usage
authorJ. Neuschäfer <j.ne@posteo.net>
Thu, 12 Dec 2024 17:05:47 +0000 (18:05 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 30 Dec 2024 21:55:07 +0000 (15:55 -0600)
commitc3e425ead43b9d6c387673f0c09100535584b038
tree52db790875ca5770c936a0f79edc27d09210fb38
parentfd1c2938c0ef23db322b974a5d2b8020aa6a8750
powerpc: Introduce and enforce assembler checks on GPR usage

PowerPC general-purpose registers are historically specified as plain
numbers (0-31), which makes them hard to distinguish from immediates.
For this reason, include/ppc_asm.tmpl defines aliases named r0-r31.
This can still lead to uncaught mistakes if a register is used in place
of a number.

Instead of (e.g.) 5 use %r5, which will result in an assembler warning
if used as a number. Turn these warnings into errors by passing
`--fatal-warnings` to the assembler.

I verified with gazerbeam_defconfig (MPC83xx) and qemu-ppce500_defconfig
(MPC85xx) that this patch results in the same machine code.

Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
arch/powerpc/config.mk
include/ppc_asm.tmpl