[LLVMdev] Setting up a cross-compiler for cortex-m3

Renato Golin rengolin at systemcall.org
Tue Jul 24 13:29:37 PDT 2012


On 24 July 2012 17:53, Jim Grosbach <grosbach at apple.com> wrote:
> The more "make the driver more sane for ARM cross compilers" work? That could be a pretty big deal, though it'd mostly be political and testing work. The actual implementation details are likely to not be that bad.

I think there's more to it that just "sane for ARM". Mips, PowerPC and
other "main" architectures also probably suffer from cross-compilation
issues and should be dealt with by any patch that fixes ARM.

James has a patch, ready to commit, and that transformed Clang's
driver into a pattern-matching monster. You could just specify -mcpu,
or just -march or just -mtune and it'd do everything else for you. All
in table-gen, all clean and easy to maintain. It was roughly 5~8
files, about a thousand lines of code, mostly new stuff and cleaning
the trash/

IIRC, it took him a week or so to do all that, and months waiting for
answers, then years waiting for more answers. It was more than just
tests, and until today I have no idea what it was... There was always
something wrong but no one could tell what, but it stopped the patch
anyway.

Seeing the state that the driver is today (exactly the same mess it
was last year), I say anyone could do it in a week in table-gen and
encompass one major architecture. Another week or so to encompass all
others. (James had for Intel and ARM). AFAIK, James is on holidays, I
think he'll be happy to hear that his idea is now getting more
acceptance, and maybe even resurrect his original patch.



> Making Thumb2 the default for any ARMv7 triple, on the other hand, is a change that could be made in a matter of minutes.

It's not that simple. That defaults Thumb for v7 architectures, which
means armv7 and thumbv7 would be the same. A better fix would be to
make thumbv7m to actually produce the correct thumb code!

I'll have a look at this. It should be just a matter of spotting the
Thumb2 flag for v7m. And for the love of god, stop with
"Suffix.startswith("v7")"!!!

-- 
cheers,
--renato

http://systemcall.org/



More information about the llvm-dev mailing list