[Skiboot] [PATCH 03/13] cpu.h: implement this_cpu for clang
joel at jms.id.au
Thu May 3 13:13:23 AEST 2018
On 3 May 2018 at 07:19, Balbir Singh <bsingharora at gmail.com> wrote:
> On Wed, 2018-05-02 at 18:07 +0930, Joel Stanley wrote:
>> Clang can't use the global register variable, so instead load struct
>> cpu_thread from r13 and return it.
> How do we know clang is not using r13 for anything else? Does -ffixed-reg
> work with r13?
That is a really good question. I was really surprised (excited!) that
it booted once I had fixed all of the issues I knew about, I forgot to
go back and ensure clang was reserving r13.
I looked at skiboot.elf and it isn't using r13 to store anything,
aside from the occasions where we do so in asm/head.S.
Clang does have the concept of fixed registers, but currently only
supports a couple for ARM:
$ clang-7 --help | grep fixed
-ffixed-r19 Reserve the r19 register (Hexagon only)
-ffixed-r9 Reserve the r9 register (ARM only)
-ffixed-x18 Reserve the x18 register (AArch64 only)
More information about the Skiboot