I have some broad newbie questions about LLVM and its language front-ends with regard to cross targeting: I assume LLVM IR and bitcode are machine independent, yet bitcode files encode an arch triple. Why? Is it just a hint for subsequent lowering phases, or it it a recommended target? Does IR/bitcode produced by a front-end configured for ARM differ from bitcode for, say PowerPC or x86? If different, then perhaps my assumption is naive that IR/bitcode is completely machine independent? I see that I must specify a target to llvm-gcc at configure time, just as with traditional gcc. Is that an artifact of GCC's operational model (because the GCC driver also assembles and links), or is there something target-specific about how cc1 generates IR/bitcode? How do I use clang as a cross compiler? I don't see a configure step for specifying a target arch/cpu when building clang, yet I also don't see options to specify a target arch/cpu. G -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090410/cd38748b/attachment.html>
> Does IR/bitcode produced by a front-end configured for ARM differ from > bitcode for, say PowerPC or x86?Yes.> If different, then perhaps my assumption is naive that IR/bitcode is completely machine independent?IR itself is platform-neutral, but language it was generated from - no. Please consider reading http://llvm.org/docs/FAQ.html#platformindependent -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
On Apr 10, 2009, at 12:04 PM, Greg McGary wrote:> How do I use clang as a cross compiler?In clang-cc speak, it is: $ clang-cc --help | grep trip -triple=<string> - Specify target triple (e.g. i686-apple-darwin9)> I don't see a configure step for specifying a target arch/cpu when > building clang, yet I also don't see options to specify a target > arch/cpu.Around here, we use options like -arch ppc to do this. They modify the cpu, but no so much the OS or vendor parts of the triple. The problem is that gcc doesn't do it quite like this. -V version -b machine are the usual options that come the closest to doing this. You can ask on the clang list and see if Daniel has a preferred method yet for doing this, but I'm thinking it was still just a fixme. -barm-linux or some such might be the way forward. See HostInfo.cpp, if you want to roll your own target with -arch.