Hello, Is there any LLVM cross-compiler built for ARM. If not, then could you provide some pointers where I could start creating one?
On 28 August 2013 01:18, pavan p m pm.pavan@gmail.com wrote:
Hello, Is there any LLVM cross-compiler built for ARM. If not, then could you provide some pointers where I could start creating one?
Hi Pavan,
Most binary releases cross-compile by default, so the chances that your current copy of Clang can already compile to whatever platform you want. But you'll need some additional tools (like binutils) and libraries (like libgcc and others) targeted to the correct architecture to make it work. LLVM should automatically pick up the right tools, headers and libraries if you specify --sysroot and --target options appropriately.
I'm assuming you want to cross-compile from x86_64 to ARM, in which case you'll need the arm-gcc toolchain. You can download it from http://releases.linaro.org/ or you can install directly from your package manager.
cheers, --renato
Thanks Renato, Yes, i wanted to cross-compile from x86_64 to ARM. More specifically, I needed to do it for the cortex m0 processor. My eventual goal would be to tweak a certain part of the instruction scheduler specific to the project I am working on. So I am thinking if it is possible using LLVM. I was going thru the documentation of LLVM-backend and thought as a first step, try to generate a cross compiler for ARM and then tweak the code once the cross compiler is ready. I saw that there is support for cortex-a9 onwards, but am not sure, if there is any support for cortex m series. In that case, I would have implement a backend which would support this particular board. This seems to be a long shot, but would you provide your opinion if this is possible at all? If not, then what would be the proper approach?
Thanks, Pavan
On 28 August 2013 01:14, Renato Golin renato.golin@linaro.org wrote:
On 28 August 2013 01:18, pavan p m pm.pavan@gmail.com wrote:
Hello, Is there any LLVM cross-compiler built for ARM. If not, then could you provide some pointers where I could start creating one?
Hi Pavan,
Most binary releases cross-compile by default, so the chances that your current copy of Clang can already compile to whatever platform you want. But you'll need some additional tools (like binutils) and libraries (like libgcc and others) targeted to the correct architecture to make it work. LLVM should automatically pick up the right tools, headers and libraries if you specify --sysroot and --target options appropriately.
I'm assuming you want to cross-compile from x86_64 to ARM, in which case you'll need the arm-gcc toolchain. You can download it from http://releases.linaro.org/ or you can install directly from your package manager.
cheers, --renato
On 28 August 2013 18:17, pavan p m pm.pavan@gmail.com wrote:
Thanks Renato, Yes, i wanted to cross-compile from x86_64 to ARM. More specifically, I needed to do it for the cortex m0 processor. My eventual goal would be to tweak a certain part of the instruction scheduler specific to the project I am working on. So I am thinking if it is possible using LLVM.
This is most definitely possible! ;)
I saw that there is support for cortex-a9 onwards, but am not sure, if
there is any support for cortex m series.
There is support for M0, you just have to specify "-target thumbv6m -mcpu=cortex-m0" and you should be good to go. Because LLVM is inherently a cross-compiler, you can only specify a CPU when using the right back-end, and you do so by specifying the "-target". I agree this is confusing and I intend to map all confusing things when cross-compiling, so if you do find weird behaviour, be sure to send my way.
In that case, I would have implement a backend which would support this
particular board. This seems to be a long shot, but would you provide your opinion if this is possible at all? If not, then what would be the proper approach?
You don't need to implement the back-end, only the pass you want. I'm not sure how easy it is to plugin a new scheduler, as the LLVM scheduler is a bit of a mess, but you could try by changing the current scheduler(s).
A few documents that you can find interesting, some of which you seem to have read already:
http://llvm.org/docs/WritingAnLLVMBackend.html
http://llvm.org/docs/CodeGenerator.html
http://llvm.org/docs/CodingStandards.html
http://llvm.org/docs/ProgrammersManual.html
cheers, --renato
linaro-toolchain@lists.linaro.org