<div dir="ltr">Hi Brian,<div><br></div><div>Thanks for sharing your experience with dragonegg.</div><div>I would like to use tilera-gcc as the compiler driver. native gcc would not be able to </div><div>handle things like tilera specific intrinsics in the source code.</div><div><br></div><div>I built dragonegg using</div><div><br></div><div>GCC=/path/to/tilera-gcc48/bin/tile-gcc LLVM_CONFIG=/path/to/tilera-llvm/bin/tilegx-llvm-config make<br></div><div><br></div><div>and also tried only emitting the IR</div><div><br></div><div>   /path/to/tilera-gcc48/bin/tile-gcc -fplugin=/path/to/dragonegg.so -fplugin-arg-dragonegg-emit-ir -S -o hello.ll hello.c<br></div><div><br></div><div>(and still get the error: cannot load plugin dragonegg.so: wrong ELF class: ELFCLASS64 )</div><div><br></div><div>- Ajay<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 27, 2014 at 9:39 PM, Brian Faull <span dir="ltr"><<a href="mailto:bfaull@cog-e.com" target="_blank">bfaull@cog-e.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Hello,</div><div><br></div><div>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><br></div><div>1- Build DragonEgg using your system compiler (or gcc 4.6.4 as recommended on <a href="http://dragonegg.llvm.org" target="_blank">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>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><br></div><div>Or it could be really late and I'm not thinking straight. :)</div><div><br></div><div>More detail:</div><div>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><br></div><div>* 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><br></div><div><div>* According to the <a href="http://dragonegg.llvm.org" target="_blank">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/" target="_blank">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><br></div><div><div>* 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>   GCC=/path/to/gcc464/bin/gcc LLVM_CONFIG=/path/to/llvm-3.3.src-x86_64/prefix/bin/llvm-config make</div><div><br></div><div>* 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>   /path/to/gcc464/bin/gcc -fplugin=/path/to/dragonegg.so -fplugin-arg-dragonegg-emit-ir -S -o hello.ll hello.c</div><div>I also chose to specify the full path of dragonegg.so, so I didn't have to be concerned with library paths.</div><div><br></div><div>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><br></div><div>HTH,</div><div>Brian</div><div><br></div><div><br></div><div><br></div></div><br><div><blockquote type="cite"><div><div class="h5"><div>On Oct 27, 2014, at 11:53 PM, Ajay Panyala <<a href="mailto:ajay.panyala@gmail.com" target="_blank">ajay.panyala@gmail.com</a>> wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr">I am using a gcc (v 4.8.2) cross compiler for the tilera architecture.<div>There is an LLVM (v 3.3) cross compiler available for tilera (<a href="http://tilera.github.io/llvm" target="_blank">http://tilera.github.io/llvm</a>),</div><div>but the frontend only has partial support for certain tilera intrinsics and no OpenMP support.</div><div><br></div><div>Hence, I have decided to use DragonEgg (v 3.3) to resolve this. I was able to build</div><div>DragonEgg, but when I pass the command line argument -fplugin=dragonegg.so </div><div>when compiling with the tilera-gcc I get the error</div><div><h1 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"><font>cannot load dragonegg.so: wrong ELF class: ELFCLASS64</font></h1></div><div>i.e. the tilera-gcc does not accept the x86 shared library object dragonegg.so </div><div><br></div><div>The dragonegg sources were built using the x86 GCC, but the plugin </div><div>was built to load into the tilera gcc.</div><div><br></div><div>Could someone please point out what I am missing here.<br></div><div><br></div><div>Thanks</div><div>Ajay</div></div></div></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></div></blockquote></div><br></div></blockquote></div><br></div></div>