Using LLVM as a crosscompiler

Hello, Koen.

So my question is: How should I build llvm and llvm-gcc4 to have it cross-compile from x86
to ARM/EABI?

Well, just supply appropriate --host/--target options to configure.
I haven't tried ARM, but this definitely works for crosscompiling from
linux to mingw32. Please also note, that you'll need native (=arm) tools
(binutils, libcheaders, etc) during gcc build process.

Anton Korobeynikov schreef:

Hello, Koen.

So my question is: How should I build llvm and llvm-gcc4 to have it cross-compile from x86
to ARM/EABI?

Well, just supply appropriate --host/--target options to configure.

To llvm or llvm-gcc4?

I haven't tried ARM, but this definitely works for crosscompiling from
linux to mingw32. Please also note, that you'll need native (=arm) tools
(binutils, libcheaders, etc)

You mean binutils-cross, right?

during gcc build process.

Building gcc as a crosscompiler is fully automized in OpenEmbedded, I'm trying to add
llvm-gcc4 into that framework.

regards,

Koen

Hi Koen,

The process to build llvm-gcc as a crosscompiler is basically the same
as build a normal gcc as crosscompiler. The differences: you need a
LLVM installed (compiled for the host). You must configure llvm-gcc
with --enable-llvm.

Problems:
- Today LLVM supports ARM/EABI, but llvm-gcc don't. You must apply the patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070319/046070.html
(Please someone commit this patch!)
- If your host system libraries are newer then gcc 4.0, you must
configure llvm-gcc with "--disable-shared" (this is a workaround for a
bug)

It would be great to have llvm-gcc inside OpenEmbedded. The Mamona
project could be the first Linux distribution totally compiled by
llvm-gcc!

Lauro

Lauro Ramos Venancio schreef:

It would be great to have llvm-gcc inside OpenEmbedded. The Mamona
project could be the first Linux distribution totally compiled by
llvm-gcc!

llvm-native 1.9 is in OE[1], I'm now working on getting the cvs version added and when
that works llvm-gcc4 + EABI patch. I'll have to finish a project at the university first,
but a llvm-gcc4 recipe should be ready for testing somewhere between easter and ELC2007.

Any recommended testsuites I could run?

regards,

Koen

[1] http://www.openembedded.org/filebrowser/org.openembedded.dev/packages/llvm

Lauro Ramos Venancio schreef:

Hi Koen,

The process to build llvm-gcc as a crosscompiler is basically the same
as build a normal gcc as crosscompiler. The differences: you need a
LLVM installed (compiled for the host). You must configure llvm-gcc
with --enable-llvm.

Problems:
- Today LLVM supports ARM/EABI, but llvm-gcc don't. You must apply the
patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070319/046070.html

That doesn't apply anymore :frowning:

regards,

Koen

> - Today LLVM supports ARM/EABI, but llvm-gcc don't. You must apply the
> patch:
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070319/046070.html

That doesn't apply anymore :frowning:

You must use the llvm-gcc4 from the svn. It has some bug fixes that
are important to ARM EABI and the patch should apply cleanly.

Lauro

This patch doesn't break anything on powerpc-apple-darwin8, so I've checked it in
(note that configuration doesn't use the libstdc++ bits, though). Lauro, please keep
an eye open for regressions.

Lauro Ramos Venancio schreef:

Hi Koen,

The process to build llvm-gcc as a crosscompiler is basically the same
as build a normal gcc as crosscompiler. The differences: you need a
LLVM installed (compiled for the host). You must configure llvm-gcc
with --enable-llvm.

grep llvm configure* doesn't return anything in trunk/, did I checkout[1] the wrong svn?

regards,

Koen

[1] svn://anonsvn.opensource.apple.com/svn/llvm/trunk

Hello

grep llvm configure* doesn't return anything in trunk/, did I
checkout[1] the wrong svn?

No. It's ok :slight_smile: It's just complicated nature of gcc's build system. In
fact, try "grep llvm gcc/configure" :slight_smile: