[RFC] make arm-use-movt and arm-reserve-r9 options available for all arm

Renato Golin renato.golin at linaro.org
Mon Aug 12 11:36:44 PDT 2013


On 12 August 2013 18:31, Jeroen Hofstee <llvm at myspectrum.nl> wrote:

>  U-boot uses 'register volatile gd_t *gd asm ("r8")' to access data which
> needs
> to be available before and after relocation. This is a global definition
> and gcc
> is compiled with -ffixed-r8 in order to prevent using r8.
>

Ok, it's better than I feared, but worse than I hoped for.

Why is U-boot using R8 and not R9 as described in the AAPCS?

After a few Google searches, it seems that -ffixed-r8 seems to be (almost?)
exclusively used by u-boot, which is worrying, and not the kind of thing
LLVM wants to implement. But, as you say, keeping R9 ARM-wide fixed is an
AAPCS rule, so we're in the safe there.

>From an EABI point of view, I'm happy with making that flag global, but
you'll have to juggle Clang vs. LLVM patches to keep breaking stuff to a
minimum. You'll also have to check with Darwin folks if that's ok with them
as well.


    __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr));
>

This should also work with GCC without the -ffixed-r8 flag, but with the
respective AAPCS variant for R9, right? It sounds like a good patch for
u-boot.


See above, and the initial commit. I want r9 to always be left alone. IOS
> doesn't
> for some reasons I do not know, but it is not for AAPCS. (and if I have to
> guess,
> it is related to their r9 usage depending on the target).
>

I have to say, I'm a bit lost on the v6 thing. I don't mind much how you're
going to use it as long as you don't change the current behaviour on all
platforms (ie. don't change the default flag status on Clang or the default
state on LLVM for any target).


No, not manually at least, just build it on Linux and verified u-boot works.
>

This is good news, but not enough. After you build Clang/LLVM, do a "make
check-all". That will cover the basics, and hopefully there will be tests
on the R9 behaviour for Darwin. But that's still very limited, so it'd be
good to run the test-suite to make sure that the correct flags are being
passed down on complex build environments (ie. to check for regressions).

This is the test-suite how to, it's very simple:
http://llvm.org/docs/lnt/quickstart.html

AFAIK, you can't run them cross to ARM, so you'll have to run it on an ARM
board. You can cross-compile Clang/LLVM and copy the install dir to the
board and point the --cc and --cxx to that, or you can build Clang/LLVM on
the board itself (easier, but takes longer).

Here are some instructions on how to build it on ARM (to limit the number
of stuff you have to compile):
http://llvm.org/docs/HowToBuildOnARM.html

If you're building it natively, make sure you "make check-all", too.

FYI, a Chromebook build on those conditions takes about 50 min to build +
10 min for check-all + 1 hour for the test-suite.


I grepped for the usage of these flags inside llvm / clang, but there is
> nothing interesting there. I do not have a darwin / ios build env.
>

This could be one of the features that is interesting to Apple only, Jim
can comment on that better than me. He could also test your patch locally
on Darwin targets.

thanks,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130812/18edbb57/attachment.html>


More information about the llvm-commits mailing list