Building an ARM/RPI-B release (hacked) on CURRENT/AMD64.

Warner Losh imp at bsdimp.com
Thu Apr 17 19:14:34 UTC 2014


On Apr 17, 2014, at 1:07 PM, Ian Lepore <ian at FreeBSD.org> wrote:

> On Thu, 2014-04-17 at 19:01 +0100, Mark R V Murray wrote:
>> On 17 Apr 2014, at 13:49, Ian Lepore <ian at FreeBSD.org> wrote:
>> 
>>> U-boot requires that a global register be set aside by the compiler and
>>> it's used to access all global vars.  As I vaguely understand it, u-boot
>>> used to want r8 for this, and clang didn't used to support the concept
>>> at all.  Now clang supports it, but only for r9, and apparently more
>>> recent u-boot expects r9 rather than r8.  So the fix is probably to use
>>> more recent u-boot sources (I've been using 2014.01 for imx6 stuff), and
>>> probably to add the new -ffixed-r9 flag for a clang build.
>> 
>> Correct.
>> 
>> The pig in trying to build u-boot 2004.04 with Clang/XDEV is the use of
>> 
>> #define DECLARE_GLOBAL_DATA_PTR                register volatile gd_t *gd asm ("r9”)
>> 
>> which means “gd is an alias for the r9 register and is a pointer to type …”
>> 
>> … I think. :-)
>> 
>> Clang doesn’t like this one bit. First objection is to “global register variables”, so if I experimentally knock out the “register”, I simply get the second objection - to "multiple instances of the r9 global variable”.
>> 
>> Googling a bit suggests that Clang just plain can’t do this. :-(
>> 
>> M
> 
> Hmmm.  After a bit of poking around in the llvm code, it looks like the
> full extent of the support for -ffixed-r9 is that it doesn't consider
> that register available for use by the code generator; that's only part
> of what u-boot needs.  

what’s the other part? Global register variables like this?

> Some online notes I found for clang 3.5 claim that global register
> variables aren't supported, and aren't likely to be any time soon.

Is that a poke in the eye of uboot, or is it more of a contention that
uboot is moving away from that need?


Warner



More information about the freebsd-arm mailing list