Building an ARM/RPI-B release (hacked) on CURRENT/AMD64.
Albert ARIBAUD
albert.u.boot at aribaud.net
Mon Jun 2 06:21:17 UTC 2014
Hi Jeroen et al.,
On Sun, 01 Jun 2014 21:10:25 +0200, Jeroen Hofstee
<freebsd_arm at myspectrum.nl> wrote:
> On do, 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. :-(
> >
>
> Well with a bit of creativity this will work [1]. Hopefully this ends up
> in mainline u-boot. For the record, it is the U-Boot Arm maintainer
> (Albert) who actually dug up the fixed-r9 in llvm (but was a hidden
> option for ios).
Although my name was not uttered thrice :) allow me to chime in
still, and say that while I did dig up the r9 option, it was a mere
consequence of Jeroen's effort to make U-boot build with LLVM, and that
even though the EABI states that r9 is the register to use if you need
one to store a global constant, U-Boot itself used r8 rather than r9
and thus was non-compliant until Jeroen fixed it in mainline, see commit
fe1378a961e508b31b1f29a2bb08ba1dac063155), and it is Jeroen's effort
too that will make U-Boot eventualy buildable with LLVM/clang.
BTW, Jeroen, I'll have a look at your patch series today.
> Regards,
> Jeroen
>
> [1]
> https://github.com/jhofstee/u-boot/commit/4ab717325cb7e7b02efaec2b3f95bf9874492ba2
Amicalement,
--
Albert.
More information about the freebsd-arm
mailing list