[cfe-dev] Cross compiling with clang

Guilherme guibufolo+llvm at gmail.com
Tue May 12 02:54:29 PDT 2015


On Tue, May 12, 2015 at 11:19 AM, Renato Golin <renato.golin at linaro.org>
wrote:

> On 12 May 2015 at 09:55, Guilherme <guibufolo+llvm at gmail.com> wrote:
> > But what I could not find is a list, link or reference to where get a
> > version of clang for windows which is able to cross-compile to ARM.
>
> Hi Guilherme,
>
> Clang+LLVM is a native cross-compiler. If the appropriate back-end is
> bundled, it will produce that target's assembly or, if integrated
> assembler is supported, object files. But it will not generate
> executables, since we don't distribute (yet) a cross-linker, nor all
> targets' libraries. You'll need to source that elsewhere.
>
>
> > D:\Playground\xcompile-arm>c:\llvm\bin\clang.exe -target
> > armv7-unknown-none-elf main.c
> > clang.exe: warning: unknown platform, assuming -mfloat-abi=soft
> > clang.exe: warning: unknown platform, assuming -mfloat-abi=soft
>
> It seems that your binary doesn't have the ARM back-end compiled with
> it. I believe we should be a lot better in specifying this, as this
> error message is very misleading.
>
> It also seems that the PowerPC back-end was not compiled with your
> binary, so you'll need to either find someone that has compiled a
> Windows binary that can cross-compile to PPC, or do it yourself.
>
> By default, a standard build of LLVM builds *all* back-ends, so if you
> just follow the website's "getting started" guide, you'll get all you
> need in the compiler side.
>

So it seems that the provided binary on the llvm site does not have *all*
the backends. I get following error when trying to create an object file.

D:\Playground\xcompile-arm>c:\llvm\bin\clang.exe -target
powerpc-unknown-none-eabi -c main.c
Assembler messages:
Fatal error: invalid listing option `3'
clang.exe: error: assembler command failed with exit code 1 (use -v to see
invocation)


>
> But you'll still need a PPC linker, and probably some PPC static
> libraries for bare-metal.
>
>
> > For the sys part of the triple, if i'm doing bare metal development,
> should
> > i use None? What exactly does the sys part change when compiling code?
>
> In ARM, "none-eabi" specifies bare-metal, I don't know in PPC. Triples
> have a lot of target specific idiosyncrasies, and that's older than
> LLVM, so we're just following the legacy. :)
>
> cheers,
> --renato
>

How do i find out what the proper triple is? Can somebody help me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150512/243ebeb8/attachment.html>


More information about the cfe-dev mailing list