Why is arm64 built with -ffixed-r9 ?

Rasmus Villemoes rasmus.villemoes at prevas.dk
Mon Aug 8 16:34:00 CEST 2022


Looking at one of the .o.cmd files, I noticed that we build arm64 with
both -ffixed-r9 and -ffixed-x18. The latter is obviously what we use for
gd, but the former doesn't seem to serve any purpose on arm64, and just
seems to be an accident of the makefile fragment organization.

When I just remove -ffixed-r9 from arch/arm/config.mk, it builds and
boots just fine (a real patch would of course do some ifndef
CONFIG_ARM64 thing). The code does change, generally of the form "use x9
instead of x10, x10 instead of x11" etc., i.e. the expected register
allocation changes. But the total space saving from having that extra
scratch reg is almost non-existing; a mere 44 bytes for u-boot proper;
apparently aarch64 has plenty of scratch registers even if one is
reserved-and-never-used.

Still, it's somewhat confusing, so if for some reason this is really
needed in some cases (calling into some 32 bit firmware???), I'd like a
comment somewhere.

Rasmus


More information about the U-Boot mailing list