<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hello,</div><div class=""><br class=""></div><div class="">There may be plenty more experienced experts on DragonEgg (and hopefully they'll correct me if I'm wrong), but I figured I'd chime in with my brief experience to start. I have messed with this a bit, and DragonEgg has worked for my experiments.  Your configuration has many things that are different than mine; however, I think you might simply have the cross-compilers crossed backward; I think you want to use your native gcc as compiler-driver; pass dragonegg.so to your native-gcc rather than tilera-gcc. I think you may simply need to do the following:</div><div class=""><br class=""></div><div class="">1- Build DragonEgg using your system compiler (or gcc 4.6.4 as recommended on <a href="http://dragonegg.llvm.org" class="">dragonegg.llvm.org</a>); when doing `make`, point explicitly at your *build* (x86_64) GCC of choice, and against your *target* (tilera) `llvm-config`.</div><div class="">2- use your x86_64 compiler-driver as front-end, which due to the magic of DragonEgg and llvm-config will use your target LLVM backend.</div><div class=""><br class=""></div><div class="">Or it could be really late and I'm not thinking straight. :)</div><div class=""><br class=""></div><div class="">More detail:</div><div class="">I had to set a few non-obvious (to me) things in the build and use process, so I'll reflect them here for you and/or posterity.  You will need all three components though: LLVM backend for your architecture (tilera)   I'd suggest a few things to try, in order for you to find a configuration that works for you:</div><div class=""><br class=""></div><div class="">* Sounds like you're on x86_64 / AMD64.  I'd suggest to start with building the simplest configuration: using your system compiler to build everything for your system native architecture, and this will be the easiest configuration to debug.  </div><div class=""><br class=""></div><div class=""><div class="">* According to the <a href="http://dragonegg.llvm.org" class="">dragonegg.llvm.org</a> web site, DragonEgg works best with GCC 4.6.  You may wish to try that (I recommend looking at <a href="http://gcc.gnu.org/gcc-4.6/" class="">http://gcc.gnu.org/gcc-4.6/</a> for GCC 4.6.4, which is the latest release of that version).  I don't know exactly why this version is said to work best; perhaps the DragonEgg site is simply stale.  I bootstrapped a clean, native version of 4.6.4 without much headache.</div></div><div class=""><br class=""></div><div class=""><div class="">* Since I wanted to get DragonEgg built to work with GCC4.6.4, I built DragonEgg with GCC4.6.4.  IIRC, the DragonEgg makefile wants you to specify the compiler as GCC=... rather than CC=... but it looks like it should eat both.  Also, I read somewhere that LLVM3.3's llvm-config had some behavior that argues with DragonEgg.  Contrary to best practice "build outside the source tree" so as to prevent polluting of the source tree, I saw a recommendation to build *within* the source tree, so I rolled back and built LLVM3.3 *in the source tree* (GASP!) for native (x86_64). In sum, to build DragonEgg I used something like</div><div class="">   GCC=/path/to/gcc464/bin/gcc LLVM_CONFIG=/path/to/llvm-3.3.src-x86_64/prefix/bin/llvm-config make</div><div class=""><br class=""></div><div class="">* Then to use this shiny new .so, I started by going only up to the point of emitting LLVM IR so as not to confuse the situation with further architecture-specific compilation/assembly:</div><div class="">   /path/to/gcc464/bin/gcc -fplugin=/path/to/dragonegg.so -fplugin-arg-dragonegg-emit-ir -S -o hello.ll hello.c</div><div class="">I also chose to specify the full path of dragonegg.so, so I didn't have to be concerned with library paths.</div><div class=""><br class=""></div><div class="">Then you should be able to manually use your backend (llvm33/bin/llc, assembler, etc.) to generate an architecture-specific object.  Once you've got all those components, you should be able to get everything integrated with just one gcc compiler-driver invocation.</div><div class=""><br class=""></div><div class="">HTH,</div><div class="">Brian</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 27, 2014, at 11:53 PM, Ajay Panyala <<a href="mailto:ajay.panyala@gmail.com" class="">ajay.panyala@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I am using a gcc (v 4.8.2) cross compiler for the tilera architecture.<div class="">There is an LLVM (v 3.3) cross compiler available for tilera (<a href="http://tilera.github.io/llvm" class="">http://tilera.github.io/llvm</a>),</div><div class="">but the frontend only has partial support for certain tilera intrinsics and no OpenMP support.</div><div class=""><br class=""></div><div class="">Hence, I have decided to use DragonEgg (v 3.3) to resolve this. I was able to build</div><div class="">DragonEgg, but when I pass the command line argument -fplugin=dragonegg.so </div><div class="">when compiling with the tilera-gcc I get the error</div><div class=""><h1 itemprop="name" style="margin: 0px 0px 7px; padding: 0px; border: 0px; vertical-align: baseline; font-family: 'Trebuchet MS', 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 1.3; background-repeat: initial initial;" class=""><font class="">cannot load dragonegg.so: wrong ELF class: ELFCLASS64</font></h1></div><div class="">i.e. the tilera-gcc does not accept the x86 shared library object dragonegg.so </div><div class=""><br class=""></div><div class="">The dragonegg sources were built using the x86 GCC, but the plugin </div><div class="">was built to load into the tilera gcc.</div><div class=""><br class=""></div><div class="">Could someone please point out what I am missing here.<br class=""></div><div class=""><br class=""></div><div class="">Thanks</div><div class="">Ajay</div></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" class="">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class=""></div></blockquote></div><br class=""></body></html>