<div dir="ltr">Hi Brian,<div><br></div><div>Yes, the 64-bit build of the tilera tools should do it (file tile-gcc shows it to be a 32-bit executable).</div><div>I did not setup the tilera toolchain on this machine, but it looks like tile-gcc was configured as 32-bit by default.</div><div>The OS is a 64-bit RHEL 5. I will try the native compiler and target and also try build the </div><div>64-bit tilera gcc and see how it goes. Thanks a lot!<br></div><div><br></div><div>- Ajay</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 28, 2014 at 11:19 AM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi again Ajay,<br>
<br>
I think my knowledge of DragonEgg is now exhausted. :)  Still seems like this should be possible; here’s a few more questions and suggestions.<br>
<br>
Building on  Anton says, 32-/64-bit could be the situation:<br>
* Are you on 32b Linux -- or what architecture are you on (e.g., what does `uname -a` give you?<br>
* Or, how is your tile-gcc configured (e.g., configure --build=? --host=? --target=tilera?).<br>
* If you are on an x86_64 system, you might be using, say,  multilib and a 32-bit tile-gcc or something.  E.g., what does `file tile-gcc` give you?<br>
<br>
I still don't think you want to build DragonEgg with tile-gcc.  Try building dragonegg.so using your system gcc, then using `tile-gcc -fplugin=...`<br>
<br>
As another hack, it might be possible to put your sources through `tile-gcc` just through the preprocessor (e.g., `tile-gcc -E -o ...`) but that's a bit of a kludge and depends on what the nature of the target-specific items in your sources are.<br>
<br>
I think you might want to step back and try to get DragonEgg working on a native compiler with native target.  Would you try my "first bullet" in my original response -- configure native gcc, native llvm, build dragonegg.so, then use same to build a helloworld?<br>
<span class="HOEnZb"><font color="#888888"><br>
Brian<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
> On Oct 28, 2014, at 2:13 PM, Anton Korobeynikov <<a href="mailto:anton@korobeynikov.info">anton@korobeynikov.info</a>> wrote:<br>
><br>
> What does "file /path/to/tilera-gcc48/bin/tile-gcc" and "file<br>
> /path/to/dragonegg.so" report?<br>
><br>
> On Tue, Oct 28, 2014 at 9:11 PM, Ajay Panyala <<a href="mailto:ajay.panyala@gmail.com">ajay.panyala@gmail.com</a>> wrote:<br>
>> No. The gcc cross compiler being used (tilera-gcc) is indeed 64-bit.<br>
>><br>
>> Thanks<br>
>><br>
>> On Tue, Oct 28, 2014 at 11:01 AM, Anton Korobeynikov<br>
>> <<a href="mailto:anton@korobeynikov.info">anton@korobeynikov.info</a>> wrote:<br>
>>><br>
>>> Looks like your gcc is 32-bit and you're trying to load 64-bit plugin.<br>
>>><br>
>>> On Tue, Oct 28, 2014 at 8:27 PM, Ajay Panyala <<a href="mailto:ajay.panyala@gmail.com">ajay.panyala@gmail.com</a>><br>
>>> 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<br>
>>>> 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<br>
>>>> 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<br>
>>>>> hopefully<br>
>>>>> they'll correct me if I'm wrong), but I figured I'd chime in with my<br>
>>>>> brief<br>
>>>>> experience to start. I have messed with this a bit, and DragonEgg has<br>
>>>>> worked<br>
>>>>> for my experiments.  Your configuration has many things that are<br>
>>>>> 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<br>
>>>>> recommended<br>
>>>>> on <a href="http://dragonegg.llvm.org" target="_blank">dragonegg.llvm.org</a>); when doing `make`, point explicitly at your<br>
>>>>> *build*<br>
>>>>> (x86_64) GCC of choice, and against your *target* (tilera)<br>
>>>>> `llvm-config`.<br>
>>>>> 2- use your x86_64 compiler-driver as front-end, which due to the magic<br>
>>>>> 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<br>
>>>>> need<br>
>>>>> all three components though: LLVM backend for your architecture<br>
>>>>> (tilera)<br>
>>>>> I'd suggest a few things to try, in order for you to find a<br>
>>>>> 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<br>
>>>>> build<br>
>>>>> everything for your system native architecture, and this will be the<br>
>>>>> 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<br>
>>>>> 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<br>
>>>>> of<br>
>>>>> that version).  I don't know exactly why this version is said to work<br>
>>>>> best;<br>
>>>>> perhaps the DragonEgg site is simply stale.  I bootstrapped a clean,<br>
>>>>> 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<br>
>>>>> specify<br>
>>>>> the compiler as GCC=... rather than CC=... but it looks like it should<br>
>>>>> eat<br>
>>>>> both.  Also, I read somewhere that LLVM3.3's llvm-config had some<br>
>>>>> behavior<br>
>>>>> that argues with DragonEgg.  Contrary to best practice "build outside<br>
>>>>> 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<br>
>>>>> built<br>
>>>>> LLVM3.3 *in the source tree* (GASP!) for native (x86_64). In sum, to<br>
>>>>> 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<br>
>>>>> 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<br>
>>>>> 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<br>
>>>>> you've<br>
>>>>> got all those components, you should be able to get everything<br>
>>>>> 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>><br>
>>>>> 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<br>
>>>>> able<br>
>>>>> to build<br>
>>>>> DragonEgg, but when I pass the command line argument<br>
>>>>> -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>
>>> --<br>
>>> With best regards, Anton Korobeynikov<br>
>>> Faculty of Mathematics and Mechanics, Saint Petersburg State University<br>
>><br>
>><br>
><br>
><br>
><br>
> --<br>
> With best regards, Anton Korobeynikov<br>
> Faculty of Mathematics and Mechanics, Saint Petersburg State University<br>
<br>
</div></div></blockquote></div><br></div>