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

Jim Grosbach grosbach at apple.com
Tue Jul 24 13:45:11 PDT 2012


On Jul 24, 2012, at 1:29 PM, Renato Golin <rengolin at systemcall.org> wrote:

> 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.
> 
> 

I'm with Eric, here. Huh? You have a very different recollection of events than I.

> 
>> 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!
> 

The question was how to get the same behavior as on Darwin. I pointed at the code that does this for Darwin. I make no claims that the code there, or anywhere else in Driver, for that matter, is anything resembling a paragon of fine design. That was, however, not the question.


> 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")"!!!


Patches welcome.


> 
> -- 
> cheers,
> --renato
> 
> http://systemcall.org/




More information about the llvm-dev mailing list