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

Jim Grosbach grosbach at apple.com
Tue Jul 24 09:53:24 PDT 2012


On Jul 23, 2012, at 1:52 PM, salvatore benedetto <salvatore.benedetto at gmail.com> wrote:

> On Mon, Jul 23, 2012 at 8:14 PM, Renato Golin <rengolin at systemcall.org> wrote:
>> On 23 July 2012 17:03, Chris Cadwallader <ccadwallader at arxan.com> wrote:
>>> On Darwin, if -march is armv7 clang's driver will assume you want thumb2 unless you also give it -mno-thumb but that is irrelevant with mcpu=cortex-m3.
>> 
>> I think that Thumb2 should be the default for v7 on any system, not
>> just Darwin. Maybe some ARM folk can comment on this...
>> 
> 
> Just out of curiosity, is anyone working on this?
> Is there a ticket opened?
> 
> And yet out of curiosity, how much of work is this?
> Weeks? Months?
> 

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.

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

See ToolChain::ComputeLLVMTriple(). In particular, the following:

// Thumb2 is the default for V7 on Darwin.                                   
    //                                                                           
    // FIXME: Thumb should just be another -target-feaure, not in the triple.    
    StringRef Suffix =                                                           
      getLLVMArchSuffixForARM(getARMTargetCPU(Args, Triple));                    
    bool ThumbDefault = (Suffix.startswith("v7") && getTriple().isOSDarwin()); 

Just remove the check for Darwin.

-Jim

> As I have officially switched to clang for my project, I'm very
> interested in seeing this fixed. :-)
> 
> Regards,
> S.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list