[U-Boot] arm: U-Boot API - clang support broke ABI

Jeroen Hofstee jeroen at myspectrum.nl
Sat Nov 23 12:20:54 CET 2013


Hello Leif,

On 11/18/2013 12:26 PM, Leif Lindholm wrote:
> Commit fe1378a - "ARM: use r9 for gd" - broke the ABI for users of the
> U-Boot API on ARM. Users I am aware of are GRUB and the FreeBSD loader.
> Since I only spotted this on Saturday, this code is well and truly in
> the wild, so any users of the API will need to preserve both r8 and r9
> on syscalls for the foreseeable future (which is not the end of the
> world).

After looking into it a bit better it seems the standalone applications
don't use the api, but poke into u-boot directly to look for a
separate jump-table in gd. I am still a bit surprised it works like that,
but at least the api doesn't. (I sent a patch to fix them)

The api issue is therefore only related to requirement that r9 needs
to be preserved. The README states since the beginning of the git
repro (2002-11-03) [1] that r8 _and_ r9 have special meaning in U-boot.
Albert removed the need for the GOT pointer (r9) over time by limiting
the supported relocation types, so the move from r8 to r9 was not
expected to cause an ABI problem, since both were special register
already. Anyway, I will have a look if it did break the ubldr.

> Sometime last year I proposed a change to make the API syscall entry
> and exit points responsible for maintaining full procedure-call standard
> compliance, although the patch I provided was on the hackier side of
> good (and probably wrong).

After the switch to r9 the call on ARM is eabi compliant, with r9 being a
platform register as allowed by the specs. Whether u-boot or the payload
is responsible for preserving r9 / in general should preserve and restore
its special registers in API calls is better answered by the maintainers.

Regards,
Jeroen


More information about the U-Boot mailing list