[LLVMdev] Compile code for arm

Renato Golin rengolin at systemcall.org
Sat Dec 8 12:05:16 PST 2012


Ok, These are the three options you should be playing with:

-ccc-host-triple $(CCC_HOST_TRIPLE_ARM) \
--sysroot=$(SYSROOT_ARM) \
-gcc-toolchain $(GCC_TOOLCHAIN)

Where the (sic) host triple defines the "target" triple too.

Sysroot and gcc-toolchain is where you'll find the libraries and
binutils for the ARM targets (you'll need them, since LLVM still can't
cross-compile on its own).

Another alternative is to compile to assembly and assembly/link with
ARM gnu binutils, which is essentially the same thing, for now.

Feel free to search for those three options on the list and you'll
find a plethora or examples and discussions that will guide you
through the process.

cheers,
--renato


On 8 December 2012 19:52, Amir Yazdanbakhsh <amir.yazdanbakhsh at gmail.com> wrote:
> Thanks for your help. But I got this warning which it seems it doesn't use
> -triple
>
> "clang: warning: argument unused during compilation: '-triple arm-none-eabi'
> "
>
> Best Regards,
> A. Yazdanbakhsh
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> PhD. Student
> School of Electrical and Computer Engineering
> University of Wisconsin-Madison
> E-mail:     yazdanbakhsh at wisc.edu
>
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
>
>
> On Sat, Dec 8, 2012 at 1:43 PM, Renato Golin <rengolin at systemcall.org>
> wrote:
>>
>> On 8 December 2012 19:10, Amir Yazdanbakhsh <amir.yazdanbakhsh at gmail.com>
>> wrote:
>> > Hi,
>> >
>> > I've installed clang version 3.3 on ubuntu.
>> > I want to cross-compile a C code into ARM (preferably) ARMv7. I want to
>> > get
>> > both assembly code and binary. Can anyone help me what are the steps
>> > which
>> > should I take?
>>
>> clang -triple arm-none-eabi (or many other variations including
>> 'armv5', 'armv7a', 'linux', 'gnueabi', etc).
>>
>> There are other options, like -mcpu, -mfpu, -march, -mthumb that you
>> can also tune. I'm not sure there is a list of all available options,
>> but since you have the source, you can look into ToolChain.cpp or
>> Tools.cpp in Clang/lib/Driver and see for yourself all the available
>> options.
>>
>>
>> > Second question, Is there anyway to tell compiler not to use any
>> > Thumb/NEON/VFP instructions?
>>
>> Using the same flags, you can tune at your leisure. The combination of
>> compiler flags might not be the most straightforward, as this is
>> somewhat a messy region. I advise you to search the list and try a bit
>> for yourself, always checking on clang's source what's available.
>>
>> cheers,
>> --renato
>
>



-- 
cheers,
--renato

http://systemcall.org/



More information about the llvm-dev mailing list