All of lore.kernel.org
 help / color / mirror / Atom feed
* Why is arm64 built with -ffixed-r9 ?
@ 2022-08-08 14:34 Rasmus Villemoes
  2022-08-08 15:41 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2022-08-08 14:34 UTC (permalink / raw)
  To: u-boot; +Cc: Tom Rini

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Why is arm64 built with -ffixed-r9 ?
  2022-08-08 14:34 Why is arm64 built with -ffixed-r9 ? Rasmus Villemoes
@ 2022-08-08 15:41 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2022-08-08 15:41 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]

On Mon, Aug 08, 2022 at 04:34:00PM +0200, Rasmus Villemoes wrote:

> 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.

I strongly suspect this is just a remnant of how the Makefile logic is,
and that since nothing failed with -ffixed-r9 it just kept being used.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-08 15:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-08 14:34 Why is arm64 built with -ffixed-r9 ? Rasmus Villemoes
2022-08-08 15:41 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.