<div dir="ltr">No. The gcc cross compiler being used (tilera-gcc) is indeed 64-bit.<div><br></div><div>Thanks</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 28, 2014 at 11:01 AM, Anton Korobeynikov <span dir="ltr"><<a href="mailto:anton@korobeynikov.info" target="_blank">anton@korobeynikov.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Looks like your gcc is 32-bit and you're trying to load 64-bit plugin.<br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, Oct 28, 2014 at 8:27 PM, Ajay Panyala <<a href="mailto:ajay.panyala@gmail.com">ajay.panyala@gmail.com</a>> wrote:<br>
> Hi Brian,<br>
><br>
> Thanks for sharing your experience with dragonegg.<br>
> I would like to use tilera-gcc as the compiler driver. native gcc would not<br>
> be able to<br>
> handle things like tilera specific intrinsics in the source code.<br>
><br>
> I built dragonegg using<br>
><br>
> GCC=/path/to/tilera-gcc48/bin/tile-gcc<br>
> LLVM_CONFIG=/path/to/tilera-llvm/bin/tilegx-llvm-config make<br>
><br>
> and also tried only emitting the IR<br>
><br>
>    /path/to/tilera-gcc48/bin/tile-gcc -fplugin=/path/to/dragonegg.so<br>
> -fplugin-arg-dragonegg-emit-ir -S -o hello.ll hello.c<br>
><br>
> (and still get the error: cannot load plugin dragonegg.so: wrong ELF class:<br>
> ELFCLASS64 )<br>
><br>
> - Ajay<br>
><br>
> On Mon, Oct 27, 2014 at 9:39 PM, Brian Faull <<a href="mailto:bfaull@cog-e.com">bfaull@cog-e.com</a>> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> There may be plenty more experienced experts on DragonEgg (and hopefully<br>
>> they'll correct me if I'm wrong), but I figured I'd chime in with my brief<br>
>> experience to start. I have messed with this a bit, and DragonEgg has worked<br>
>> for my experiments.  Your configuration has many things that are different<br>
>> than mine; however, I think you might simply have the cross-compilers<br>
>> crossed backward; I think you want to use your native gcc as<br>
>> compiler-driver; pass dragonegg.so to your native-gcc rather than<br>
>> tilera-gcc. I think you may simply need to do the following:<br>
>><br>
>> 1- Build DragonEgg using your system compiler (or gcc 4.6.4 as recommended<br>
>> on <a href="http://dragonegg.llvm.org" target="_blank">dragonegg.llvm.org</a>); when doing `make`, point explicitly at your *build*<br>
>> (x86_64) GCC of choice, and against your *target* (tilera) `llvm-config`.<br>
>> 2- use your x86_64 compiler-driver as front-end, which due to the magic of<br>
>> DragonEgg and llvm-config will use your target LLVM backend.<br>
>><br>
>> Or it could be really late and I'm not thinking straight. :)<br>
>><br>
>> More detail:<br>
>> I had to set a few non-obvious (to me) things in the build and use<br>
>> process, so I'll reflect them here for you and/or posterity.  You will need<br>
>> all three components though: LLVM backend for your architecture (tilera)<br>
>> I'd suggest a few things to try, in order for you to find a configuration<br>
>> that works for you:<br>
>><br>
>> * Sounds like you're on x86_64 / AMD64.  I'd suggest to start with<br>
>> building the simplest configuration: using your system compiler to build<br>
>> everything for your system native architecture, and this will be the easiest<br>
>> configuration to debug.<br>
>><br>
>> * According to the <a href="http://dragonegg.llvm.org" target="_blank">dragonegg.llvm.org</a> web site, DragonEgg works best with<br>
>> GCC 4.6.  You may wish to try that (I recommend looking at<br>
>> <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<br>
>> that version).  I don't know exactly why this version is said to work best;<br>
>> perhaps the DragonEgg site is simply stale.  I bootstrapped a clean, native<br>
>> version of 4.6.4 without much headache.<br>
>><br>
>> * Since I wanted to get DragonEgg built to work with GCC4.6.4, I built<br>
>> DragonEgg with GCC4.6.4.  IIRC, the DragonEgg makefile wants you to specify<br>
>> the compiler as GCC=... rather than CC=... but it looks like it should eat<br>
>> both.  Also, I read somewhere that LLVM3.3's llvm-config had some behavior<br>
>> that argues with DragonEgg.  Contrary to best practice "build outside the<br>
>> source tree" so as to prevent polluting of the source tree, I saw a<br>
>> recommendation to build *within* the source tree, so I rolled back and built<br>
>> LLVM3.3 *in the source tree* (GASP!) for native (x86_64). In sum, to build<br>
>> DragonEgg I used something like<br>
>>    GCC=/path/to/gcc464/bin/gcc<br>
>> LLVM_CONFIG=/path/to/llvm-3.3.src-x86_64/prefix/bin/llvm-config make<br>
>><br>
>> * Then to use this shiny new .so, I started by going only up to the point<br>
>> of emitting LLVM IR so as not to confuse the situation with further<br>
>> architecture-specific compilation/assembly:<br>
>>    /path/to/gcc464/bin/gcc -fplugin=/path/to/dragonegg.so<br>
>> -fplugin-arg-dragonegg-emit-ir -S -o hello.ll hello.c<br>
>> I also chose to specify the full path of dragonegg.so, so I didn't have to<br>
>> be concerned with library paths.<br>
>><br>
>> Then you should be able to manually use your backend (llvm33/bin/llc,<br>
>> assembler, etc.) to generate an architecture-specific object.  Once you've<br>
>> got all those components, you should be able to get everything integrated<br>
>> with just one gcc compiler-driver invocation.<br>
>><br>
>> HTH,<br>
>> Brian<br>
>><br>
>><br>
>><br>
>><br>
>> On Oct 27, 2014, at 11:53 PM, Ajay Panyala <<a href="mailto:ajay.panyala@gmail.com">ajay.panyala@gmail.com</a>> wrote:<br>
>><br>
>> I am using a gcc (v 4.8.2) cross compiler for the tilera architecture.<br>
>> There is an LLVM (v 3.3) cross compiler available for tilera<br>
>> (<a href="http://tilera.github.io/llvm" target="_blank">http://tilera.github.io/llvm</a>),<br>
>> but the frontend only has partial support for certain tilera intrinsics<br>
>> and no OpenMP support.<br>
>><br>
>> Hence, I have decided to use DragonEgg (v 3.3) to resolve this. I was able<br>
>> to build<br>
>> DragonEgg, but when I pass the command line argument -fplugin=dragonegg.so<br>
>> when compiling with the tilera-gcc I get the error<br>
>><br>
>> cannot load dragonegg.so: wrong ELF class: ELFCLASS64<br>
>><br>
>> i.e. the tilera-gcc does not accept the x86 shared library object<br>
>> dragonegg.so<br>
>><br>
>> The dragonegg sources were built using the x86 GCC, but the plugin<br>
>> was built to load into the tilera gcc.<br>
>><br>
>> Could someone please point out what I am missing here.<br>
>><br>
>> Thanks<br>
>> Ajay<br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu">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>
>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">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>
><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
With best regards, Anton Korobeynikov<br>
Faculty of Mathematics and Mechanics, Saint Petersburg State University<br>
</font></span></blockquote></div><br></div>