[LLVMdev] Compile code for arm

Renato Golin rengolin at systemcall.org
Sat Dec 8 11:43:40 PST 2012


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



More information about the llvm-dev mailing list