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

Zack Weinberg zackw at panix.com
Fri Mar 13 17:41:09 PDT 2009


I'm trying to persuade llvm (svn trunk) to build in a mode where it
*runs on* amd64 but *generates code* for alpha, exclusively.  (Well,
technically, generate code for my experimental architecture simulator
that happens to be based on alpha.)  I have been unable to find any
combination of configure switches that makes this happen.  I should
probably underline that I am _not_ trying to cross-compile LLVM, I am
trying to make LLVM _be_ a cross compiler.

 - The "natural" way to do that (by which I mean "the way you would do
it if you believe what it says in the autoconf manual") would be to
specify --build=x86_64-unknown-linux --target=alpha-unknown-linux.
This produces Makefiles that bomb out on the very first file in the
tree:

$ make
llvm[1]: Compiling Alarm.cpp for Debug build
cc1plus: error: unrecognized command line option "-mieee"
cc1plus: error: unrecognized command line option "-mieee"

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.

 - The other obvious thing to try is not giving any --build or
--target options but instead --enable-targets=alpha.  This builds
successfully but produces llvmc and clang binaries that generate code
for x86_64 by default, and spit out a "unrecognized architecture"
error if I give -arch=alpha.

I have some other, closely-related questions:

 - I assume I need a cross-assembler and -linker.  Will GNU binutils
in cross-architecture mode work for that?  How do I persuade it to use
them?  It seems to be setting itself up to feed Alpha code to "as"
instead of "<target-triplet>-as" which isn't going to work.
 - Does clang have the necessary code to support Alpha?  I noticed
some very architecture-specific-looking code in there, to do with
calling conventions; I'm basically going to have to write that from
scratch for my modified architecture anyway but it would be nice to
know for sure whether it already had the baseline support.  (I'm
avoiding llvm-gcc because I know from extensive prior experience with
GCC that it almost certainly cannot handle the semantics of my
modifications at all.)

Thanks,
zw



More information about the llvm-dev mailing list