[LLVMdev] setting up LLVM to *run on* amd64 but *generate code* for alpha

Zack Weinberg zackw at panix.com
Fri Mar 20 17:22:08 PDT 2009


On Mon, Mar 16, 2009 at 11:25 AM, Chris Lattner <clattner at apple.com> wrote:
> Hi Zack, welcome!

I regret to say I'm disappearing again.  I was only looking at LLVM
for a class project which is now done with, and I'm not really
interested in compiler development for the fun of it anymore.  I do
want to respond to some of the things that you (and others) said...

> On Mar 13, 2009, at 5:41 PM, Zack Weinberg wrote:
>> I'm trying to persuade llvm (svn trunk) to build in a mode where it
>> *runs on* amd64 but *generates code* for alpha, exclusively.

As a general note, if you're trying to do cross compilation work, it
is important to be able to set the compiler's *default* target
architecture.  "Oh, you can just build with support for all targets
and then stick -arch=foobar on the command line" is not good enough,
because setting up a cross compilation environment involves mucking
with a good half-dozen different programs and libraries, none of which
are configured in the same way -- oh, sure, you *can* hack up all
their build systems to pass an extra switch to the compiler, but you
really don't want to have to.

>> because Makefile.config has ARCH=Alpha, and Makefile.rules changes the
>> options passed to the build compiler based on ARCH.  IMO this is a
>> bug, but I don't understand your makefile system well enough to fix
>> it.
>
> LLVM and Clang (but not llvm-gcc) use a different approach than the standard
> autoconf model for building cross tool chains.  Instead of configuring the
> build to specialize it for one target, we just set the list of enabled
> targets.  LLVM is natively cross build aware and the tools can all support
> multiple targets at once (even dynamically loading them).
>
> To pick a set of targets to build, configure llvm with the
> --enable-targets=foo option, where foo is "all" (the default) "native" (host
> target only) or a list of llvm targets to build.  This is strictly an
> optimization to reduce build time of llvm, you should always be safe to just
> build all targets.

I don't like this answer. ;-)

It is really really important for everything that has a "configure"
script to support the baseline set of options defined by Autoconf,
*with the semantics described in the Autoconf manual*.   It's nice
that LLVM can support more than one target per configuration, but that
doesn't excuse not making --target do something sensible.  (Per what I
said above, how about having --target just set the default target, and
if you want to prune the list there's still --enable-targets?)

What --target presently does just makes no sense at all.

I'd also like to mention that, on a one-year-old IBM laptop, building
all the LLVM back-ends takes about three times as long as just
building one of them.

-- I don't mean to be ragging on y'all, but the fact is that I gave up
on LLVM and went back to GCC for my project because of these build
problems.  I don't know if it would have been easier to make the
modifications to LLVM that I had in mind than the modifications I
ended up making to GCC -- but I didn't waste nearly a week trying to
get a working cross toolchain with GCC.

zw




More information about the llvm-dev mailing list